github.com/traefik/yaegi@v0.15.1/_test/issue-1320.go (about) 1 package main 2 3 type Pooler interface { 4 Get() string 5 } 6 7 type baseClient struct { 8 connPool Pooler 9 } 10 11 type connPool struct { 12 name string 13 } 14 15 func (c *connPool) Get() string { return c.name } 16 17 func newBaseClient(i int, p Pooler) *baseClient { 18 return &baseClient{connPool: p} 19 } 20 21 func newConnPool() *connPool { return &connPool{name: "connPool"} } 22 23 func main() { 24 b := newBaseClient(0, newConnPool()) 25 println(b.connPool.(*connPool).name) 26 } 27 28 // Output: 29 // connPool