github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa1006/testdata/src/example.com/CheckUnsafePrintf/CheckUnsafePrintf.go.golden (about) 1 package pkg 2 3 import ( 4 "fmt" 5 "log" 6 "os" 7 ) 8 9 func fn(s string) { 10 fn2 := func() string { return "" } 11 fmt.Print(fn2()) //@ diag(`should use print-style function`) 12 _ = fmt.Sprint(fn2()) //@ diag(`should use print-style function`) 13 log.Print(fn2()) //@ diag(`should use print-style function`) 14 fmt.Print(s) //@ diag(`should use print-style function`) 15 fmt.Printf(s, "") 16 fmt.Fprint(os.Stdout, s) //@ diag(`should use print-style function`) 17 fmt.Fprintf(os.Stdout, s, "") 18 19 fmt.Printf(fn2(), "") 20 fmt.Printf("") 21 fmt.Printf("%s", "") 22 fmt.Printf(fn3()) 23 } 24 25 func fn3() (string, int) { return "", 0 }