CI: enforce gofmt and add golangci-lint checks#9
Merged
Conversation
Agent-Logs-Url: https://github.com/disk0Dancer/climate/sessions/99518009-d1ed-4cb8-a58b-863ca6a8cb07 Co-authored-by: disk0Dancer <89835485+disk0Dancer@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
disk0Dancer
April 22, 2026 14:52
View session
There was a problem hiding this comment.
Pull request overview
This PR strengthens the repository’s CI workflow by adding formatting and static-analysis gates so style/lint issues fail CI before tests/build, aligning PR validation with a stricter Go quality bar.
Changes:
- Add a
gofmt -l .formatting check step that fails when any files are not formatted. - Add a
golangci-lintCI step viagolangci/golangci-lint-action@v6(runningv1.59). - Run these new checks before the existing test/vet/build steps in CI.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
|
@copilot if in ci fails formatting check, format code, commit and push, ther restart workflow on latest commit |
Keep the primary CI workflow check-only and move formatter/linter remediation
into a separate workflow_run auto-fix lane. This preserves deterministic
verification while still allowing same-repo branches to receive gofmt and
golangci-lint --fix updates automatically.
The auto-fix workflow re-dispatches CI after pushing because GITHUB_TOKEN
pushes do not retrigger push-based workflows. The publish templates and docs
now emit and describe the same workflow pair for generated repositories.
Constraint: GITHUB_TOKEN pushes do not trigger push workflows
Constraint: Main CI must remain deterministic and reviewable
Rejected: Mutate the main CI job in place | mixes verification with write-side effects
Rejected: Auto-fix all failures | only formatter and lint fixes are safe to automate
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep CI check-only; add new auto-remediation only in follow-up workflows
Tested: golangci-lint run
Tested: go test -race -coverprofile=coverage.out ./...
Tested: go vet ./...
Tested: go build ./...
Tested: YAML parse for .github/workflows/{ci,ci-autofix,release}.yml
Not-tested: Live GitHub Actions execution of workflow_run auto-fix and workflow_dispatch redispatch
The workflow and publish templates were pinned to golangci-lint-action@v6
while requesting golangci-lint v2.11.3, which now fails immediately.
Bump the action pins to v7 so the existing v2 linter version remains valid
for both repository workflows and generated repositories.
Constraint: golangci-lint-action v6 no longer accepts golangci-lint v2
Constraint: Generated repositories must emit the same compatible workflow pins as this repo
Rejected: Downgrade golangci-lint back to v1 | moves away from the current lint configuration
Rejected: Jump straight to a newer action major | unnecessary for the immediate compatibility fix
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep the action major aligned with the golangci-lint major in both repo workflows and publish templates
Tested: golangci-lint run
Tested: go test -race -coverprofile=coverage.out ./...
Tested: go vet ./...
Tested: go build ./...
Tested: YAML parse for .github/workflows/{ci,ci-autofix,release}.yml
Not-tested: Live GitHub Actions execution after the push
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds formatting and lint gates to CI so PRs fail early on style and static-analysis violations, not just tests/build. The goal is to make fmt+lint part of the default quality bar in the main workflow.
CI quality gates
Check formattingstep that fails whengofmt -l .returns any files.Run golangci-lintstep usinggolangci/golangci-lint-action@v6(v1.59).Workflow behavior
.github/workflows/ci.yml, so formatting/lint issues are surfaced immediately in PR validation.