Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / staticcheck / testdata / src / CheckMapBytesKey / key.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/staticcheck/testdata/src/CheckMapBytesKey/key.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/staticcheck/testdata/src/CheckMapBytesKey/key.go
new file mode 100644 (file)
index 0000000..0611e50
--- /dev/null
@@ -0,0 +1,16 @@
+package pkg
+
+func fn() {
+       var m map[string]int
+       var b []byte
+       _ = m[string(b)]
+       _ = m[string(b)]
+       s1 := string(b) // want `m\[string\(key\)\] would be more efficient than k := string\(key\); m\[k\]`
+       _ = m[s1]
+       _ = m[s1]
+
+       s2 := string(b)
+       _ = m[s2]
+       _ = m[s2]
+       println(s2)
+}