1 // compile 2 3 package main 4 5 type Foo interface { 6 Print() 7 } 8 9 type Bar struct{} 10 11 func (b Bar) Print() {} 12 13 func main() { 14 b := make([]Bar, 20) 15 f := make([]Foo, 20) 16 for i := range f { 17 f[i] = b[i] 18 } 19 T(f) 20 _ = make([]struct{}, 1) 21 } 22 23 func T(f []Foo) { 24 for i := range f { 25 f[i].Print() 26 } 27 } 28