github.com/gmemcc/yaegi@v0.12.1-0.20221128122509-aa99124c5d16/_test/method25.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "sync" 6 ) 7 8 func (p Pool) Get() *Buffer { return &Buffer{} } 9 10 func NewPool() Pool { return Pool{} } 11 12 type Buffer struct { 13 bs []byte 14 pool Pool 15 } 16 17 type Pool struct { 18 p *sync.Pool 19 } 20 21 var ( 22 _pool = NewPool() 23 Get = _pool.Get 24 ) 25 26 func main() { 27 fmt.Println(_pool) 28 fmt.Println(Get()) 29 } 30 31 // Output: 32 // {<nil>} 33 // &{[] {<nil>}}