github.com/traefik/yaegi@v0.15.1/_test/interface51.go (about) 1 package main 2 3 type Error interface { 4 error 5 Message() string 6 } 7 8 type T struct { 9 Msg string 10 } 11 12 func (t *T) Error() string { return t.Msg } 13 func (t *T) Message() string { return "message:" + t.Msg } 14 15 func newError() Error { return &T{"test"} } 16 17 func main() { 18 e := newError() 19 println(e.Error()) 20 } 21 22 // Output: 23 // test