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