Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: enable predeclared linter #299

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ linters:
# - paralleltest
# - perfsprint
# - prealloc
# - predeclared
- predeclared
- promlinter
# - protogetter
- reassign
Expand Down
6 changes: 3 additions & 3 deletions detector/detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestRun(t *testing.T) {
}

func withDetectorName(f *detector.Finding, det string) *detector.Finding {
copy := *f
copy.Detectors = []string{det}
return &copy
c := *f
c.Detectors = []string{det}
return &c
}
6 changes: 3 additions & 3 deletions scalibr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ func TestScan(t *testing.T) {
}

func withDetectorName(f *detector.Finding, det string) *detector.Finding {
copy := *f
copy.Detectors = []string{det}
return &copy
c := *f
c.Detectors = []string{det}
return &c
}

func TestEnableRequiredExtractors(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions testing/fakedetector/fake_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ type fakeDetector struct {
//
// The detector returns the specified Finding or error.
func New(name string, version int, finding *detector.Finding, err error) detector.Detector {
var copy *detector.Finding
var c *detector.Finding
if finding != nil {
copy = &detector.Finding{}
*copy = *finding
c = &detector.Finding{}
*c = *finding
}
return &fakeDetector{
DetName: name,
DetVersion: version,
Finding: copy,
Finding: c,
Err: err,
}
}
Expand Down
Loading