Skip to content

ci(lint): adopt golangci-lint v2.14.0 tooling and strict lint config - #34

Merged
appleboy merged 1 commit into
masterfrom
ci/golangci-lint-tooling
Oct 3, 2026
Merged

appleboy merged 1 commit into
masterfrom
ci/golangci-lint-tooling

Conversation

@appleboy

@appleboy appleboy commented Oct 3, 2026

Copy link
Copy Markdown
Member

Summary

Adopt project-managed golangci-lint tooling (same approach as go-signet/signet) across build, lint config, and CI:

flowchart LR
    A[go.tools.mod<br/>pin golangci-lint v2.14.0] --> B[Makefile<br/>make lint / make fmt]
    B --> C[.golangci.yml<br/>strict v2 config]
    C --> D[GitHub Actions<br/>make install-tools lint]
    D --> E[Code fixes<br/>0 lint issues]
Loading

Additions

  • .golangci.yml — strict golangci-lint v2 configuration (bidichk, gocritic, modernize, revive, testifylint, perfsprint, staticcheck, etc.) with module-specific gci import ordering
  • Makefile — lint, fmt, test, coverage, mod-download/tidy/verify, install-tools, help targets
  • go.tools.mod / go.tools.sum — pin golangci-lint v2.14.0 via Go tool directive, executed with go tool -modfile=go.tools.mod

CI changes

  • Replace golangci/golangci-lint-action with make install-tools lint so local and CI use the exact same pinned version

Code fixes (all lint issues resolved: 0 issues)

  • Automated: modernize (interface{} → any, range over int, maps.Copy), usestdlibvars (http.MethodGet), perfsprint, testifylint (assert → require), usetesting (os.MkdirTemp → t.TempDir)
  • Manual: dead code removal, unused imports, builtin shadowing fixes
  • Public API names kept unchanged (e.g. exported funcs/fields) via //nolint directives with explanations for backward compatibility

AI Authorship Disclosure

🤖 This change was prepared with AI assistance. Generated with Claude Code.

Change Classification

  • Type: ci (tooling/CI) + style/refactor (lint fixes)
  • Scope: build/lint tooling, CI workflow, lint-driven code cleanup
  • Impact: No public API changes; no behavior changes

Checklist

  • make lint passes with 0 issues
  • Tests pass locally for affected repos
  • Public API names preserved for backward compatibility
  • CI workflow updated to use make lint

- Add .golangci.yml based on the signet strict configuration with module-specific gci prefix
- Add Makefile with lint, fmt, test, coverage and mod targets
- Pin golangci-lint v2.14.0 via go.tools.mod with tool directive
- Replace golangci-lint-action with make install-tools lint in CI workflow
- Apply automated lint fixes: modernize, usestdlibvars, perfsprint, testifylint
- Keep public API names unchanged via nolint directives for backward compatibility
- Replace os.MkdirTemp with t.TempDir in tests
- Clean up dead code and unused imports flagged by staticcheck and govet

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Code <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 3, 2026 01:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Fatal assertions are now invoked through a helper running in spawned goroutines, contrary to testify’s execution requirements.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adopts project-managed golangci-lint v2.14.0 tooling and applies its formatting and test conventions.

Changes:

  • Pins lint tooling and adds Makefile targets.
  • Introduces stricter lint/format configuration and updates CI.
  • Applies lint-driven source and test cleanup.
File Description
.golangci.yml Defines strict lint and formatting rules.
.github/​workflows/​go.yml Runs the project-managed linter.
Makefile Adds lint, format, test, and module targets.
go.tools.mod Declares pinned Go tooling dependencies.
go.tools.sum Locks tooling dependency checksums.
options.go Cleans parameter naming and grouping.
graceful.go Applies formatting and lint annotations.
graceful_test.go Modernizes synchronization and assertions.
_examples/​hooks/​main.go Applies configured formatting.
_examples/​notify/​main.go Applies configured formatting.
_examples/​timeout/​main.go Applies configured formatting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread graceful_test.go
Comment on lines +474 to +476
require.NoError(t, err)
resp, err := client.Do(req)
assert.NoError(t, err)
require.NoError(t, err)
Comment thread .github/workflows/go.yml
with:
version: v2.12
- name: Run lint
run: make install-tools lint
@appleboy
appleboy merged commit c374535 into master Oct 3, 2026
9 checks passed
@appleboy
appleboy deleted the ci/golangci-lint-tooling branch October 3, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants