github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa5011/testdata/src/example.com/CheckMaybeNil/generics.go (about) 1 //go:build go1.18 2 3 package pkg 4 5 func tpfn1[T []int](x T) { 6 // don't flag, T is a slice 7 _ = x[0] 8 if x == nil { 9 return 10 } 11 println() 12 } 13 14 func tpfn2[T *int,](x T) { 15 _ = *x //@ diag(`possible nil pointer dereference`) 16 if x == nil { 17 return 18 } 19 println() 20 }