Skip to content

Commit 7beb2fb

Browse files
authored
staticcheck: bump to v0.4.0 (#3551)
1 parent 06e3515 commit 7beb2fb

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

.golangci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ issues:
135135
text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead."
136136
- path: pkg/lint/lintersdb/manager.go
137137
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."
138+
- path: pkg/golinters/unused.go
139+
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
138140

139141
run:
140142
timeout: 5m

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ require (
112112
gitlab.com/bosi/decorder v0.2.3
113113
golang.org/x/tools v0.5.0
114114
gopkg.in/yaml.v3 v3.0.1
115-
honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720
115+
honnef.co/go/tools v0.4.0
116116
mvdan.cc/gofumpt v0.4.0
117117
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
118118
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d

go.sum

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/unused.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,19 @@ func runUnused(pass *analysis.Pass) ([]goanalysis.Issue, error) {
6363
return nil, err
6464
}
6565

66-
sr := unused.Serialize(pass, res.(unused.Result), pass.Fset)
67-
6866
used := make(map[string]bool)
69-
for _, obj := range sr.Used {
67+
for _, obj := range res.(unused.Result).Used {
7068
used[fmt.Sprintf("%s %d %s", obj.Position.Filename, obj.Position.Line, obj.Name)] = true
7169
}
7270

7371
var issues []goanalysis.Issue
7472

7573
// Inspired by https://github.com/dominikh/go-tools/blob/d694aadcb1f50c2d8ac0a1dd06217ebb9f654764/lintcmd/lint.go#L177-L197
76-
for _, object := range sr.Unused {
74+
for _, object := range res.(unused.Result).Unused {
7775
if object.Kind == "type param" {
7876
continue
7977
}
8078

81-
if object.InGenerated {
82-
continue
83-
}
84-
8579
key := fmt.Sprintf("%s %d %s", object.Position.Filename, object.Position.Line, object.Name)
8680
if used[key] {
8781
continue

0 commit comments

Comments
 (0)