github.com/traefik/yaegi@v0.15.1/_test/interface38.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 main() { 14 var f fmt.Stringer = foo{bar: "bar"} 15 fmt.Println(f) 16 } 17 18 // Output: 19 // Hello from bar