github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/interface7b.gno (about) 1 package main 2 3 import "fmt" 4 5 type T int 6 7 func (t T) Error() string { return fmt.Sprintf("This is an error from T: %d", t) } 8 9 func f(t T) error { return t } 10 11 func main() { 12 x := T(1) 13 println(f(x).Error()) 14 } 15 16 // Output: 17 // This is an error from T: 1