Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201028153306-37f0764111ff / go / analysis / passes / printf / testdata / src / b / b.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/go/analysis/passes/printf/testdata/src/b/b.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/go/analysis/passes/printf/testdata/src/b/b.go
new file mode 100644 (file)
index 0000000..cf5f082
--- /dev/null
@@ -0,0 +1,33 @@
+package b
+
+import "fmt"
+
+// Wrapf is a printf wrapper.
+func Wrapf(format string, args ...interface{}) { // want Wrapf:"printfWrapper"
+       fmt.Sprintf(format, args...)
+}
+
+// Wrap is a print wrapper.
+func Wrap(args ...interface{}) { // want Wrap:"printWrapper"
+       fmt.Sprint(args...)
+}
+
+// NoWrap is not a wrapper.
+func NoWrap(format string, args ...interface{}) {
+}
+
+// Wrapf2 is another printf wrapper.
+func Wrapf2(format string, args ...interface{}) string { // want Wrapf2:"printfWrapper"
+
+       // This statement serves as an assertion that this function is a
+       // printf wrapper and that calls to it should be checked
+       // accordingly, even though the delegation below is obscured by
+       // the "("+format+")" operations.
+       if false {
+               fmt.Sprintf(format, args...)
+       }
+
+       // Effectively a printf delegation,
+       // but the printf checker can't see it.
+       return fmt.Sprintf("("+format+")", args...)
+}