github.com/gwaycc/gometalinter@v3.0.0+incompatible/regressiontests/gochecknoinits_test.go (about) 1 package regressiontests 2 3 import "testing" 4 5 func TestGochecknoinits(t *testing.T) { 6 t.Parallel() 7 source := `package test 8 9 var variable = 1 10 11 type S struct {} 12 13 func (s S) init() {} 14 15 func main() { 16 init := func() {} 17 init() 18 } 19 20 func init() {} 21 ` 22 expected := Issues{ 23 {Linter: "gochecknoinits", Severity: "warning", Path: "test.go", Line: 14, Message: "init function"}, 24 } 25 ExpectIssues(t, "gochecknoinits", source, expected) 26 }