Skip to content

chore: migrate to golangci-lint/v2 #1431

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

Merged
merged 3 commits into from
May 2, 2025
Merged

Conversation

hilmarf
Copy link
Member

@hilmarf hilmarf commented Apr 29, 2025

What this PR does / why we need it

I was checking originally on the linter issues in https://github.com/open-component-model/ocm-k8s-toolkit and realizing, that there is a newer version of golangci-lint available.

This PR upgrades to golangci-lint v2.1.5.

I've followed the https://golangci-lint.run/product/migration-guide/ and then added some more exclusions:

- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'QF1008: could remove embedded field'
- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'ST1006: receiver name should'
- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'ST1001: should not use dot imports'
- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'ST1005: error strings should not'
- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'QF1001: could apply De Morgan'
- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'QF1012: Use fmt.Fprintf'
- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'QF1003: could use tagged switch'
- linters:
- staticcheck
path: cmds/.*|api/.*
text: 'QF1009: probably want to use time.Time.Equal'

until no more errors occurred.

Not sure if someone wants to fix some of those staticcheck.

@hilmarf hilmarf requested a review from a team as a code owner April 29, 2025 12:16
@hilmarf hilmarf enabled auto-merge (squash) April 29, 2025 12:16
@github-actions github-actions bot added component/github-actions Changes on GitHub Actions or within `.github/` directory kind/dependency dependency update, etc. labels Apr 29, 2025
@hilmarf hilmarf changed the title Golangci lint/v2 chore: migrate to golangci-lint/v2 Apr 29, 2025
@github-actions github-actions bot added kind/chore chore, maintenance, etc. size/l Large labels Apr 29, 2025
@hilmarf hilmarf changed the base branch from main to chore/golangci-lint May 2, 2025 07:42
@hilmarf hilmarf merged commit 91cd065 into chore/golangci-lint May 2, 2025
26 checks passed
@hilmarf hilmarf deleted the golangci-lint/v2 branch May 2, 2025 07:42
@ocmbot ocmbot bot added this to the 2025-Q2 milestone May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/github-actions Changes on GitHub Actions or within `.github/` directory kind/chore chore, maintenance, etc. kind/dependency dependency update, etc. size/l Large
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants