Skip to content

Commit

Permalink
refactor: enable ineffassign and wastedassign linters (#289)
Browse files Browse the repository at this point in the history
This enables linters for ensuring that the result of assignments are actually used - I'm not actually sure of the difference between the two, but they both seem to be enabled by default and very quick, so I don't think it's a huge issue to have both

Relates to #274

Closes #289

COPYBARA_INTEGRATE_REVIEW=#289 from ackama:linting/enable-wastedassign d7d9b73
PiperOrigin-RevId: 702772118
  • Loading branch information
G-Rath authored and copybara-github committed Dec 4, 2024
1 parent f59a492 commit d3ab609
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ linters:
- grouper
- importas
# - inamedparam
# - ineffassign
- ineffassign
- interfacebloat
# - intrange
- loggercheck
Expand Down Expand Up @@ -86,7 +86,7 @@ linters:
# - unparam
# - unused
# - usestdlibvars
# - wastedassign
- wastedassign
- whitespace
- zerologlint
disable-all: true
2 changes: 1 addition & 1 deletion binary/proto/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func typeForPath(filePath string) (*fileType, error) {
}
}

isBinProto := false
var isBinProto bool
switch ext {
case ".binproto":
isBinProto = true
Expand Down
4 changes: 2 additions & 2 deletions extractor/filesystem/os/rpm/rpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ func TestFileRequired(t *testing.T) {
wantResultMetric = stats.FileRequiredResultOK
}
gotResultMetric := collector.FileRequiredResult(tt.path)
if tt.wantResultMetric != "" && gotResultMetric != tt.wantResultMetric {
t.Errorf("FileRequired(%s) recorded result metric %v, want result metric %v", tt.path, gotResultMetric, tt.wantResultMetric)
if wantResultMetric != "" && gotResultMetric != wantResultMetric {
t.Errorf("FileRequired(%s) recorded result metric %v, want result metric %v", tt.path, gotResultMetric, wantResultMetric)
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ func (e *Extractor) Extract(ctx context.Context, input *standalone.ScanInput) ([
// and reset it in the extractor.
cli, err := containerd.New(e.socketAddr)
if err != nil {
cli = nil
log.Errorf("Failed to connect to containerd socket %v, error: %v", e.socketAddr, err)
return inventory, err
}
Expand Down

0 comments on commit d3ab609

Please sign in to comment.