Skip to content

ci: add golangci-lint with config and fixes#9

Merged
Neo23x0 merged 5 commits intoNextron-Labs:masterfrom
RuneCode14:ci/add-linting
Mar 17, 2026
Merged

ci: add golangci-lint with config and fixes#9
Neo23x0 merged 5 commits intoNextron-Labs:masterfrom
RuneCode14:ci/add-linting

Conversation

@RuneCode14
Copy link
Copy Markdown

Summary

Adds golangci-lint to the CI pipeline with a sensible configuration and resolves all existing lint warnings.

Linters Enabled

Core linters:

  • errcheck - unchecked error returns
  • govet - Go vet analysis
  • staticcheck - static analysis
  • gosimple - code simplifications
  • unused - find unused code
  • ineffassign - detect ineffectual assignments

Additional quality linters:

  • misspell - spelling mistakes
  • gofumpt - stricter gofmt (deferred, existing code excluded)
  • revive - fast, configurable linter
  • gocritic - extensible linter
  • gocyclo - cyclomatic complexity (threshold: 50)

Production Code Fixes

  1. cmd/aurora/agent/agent.go - Explicitly ignore AddSource() error returns (checked during Initialize)
  2. cmd/aurora-util/main.go - Replace if+TrimSuffix with unconditional strings.TrimSuffix (gosimple S1017)
  3. cmd/aurora-util/main.go - Replace deprecated tar.TypeRegA with tar.TypeReg (staticcheck SA1019)
  4. lib/provider/ebpf/listener.go - Remove unused sync.Mutex field

Configuration Highlights

  • errcheck disabled in test files (common pattern to ignore errors in tests)
  • Close/RemoveAll/SetDeadline errors excluded (best-effort cleanup)
  • Generated eBPF files excluded from checks
  • gofumpt formatting deferred to a separate PR (would touch entire codebase)
  • Gradual adoption: some gocritic/revive style checks excluded

CI Integration

New lint job in package-ci.yml:

  • Runs on ubuntu-24.04
  • Installs BPF dependencies for eBPF compilation
  • Generates eBPF bindings before linting
  • Uses golangci/golangci-lint-action@v6

The lint job runs independently alongside the existing test matrix.

RuneBot14 added 5 commits March 17, 2026 22:44
Enable core linters for code quality:
- errcheck: unchecked error returns
- govet: Go vet analysis
- staticcheck: static analysis
- gosimple: code simplifications
- unused: find unused code
- ineffassign: detect ineffectual assignments
- misspell: spelling mistakes
- gofumpt: stricter gofmt
- revive: fast, configurable linter
- gocritic: extensible linter
- gocyclo: cyclomatic complexity (threshold: 50)

Exclusions:
- errcheck disabled for test files (common pattern)
- Close/RemoveAll/SetDeadline errors excluded (best-effort cleanup)
- Generated eBPF files excluded from unused/govet
- gofumpt deferred to separate PR (existing formatting)
- Various gocritic style checks excluded for gradual adoption
- cmd/aurora/agent/agent.go: Mark AddSource() error returns as intentionally
  ignored (errors are checked during subsequent Initialize() call)

- cmd/aurora-util/main.go:337: Replace if+TrimSuffix with unconditional
  strings.TrimSuffix (gosimple S1017)

- cmd/aurora-util/main.go:613,726: Replace deprecated tar.TypeRegA with
  tar.TypeReg (staticcheck SA1019, deprecated since Go 1.11)

- lib/provider/ebpf/listener.go:32: Remove unused sync.Mutex field
Add dedicated lint job using golangci/golangci-lint-action@v6:
- Runs on ubuntu-24.04 (no matrix needed for linting)
- Installs BPF dependencies (required for eBPF code compilation)
- Generates eBPF bindings before linting
- Uses golangci-lint v1.64 with 5m timeout

Lint job runs independently alongside the test matrix.
The function was defined but never called in production code,
causing the 'unused' linter to fail in CI.
- Remove compiled aurora/aurora-util binaries
- Remove generated eBPF files (vmlinux.h, *_bpfel.go, *_bpfel.o)
- Update .gitignore to prevent future commits of these files
@Neo23x0 Neo23x0 merged commit 90907e7 into Nextron-Labs:master Mar 17, 2026
8 checks passed
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