Skip to content

Commit

Permalink
chore: update golangci-lint
Browse files Browse the repository at this point in the history
Update everything to 1.63.4 (because go versions must match).

exportloopref is not needed; that go-tcha has been fixed in go.

Fix a few error message lint issues.
  • Loading branch information
justinsb committed Jan 15, 2025
1 parent 4f4d051 commit 4aaec9a
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.59.1 # should match the version in Makefile
version: v1.63.4 # should match the version in Makefile
args: --timeout=10m
4 changes: 2 additions & 2 deletions .github/workflows/presubmit-compositions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
go-version-file: 'go.mod'
cache: false # because of https://github.com/golangci/golangci-lint-action/issues/135
- name: golangci-lint
uses: golangci/golangci-lint-action@v6 # v3.7.1
uses: golangci/golangci-lint-action@v6.1.0
with:
working-directory: ./experiments/compositions/composition
version: v1.59.1 # should match the version in Makefile
version: v1.63.4 # should match the version in Makefile
args: --timeout=10m
verify-goimports:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ linters:
- depguard
- errcheck
- errorlint
# - exportloopref
# - forcetypeassert
# - gci
# - gocritic
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ UNMANAGED_DETECTOR_IMG ?= gcr.io/${PROJECT_ID}/cnrm/unmanageddetector:${SHORT_SH
GOLANGCI_LINT_CACHE := /tmp/golangci-lint
# When updating this, make sure to update the corresponding action in
# ./github/workflows/lint.yaml
GOLANGCI_LINT_VERSION := v1.59.1
GOLANGCI_LINT_VERSION := v1.63.4

# Use Docker BuildKit when building images to allow usage of 'setcap' in
# multi-stage builds (https://github.com/moby/moby/issues/38132)
Expand Down Expand Up @@ -118,6 +118,7 @@ fmt:

.PHONY: lint
lint:
mkdir -p ${GOLANGCI_LINT_CACHE}
docker run --rm -v $(shell pwd):/app \
-v ${GOLANGCI_LINT_CACHE}:/root/.cache/golangci-lint \
-w /app golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine \
Expand Down
1 change: 0 additions & 1 deletion experiments/compositions/composition/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ linters:
enable:
- dupl
- errcheck
- exportloopref
- goconst
- gocyclo
- gofmt
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/composition/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" $(GOPREFIX) go test ./... -coverprofile cover.out

GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.54.2
GOLANGCI_LINT_VERSION ?= v1.63.4
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
set -e ;\
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/composition/cmd/inline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (s *InlineSyncer) CopyToFileSystem() error {
}

if template == "" {
return fmt.Errorf("template not found for expander: " + s.expanderName)
return fmt.Errorf("template not found for expander: %s", s.expanderName)
}

// Get crdp.spec.stages[name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (r *CompositionReconciler) validateExpanderConfig(ctx context.Context, logg
if result.Status != pb.Status_SUCCESS {
logger.Error(nil, "expander.Validate() Status is not Success", "expander",
expander.Name, "status", result.Status, "message", result.Error.Message)
err = fmt.Errorf(result.Error.Message)
err = fmt.Errorf("%s", result.Error.Message)
return "ValidateStatusFailed", err
}
return "", nil
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/expanders/cel-expander/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
## Tool Versions
KUSTOMIZE_VERSION ?= v5.3.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0
GOLANGCI_LINT_VERSION ?= v1.54.2
GOLANGCI_LINT_VERSION ?= v1.63.4

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/expanders/helm-expander/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
## Tool Versions
KUSTOMIZE_VERSION ?= v5.3.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0
GOLANGCI_LINT_VERSION ?= v1.54.2
GOLANGCI_LINT_VERSION ?= v1.63.4

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/facade/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out

GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.54.2
GOLANGCI_LINT_VERSION ?= v1.63.4
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
set -e ;\
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/direct/common/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var BasicDiff = func(fieldName protoreflect.Name, a, b proto.Message) (bool, err
return true, nil
}
if !aField.Kind().IsValid() {
return false, fmt.Errorf("unimplemented kind: " + aField.Kind().String())
return false, fmt.Errorf("unimplemented kind: %s", aField.Kind().String())
}

diff := false
Expand Down

0 comments on commit 4aaec9a

Please sign in to comment.