Skip to content

Conversation

@jmgilman
Copy link
Collaborator

@jmgilman jmgilman commented Jan 1, 2026

Summary

  • Add comprehensive golangci-lint v2 configuration with best practices and security scanning
  • Fix 100+ linter issues across the codebase
  • Add justfile with development recipes for linting, formatting, and testing
  • Add GitHub Actions workflow to run checks on PRs and master pushes

Changes

New Files

  • .golangci.yml - golangci-lint v2 configuration with 34 linters enabled
  • justfile - Development recipes (just check, just lint, just fmt, just test)
  • .github/workflows/cli.yml - CI workflow for Go code quality checks

Linter Fixes

Category Issues Fixed
errcheck ~30 unchecked error returns
goimports 8 import formatting issues
gosec 11 security issues (permissions, file inclusion, command injection)
gocritic 10 issues (hugeParam, octalLiteral, rangeValCopy, importShadow)
govet shadow 6 variable shadowing issues
revive 8 issues (unexported-return, exported comments)
testifylint 12 assertion improvements
intrange 8 for loops updated to Go 1.22+ style
perfsprint 6 string formatting optimizations
misspell 2 spelling fixes
noctx 1 context propagation fix
goconst 3 repeated strings made constants

Security Linters Enabled

  • gosec - Go security checker
  • bodyclose - HTTP response body leak detection
  • noctx - HTTP request context enforcement

Test plan

  • golangci-lint run passes with 0 issues
  • go test ./... passes
  • CI workflow passes on this PR

🤖 Generated with Claude Code

jmgilman and others added 2 commits December 31, 2025 17:01
Add comprehensive linting setup with best practices and security scanning:

- Add .golangci.yml with golangci-lint v2 configuration
  - Enable 34 linters including gosec for security scanning
  - Configure appropriate thresholds for complexity checks
  - Set up import grouping with local package separation
  - Add exclusions for test files and generated mocks

- Fix 100+ linter issues across the codebase
  - Address errcheck violations for unchecked errors
  - Fix govet shadow warnings for variable shadowing
  - Update interfaces to use pointer types for large structs
  - Correct import grouping (stdlib → third-party → local)
  - Tighten file/directory permissions (0755→0750, 0644→0600)
  - Add nolint comments with explanations for intentional exceptions
  - Replace fmt.Errorf with errors.New where no formatting needed
  - Update to Go 1.22+ integer range loops

- Add justfile with development recipes
  - lint: run golangci-lint
  - fmt: format code with gofmt and goimports
  - test: run all tests
  - check: run all three in sequence

- Add GitHub Actions workflow (.github/workflows/cli.yml)
  - Triggers on Go file changes in PRs and master pushes
  - Runs format checking, linting, and tests with race detection
  - Uploads coverage report as artifact

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move exclusion rules from issues.exclude-rules to linters.exclusions.rules
- Remove deprecated sloglint.context-only option
- Change goimports.local-prefixes from string to array
- Add built-in exclusion presets (comments, std-error-handling)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jmgilman jmgilman merged commit b325cc8 into master Jan 1, 2026
1 check passed
@jmgilman jmgilman deleted the feat/golangci-lint-v2 branch January 1, 2026 01:23
jmgilman added a commit that referenced this pull request Jan 3, 2026
Current behavior:
N/A - new feature

New behavior:
Adds comprehensive linting setup with 34 enabled linters including security scanning, format checking, and automated CI workflow that runs on Go file changes with coverage reporting

Closes: #10
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