go-template
go-template copied to clipboard
Migrate to golangci-lint v2 and optimize CI/CD
Summary
- Migrates golangci-lint configuration to v2 schema
- Optimizes CI by using golangci-lint-action@v8 (eliminates 93s compilation time)
- Implements tools.go pattern for version consistency between local and CI
- Fixes gosec warnings in health check handlers
Changes
Config Migration:
-
.golangci.yaml: Updated to v2 schema (default: all, nestedlinters.settings) - Disabled noisy linters: funcorder, noinlineerr, wsl_v5, complexity metrics
- Kept tagliatelle enabled (new projects should enforce snake_case JSON tags)
CI Optimization:
-
.github/workflows/checks.yml: Use golangci-lint-action@v8 with pre-built binaries - Extract golangci-lint version from go.mod for local/CI parity
- Remove manual
make install-toolsstep (action handles it)
Tool Management:
-
tools/tools.go: New file with blank imports (single source of truth for tool versions) -
Makefile: Simplified to use go.mod versions (removed @version suffixes) - Removed staticcheck (bundled in golangci-lint), added gci for import formatting
Bug Fixes:
-
httpserver/handler.go: Explicitly handle w.Write() errors to satisfy gosec
Test Plan
- [x]
make install-tools- Tools install correctly from go.mod - [x]
make lint- 0 issues locally - [x]
make test- All tests pass - [x] CI will verify golangci-lint-action works correctly
Learnings Applied
All changes are based on optimizations discovered while migrating protect-rpc from golangci-lint v2.1.2 to v2.5.0, where we:
- Discovered the tools.go pattern for version consistency
- Found golangci-lint-action eliminates 93s build time
- Learned v2 schema enforcement and linter configurations
🤖 Generated with Claude Code