X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fhonnef.co%2Fgo%2Ftools%40v0.1.1%2Fsimple%2Ftestdata%2Fsrc%2FCheckRedundantSprintf%2FLintRedundantSprintf.go;fp=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fhonnef.co%2Fgo%2Ftools%40v0.1.1%2Fsimple%2Ftestdata%2Fsrc%2FCheckRedundantSprintf%2FLintRedundantSprintf.go;h=b274b594e9c2589ce292ecdb454f9007b4356370;hb=3c06164f15bd10aed7d66b6314764a2961a14762;hp=0000000000000000000000000000000000000000;hpb=0e9c3ceb40901f4d44981c1376cb9e23a248e006;p=dotfiles%2F.git diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/simple/testdata/src/CheckRedundantSprintf/LintRedundantSprintf.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/simple/testdata/src/CheckRedundantSprintf/LintRedundantSprintf.go new file mode 100644 index 00000000..b274b594 --- /dev/null +++ b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/simple/testdata/src/CheckRedundantSprintf/LintRedundantSprintf.go @@ -0,0 +1,46 @@ +package pkg + +import "fmt" + +type T1 string +type T2 T1 +type T3 int +type T4 int +type T5 int +type T6 string +type T9 string +type T11 int + +func (T3) String() string { return "" } +func (T6) String() string { return "" } +func (T4) String(arg int) string { return "" } +func (T5) String() {} + +func (T9) Format(f fmt.State, c rune) {} +func (T11) Format(f fmt.State, c rune) {} +func (T11) String() string { return "" } + +func fn() { + var t1 T1 + var t2 T2 + var t3 T3 + var t4 T4 + var t5 T5 + var t6 T6 + var t9 T9 + var t11 T11 + _ = fmt.Sprintf("%s", "test") // want `is already a string` + _ = fmt.Sprintf("%s", t1) // want `is a string` + _ = fmt.Sprintf("%s", t2) // want `is a string` + _ = fmt.Sprintf("%s", t3) // want `should use String\(\) instead of fmt\.Sprintf` + _ = fmt.Sprintf("%s", t3.String()) // want `is already a string` + _ = fmt.Sprintf("%s", t4) + _ = fmt.Sprintf("%s", t5) + _ = fmt.Sprintf("%s %s", t1, t2) + _ = fmt.Sprintf("%v", t1) + _ = fmt.Sprintf("%s", t6) // want `should use String\(\) instead of fmt\.Sprintf` + + // don't simplify types that implement fmt.Formatter + _ = fmt.Sprintf("%s", t9) + _ = fmt.Sprintf("%s", t11) +}