Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ By participating in this project, you agree to abide by our [Code of Conduct](.g
- [Pull Request Guidelines](#pull-request-guidelines)
- [Commit Message Guidelines](#commit-message-guidelines)
- [Testing](#testing)
- [Linting](#linting)
- [Documentation](#documentation)
- [Component-Specific Guidelines](#component-specific-guidelines)
- [Backporting Changes](#backporting-changes)
Expand Down Expand Up @@ -70,6 +71,41 @@ We recommend running tests locally to catch issues before opening a PR.

---

## Linting

We use [golangci-lint](https://golangci-lint.run/) to enforce code quality standards. The linter runs automatically on all pull requests and will block merging if issues are found.

### Running the Linter Locally

```bash
# Run linting (will fail on errors)
make lint

# Run linting with auto-fix for fixable issues
make lint-fix
```

### Configuration

Linting rules are configured in `.golangci.yml` at the repository root. The configuration enables these linters:

- **errcheck** - Check for unchecked errors
- **govet** - Report suspicious constructs
- **staticcheck** - Advanced static analysis
- **gofmt/goimports** - Code formatting
- **misspell** - Spelling errors in comments
- **revive** - Extensible linter with many rules
- **unused** - Find unused code
- And more (see `.golangci.yml` for the full list)

### Best Practices

- Run `make lint` before committing to catch issues early
- Use `make lint-fix` to automatically fix formatting issues
- If a lint rule seems incorrect for your use case, discuss it in the PR rather than disabling it

---

## Documentation

Contributions to documentation are highly valued. If you find any documentation gaps or errors:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: golangci-lint

on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:

permissions:
contents: read
pull-requests: read

jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true

- name: Download dependencies
run: go mod download

- name: Generate code
run: make generate

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Install from source to match Go 1.24
install-mode: goinstall
version: v1.62.2
args: --timeout=5m
# Show only new issues for PRs
only-new-issues: true
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ linters:
enable:
- dupl
- errcheck
- exportloopref
- ginkgolinter
- goconst
- gocyclo
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ HELMIFY ?= helmify
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.5
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.59.1
GOLANGCI_LINT_VERSION ?= v1.62.2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

golangci-lint v1.62.2 release

💡 Result:

golangci-lint v1.62.2 was released on 2024-11-25. Changes: several linter dependency bumps (fatcontext, ginkgolinter, errorlint, iface, revive, testifylint) and a fix to ignore cache error when file not found. [1][2]

Sources:
[1] Golangci-lint changelog (v1.62.2).
[2] NewReleases summary of GitHub release v1.62.2.


🌐 Web query:

golangci-lint Go 1.24 compatibility requirements

💡 Result:

Short answer

  • golangci-lint must be built with a Go toolchain at least as new as the Go language version you want to analyze. In other words, a golangci-lint binary built with Go 1.24 (or newer) is required to fully support projects targeting Go 1.24. [1][2]

What to do

  • Use an official golangci-lint release that was compiled with Go 1.24 (support was added in v1.64.2). [2]
  • Or build golangci-lint yourself with Go 1.24 (go build).
  • If you run a binary built with an older Go (e.g., go1.23), you may get errors like "the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)". [3]

Sources

  • golangci-lint FAQ: supported Go versions (supports <= Go version used to compile it). [1]
  • golangci-lint changelog v1 (v1.64.2 added go1.24 support). [2]
  • Example issue showing the mismatch error and recommendation to use a golangci-lint version >= the one built with Go 1.24. [3]

Bump golangci-lint to v1.64.2 or newer for Go 1.24 support.

v1.62.2 does not support Go 1.24. golangci-lint must be built with a Go version at least as new as the target Go version. v1.64.2 is the first version compiled with Go 1.24 support; using v1.62.2 will fail with "the Go language version used to build golangci-lint is lower than the targeted Go version (1.24.0)".

🤖 Prompt for AI Agents
In @Makefile at line 519, Update the GOLANGCI_LINT_VERSION variable to v1.64.2
(or newer) so the Makefile uses a golangci-lint binary built with Go 1.24
support; specifically change the GOLANGCI_LINT_VERSION definition (symbol
GOLANGCI_LINT_VERSION) from v1.62.2 to v1.64.2 or later and ensure any place
that consumes this variable (e.g., targets that download or install
golangci-lint) will pick up the new version.

HELM_VERSION ?= v3.14.2
YQ_VERSION ?= v4.40.5

Expand Down
Loading