github.com/traefik/yaegi@v0.15.1/_test/interface41.go (about) 1 package main 2 3 import "fmt" 4 5 type foo struct { 6 bar string 7 } 8 9 func (f *foo) String() string { 10 return "Hello from " + f.bar 11 } 12 13 func Foo(s string) fmt.Stringer { 14 return &foo{s} 15 } 16 17 func main() { 18 f := Foo("bar") 19 fmt.Println(f) 20 } 21 22 // Output: 23 // Hello from bar