github.com/traefik/yaegi@v0.15.1/_test/issue-1166.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "io" 6 ) 7 8 type T []byte 9 10 func (t *T) Write(p []byte) (n int, err error) { *t = append(*t, p...); return len(p), nil } 11 12 func foo(w io.Writer) { 13 a := w.(*T) 14 fmt.Fprint(a, "test") 15 fmt.Printf("%s\n", *a) 16 } 17 18 func main() { 19 x := T{} 20 foo(&x) 21 } 22 23 // Output: 24 // test