github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/staticcheck/testdata/CheckUnsafePrintf.go (about)

     1  package pkg
     2  
     3  import (
     4  	"fmt"
     5  	"log"
     6  )
     7  
     8  func fn() {
     9  	var s string
    10  	fn2 := func() string { return "" }
    11  	fmt.Printf(fn2())  // MATCH /should use print-style function/
    12  	fmt.Sprintf(fn2()) // MATCH /should use print-style function/
    13  	log.Printf(fn2())  // MATCH /should use print-style function/
    14  	fmt.Printf(s)      // MATCH /should use print-style function/
    15  	fmt.Printf(s, "")
    16  
    17  	fmt.Printf(fn2(), "")
    18  	fmt.Printf("")
    19  	fmt.Printf("", "")
    20  }