honnef.co/go/tools@v0.5.0-0.dev.0.20240520180541-dcae280a5e87/staticcheck/sa9001/testdata/src/example.com/CheckDubiousDeferInChannelRangeLoop/generics.go (about)

     1  //go:build go1.18
     2  
     3  package pkg
     4  
     5  func tpfn[T chan int]() {
     6  	var ch T
     7  	for range ch {
     8  		defer println() //@ diag(`defers in this range loop`)
     9  	}
    10  }