honnef.co/go/tools@v0.4.7/staticcheck/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  }