github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/backup/interface39.gno (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