github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/simple/s1031/testdata/src/example.com/CheckNilCheckAroundRange/CheckNilCheckAroundRange_generics.go (about) 1 //go:build go1.18 2 3 package pkg 4 5 func _[T int | string](x []T) { 6 if x != nil { //@ diag(`unnecessary nil check around range`) 7 for range x { 8 } 9 } 10 } 11 12 func _[T int | string, S []T](x S) { 13 if x != nil { //@ diag(`unnecessary nil check around range`) 14 for range x { 15 } 16 } 17 } 18 19 func _[T []string](x T) { 20 if x != nil { //@ diag(`unnecessary nil check around range`) 21 for range x { 22 } 23 } 24 } 25 26 func _[T chan int](x T) { 27 if x != nil { 28 for range x { 29 } 30 } 31 } 32 33 func _[T any, S chan T](x S) { 34 if x != nil { 35 for range x { 36 } 37 } 38 }