Skip to content

Commit

Permalink
ci: fix linting issues (#459)
Browse files Browse the repository at this point in the history
A new version of golangci-lint updated depguard, which in turn started
returning errors because it was missing a config. Previously depguard
did not do anything as we never configured a list of allowed/denied
imports.

In general, we already have gomodguard for linting imports.

To avoid sudden breakages of our CI in the future, I pinned the exact
version of golangci-lint to the current release. Upgrading this should
happen through a PR process (e.g. by renovate) so we can notice new
linting failures and fix them before merging to main.
  • Loading branch information
apricote authored Jun 16, 2023
1 parent cc38a33 commit 99c9a5d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
# Required: the version of golangci-lint is required and must be specified without patch version
version: v1.53.3
# In general linting is quite fast with warm caches, but a fresh run might take some time.
args: --timeout 5m

Expand Down
10 changes: 5 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ variables:

test:lint:
stage: test
image: golangci/golangci-lint:v1.52.2
image: golangci/golangci-lint:v1.53.3
allow_failure: true
script:
- golangci-lint run -v
except:
- tags
- main
tags:
- hc-bladerunner
- cloud-integrations

test:unit:
stage: test
Expand All @@ -37,7 +37,7 @@ test:unit:
script:
- go test $(go list ./... | grep -v e2e) -v
tags:
- hc-bladerunner
- cloud-integrations

.build:goreleaser: &build-goreleaser
stage: build
Expand All @@ -53,7 +53,7 @@ test:unit:
- hcloud-cloud-controller-manager
expire_in: 1 day
tags:
- hc-bladerunner
- cloud-integrations

build:goreleaser:snapshot:
<<: *build-goreleaser
Expand Down Expand Up @@ -94,7 +94,7 @@ e2e:
script:
- go test $(go list ./... | grep e2e) -v -timeout 60m
tags:
- hc-bladerunner-build
- cloud-integrations

release:image:
stage: release:image
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:
disable-all: true
enable:
- bodyclose
- depguard
- errcheck
- errname
- exhaustive
Expand Down

0 comments on commit 99c9a5d

Please sign in to comment.