honnef.co/go/tools@v0.4.7/staticcheck/testdata/src/example.com/CheckSideEffectFreeCalls/CheckSideEffectFreeCalls_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) //@ diag(`doesn't have side effects`) 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 }