github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/staticcheck/testdata/CheckDubiousSyncPoolSize.go (about)

     1  package pkg
     2  
     3  import "sync"
     4  
     5  type T1 struct {
     6  	x int
     7  }
     8  
     9  type T2 struct {
    10  	x int
    11  	y int
    12  }
    13  
    14  func fn() {
    15  	s := []int{}
    16  
    17  	v := sync.Pool{}
    18  	v.Put(s) // MATCH /argument should be one word large or less/
    19  	v.Put(&s)
    20  	v.Put(T1{})
    21  	v.Put(T2{}) // MATCH /argument should be one word large or less/
    22  
    23  	p := &sync.Pool{}
    24  	p.Put(s) // MATCH /argument should be one word large or less/
    25  	p.Put(&s)
    26  
    27  	var i interface{}
    28  	p.Put(i)
    29  }