github.com/cockroachdb/tools@v0.0.0-20230222021103-a6d27438930d/go/analysis/passes/unusedresult/unusedresult_test.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package unusedresult_test 6 7 import ( 8 "testing" 9 10 "golang.org/x/tools/go/analysis/analysistest" 11 "golang.org/x/tools/go/analysis/passes/unusedresult" 12 "golang.org/x/tools/internal/typeparams" 13 ) 14 15 func Test(t *testing.T) { 16 testdata := analysistest.TestData() 17 funcs := "typeparams/userdefs.MustUse,errors.New,fmt.Errorf,fmt.Sprintf,fmt.Sprint" 18 unusedresult.Analyzer.Flags.Set("funcs", funcs) 19 tests := []string{"a"} 20 if typeparams.Enabled { 21 tests = append(tests, "typeparams") 22 } 23 analysistest.Run(t, testdata, unusedresult.Analyzer, tests...) 24 }