Skip to content

Commit d5549a2

Browse files
committed
chore: update code
1 parent de0b39a commit d5549a2

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
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

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)