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

     1  package pkg
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  )
     7  
     8  func TestFoo(t *testing.T) {
     9  	strings.Replace("", "", "", 1) // MATCH /is a pure function but its return value is ignored/
    10  }
    11  
    12  func BenchmarkFoo(b *testing.B) {
    13  	strings.Replace("", "", "", 1)
    14  }
    15  
    16  func doBenchmark(s string, b *testing.B) {
    17  	strings.Replace("", "", "", 1)
    18  }
    19  
    20  func BenchmarkBar(b *testing.B) {
    21  	doBenchmark("", b)
    22  }