
full diff: https://github.com/dominikh/go-tools/compare/2019.2.3...2020.1.3 Also updates tests to accomodate updated rules: --- FAIL: TestSourcesFromTestdataWithIssuesDir/staticcheck.go (0.43s) linters_test.go:137: [run --disable-all --print-issued-lines=false --print-linter-name=false --out-format=line-number --max-same-issues=10 -Estaticcheck --no-config testdata/staticcheck.go] linters_test.go:33: Error Trace: linters_test.go:33 linters_test.go:138 linters_test.go:53 Error: Received unexpected error: staticcheck.go:11: no match for `self-assignment of x to x` vs ["SA4006: this value of `x` is never used"] in: staticcheck.go:11:2: SA4006: this value of `x` is never used unmatched errors staticcheck.go:11:2: SA4006: this value of `x` is never used Test: TestSourcesFromTestdataWithIssuesDir/staticcheck.go Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
82 lines
2.3 KiB
Go
82 lines
2.3 KiB
Go
package stylecheck
|
|
|
|
import (
|
|
"golang.org/x/tools/go/analysis"
|
|
"golang.org/x/tools/go/analysis/passes/inspect"
|
|
"honnef.co/go/tools/config"
|
|
"honnef.co/go/tools/facts"
|
|
"honnef.co/go/tools/internal/passes/buildir"
|
|
"honnef.co/go/tools/lint/lintutil"
|
|
)
|
|
|
|
var Analyzers = lintutil.InitializeAnalyzers(Docs, map[string]*analysis.Analyzer{
|
|
"ST1000": {
|
|
Run: CheckPackageComment,
|
|
},
|
|
"ST1001": {
|
|
Run: CheckDotImports,
|
|
Requires: []*analysis.Analyzer{facts.Generated, config.Analyzer},
|
|
},
|
|
"ST1003": {
|
|
Run: CheckNames,
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, config.Analyzer},
|
|
},
|
|
"ST1005": {
|
|
Run: CheckErrorStrings,
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer},
|
|
},
|
|
"ST1006": {
|
|
Run: CheckReceiverNames,
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer, facts.Generated},
|
|
},
|
|
"ST1008": {
|
|
Run: CheckErrorReturn,
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer},
|
|
},
|
|
"ST1011": {
|
|
Run: CheckTimeNames,
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer},
|
|
},
|
|
"ST1012": {
|
|
Run: CheckErrorVarNames,
|
|
Requires: []*analysis.Analyzer{config.Analyzer},
|
|
},
|
|
"ST1013": {
|
|
Run: CheckHTTPStatusCodes,
|
|
// TODO(dh): why does this depend on facts.TokenFile?
|
|
Requires: []*analysis.Analyzer{facts.Generated, facts.TokenFile, config.Analyzer, inspect.Analyzer},
|
|
},
|
|
"ST1015": {
|
|
Run: CheckDefaultCaseOrder,
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile},
|
|
},
|
|
"ST1016": {
|
|
Run: CheckReceiverNamesIdentical,
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer, facts.Generated},
|
|
},
|
|
"ST1017": {
|
|
Run: CheckYodaConditions,
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile},
|
|
},
|
|
"ST1018": {
|
|
Run: CheckInvisibleCharacters,
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer},
|
|
},
|
|
"ST1019": {
|
|
Run: CheckDuplicatedImports,
|
|
Requires: []*analysis.Analyzer{facts.Generated, config.Analyzer},
|
|
},
|
|
"ST1020": {
|
|
Run: CheckExportedFunctionDocs,
|
|
Requires: []*analysis.Analyzer{facts.Generated, inspect.Analyzer},
|
|
},
|
|
"ST1021": {
|
|
Run: CheckExportedTypeDocs,
|
|
Requires: []*analysis.Analyzer{facts.Generated, inspect.Analyzer},
|
|
},
|
|
"ST1022": {
|
|
Run: CheckExportedVarDocs,
|
|
Requires: []*analysis.Analyzer{facts.Generated, inspect.Analyzer},
|
|
},
|
|
})
|