staticcheck: bump to v0.4.0 (#3551)

This commit is contained in:
Ludovic Fernandez 2023-02-03 15:41:37 +01:00 committed by GitHub
parent 06e3515fa8
commit 7beb2fb734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 11 deletions

View File

@ -135,6 +135,8 @@ issues:
text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead."
- path: pkg/lint/lintersdb/manager.go
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."
- path: pkg/golinters/unused.go
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
run:
timeout: 5m

2
go.mod
View File

@ -112,7 +112,7 @@ require (
gitlab.com/bosi/decorder v0.2.3
golang.org/x/tools v0.5.0
gopkg.in/yaml.v3 v3.0.1
honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720
honnef.co/go/tools v0.4.0
mvdan.cc/gofumpt v0.4.0
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d

4
go.sum generated
View File

@ -999,8 +999,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720 h1:L3lQbXWMmkBfyGXTvipQVmLXSM5SsT/39qcf+0RBIlQ=
honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720/go.mod h1:lbrxuU0wR28B7d2OiCxa+DVcNWwTjaY3RfXQNu3r10U=
honnef.co/go/tools v0.4.0 h1:lyXVV1c8wUBJRKqI8JgIpT8TW1VDagfYYaxbKa/HoL8=
honnef.co/go/tools v0.4.0/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA=
mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I=

View File

@ -63,25 +63,19 @@ func runUnused(pass *analysis.Pass) ([]goanalysis.Issue, error) {
return nil, err
}
sr := unused.Serialize(pass, res.(unused.Result), pass.Fset)
used := make(map[string]bool)
for _, obj := range sr.Used {
for _, obj := range res.(unused.Result).Used {
used[fmt.Sprintf("%s %d %s", obj.Position.Filename, obj.Position.Line, obj.Name)] = true
}
var issues []goanalysis.Issue
// Inspired by https://github.com/dominikh/go-tools/blob/d694aadcb1f50c2d8ac0a1dd06217ebb9f654764/lintcmd/lint.go#L177-L197
for _, object := range sr.Unused {
for _, object := range res.(unused.Result).Unused {
if object.Kind == "type param" {
continue
}
if object.InGenerated {
continue
}
key := fmt.Sprintf("%s %d %s", object.Position.Filename, object.Position.Line, object.Name)
if used[key] {
continue