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 / CheckUnsafePrintf / CheckUnsafePrintf.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/CheckUnsafePrintf/CheckUnsafePrintf.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/staticcheck/testdata/src/CheckUnsafePrintf/CheckUnsafePrintf.go
new file mode 100644 (file)
index 0000000..33a336d
--- /dev/null
@@ -0,0 +1,22 @@
+package pkg
+
+import (
+       "fmt"
+       "log"
+       "os"
+)
+
+func fn(s string) {
+       fn2 := func() string { return "" }
+       fmt.Printf(fn2())      // want `should use print-style function`
+       _ = fmt.Sprintf(fn2()) // want `should use print-style function`
+       log.Printf(fn2())      // want `should use print-style function`
+       fmt.Printf(s)          // want `should use print-style function`
+       fmt.Printf(s, "")
+       fmt.Fprintf(os.Stdout, s) // want `should use print-style function`
+       fmt.Fprintf(os.Stdout, s, "")
+
+       fmt.Printf(fn2(), "")
+       fmt.Printf("")
+       fmt.Printf("%s", "")
+}