Skip to content

Commit

Permalink
Fix "cannot range over" local lint errors (#126)
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Pryc <[email protected]>
  • Loading branch information
mpryc authored Dec 5, 2024
1 parent f114599 commit ca7e290
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Go linters
uses: golangci/golangci-lint-action@v6
with:
version: v1.56.2
version: v1.62.2

- name: Go dependencies
run: make check-go-dependencies
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Documentation reference https://github.com/golangci/golangci-lint/blob/v1.56.2/.golangci.reference.yml
# Documentation reference https://github.com/golangci/golangci-lint/blob/v1.62.2/.golangci.reference.yml
run:
skip-dirs-use-default: false
modules-download-mode: readonly
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
KUSTOMIZE_VERSION ?= v5.3.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0
ENVTEST_VERSION ?= v0.0.0-20240320141353-395cfc7486e6
GOLANGCI_LINT_VERSION ?= v1.56.2
GOLANGCI_LINT_VERSION ?= v1.62.2

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down
2 changes: 1 addition & 1 deletion internal/common/function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func ValidateBackupSpec(nonAdminBackup *nacv1alpha1.NonAdminBackup, enforcedBack
}

enforcedSpec := reflect.ValueOf(enforcedBackupSpec).Elem()
for index := 0; index < enforcedSpec.NumField(); index++ {
for index := range enforcedSpec.NumField() {
enforcedField := enforcedSpec.Field(index)
enforcedFieldName := enforcedSpec.Type().Field(index).Name
currentField := reflect.ValueOf(nonAdminBackup.Spec.BackupSpec).Elem().FieldByName(enforcedFieldName)
Expand Down
2 changes: 1 addition & 1 deletion internal/common/function/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func TestValidateBackupSpecEnforcedFields(t *testing.T) {
}
backupSpec := reflect.ValueOf(&velerov1.BackupSpec{}).Elem()

for index := 0; index < backupSpec.NumField(); index++ {
for index := range backupSpec.NumField() {
if !slices.Contains(backupSpecFields, backupSpec.Type().Field(index).Name) {
t.Errorf("backup spec field '%v' is not tested", backupSpec.Type().Field(index).Name)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/nonadminbackup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ func (r *NonAdminBackupReconciler) createVeleroBackupAndSyncWithNonAdminBackup(c
backupSpec.IncludedNamespaces = []string{nab.Namespace}

enforcedSpec := reflect.ValueOf(r.EnforcedBackupSpec).Elem()
for index := 0; index < enforcedSpec.NumField(); index++ {
for index := range enforcedSpec.NumField() {
enforcedField := enforcedSpec.Field(index)
enforcedFieldName := enforcedSpec.Type().Field(index).Name
currentField := reflect.ValueOf(backupSpec).Elem().FieldByName(enforcedFieldName)
Expand Down

0 comments on commit ca7e290

Please sign in to comment.