github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa6001/testdata/src/example.com/CheckMapBytesKey/key_generics.go (about)

     1  //go:build go1.18
     2  
     3  package pkg
     4  
     5  func tpfn[T ~string | []byte | int](b T) {
     6  	var m map[string]int
     7  	k := string(b) //@ diag(`would be more efficient`)
     8  	_ = m[k]
     9  }