Skip to content

Commit 6a85b30

Browse files
authored
Merge pull request #791 from andypitcher/update-golangci-lint-version
Bump golangci-lint to v2
2 parents 0863edb + d1da33d commit 6a85b30

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

.golangci.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

.golangci.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: "2"
2+
linters:
3+
default: none
4+
enable:
5+
- asasalint
6+
- asciicheck
7+
- bidichk
8+
- gosec
9+
- govet
10+
- ineffassign
11+
- misspell
12+
exclusions:
13+
rules:
14+
- path: 'main.go'
15+
text: 'G114: Use of net/http serve function that has no support for setting timeouts'
16+
formatters:
17+
enable:
18+
- gofmt
19+
- goimports

hack/make/deps.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# renovate: datasource=github-release-attachments depName=golangci/golangci-lint
2-
GOLANGCI_VERSION = v1.64.8
2+
GOLANGCI_VERSION = v2.0.2
33
# renovate: datasource=github-release-attachments depName=k3d-io/k3d
44
K3D_VERSION = v5.8.3
55

pkg/condition/condition.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ func getValue(obj interface{}, name ...string) reflect.Value {
243243
}
244244

245245
func getFieldValue(v reflect.Value, name ...string) reflect.Value {
246+
if len(name) == 0 {
247+
return reflect.Value{}
248+
}
246249
field := v.FieldByName(name[0])
247250
if len(name) == 1 {
248251
return field

pkg/crds/crd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func WriteCRD() error {
3737
}
3838

3939
filename := fmt.Sprintf("./crds/%s.yaml", strings.ToLower(crd.Spec.Names.Kind))
40-
err = os.WriteFile(filename, yamlBytes, 0o644)
40+
err = os.WriteFile(filename, yamlBytes, 0o600)
4141
if err != nil {
4242
return err
4343
}

pkg/securityscan/jobHandler.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,14 @@ func (c *Controller) handleJobs(ctx context.Context) error {
6969
c.setClusterScanStatusDisplay(scan)
7070

7171
if scan.Spec.ScheduledScanConfig != nil && scan.Spec.ScheduledScanConfig.CronSchedule != "" {
72-
c.rescheduleScan(scan)
73-
c.purgeOldClusterScanReports(scan)
72+
err := c.rescheduleScan(scan)
73+
if err != nil {
74+
return obj, fmt.Errorf("error rescheduling scan: %w", err)
75+
}
76+
err = c.purgeOldClusterScanReports(scan)
77+
if err != nil {
78+
return obj, fmt.Errorf("error purging old ClusterScanReports: %w", err)
79+
}
7480
}
7581
err := c.deleteJob(jobs, obj, metav1.DeletePropagationBackground)
7682
if err != nil {

0 commit comments

Comments
 (0)