Skip to content

fix: address golangci-lint warnings #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Jul 9, 2025

This commit addresses a large number of golangci-lint warnings across the codebase.
The fixes span multiple categories of linters.

  • Error Handling: Ensured that all error return values are checked, particularly from io.Copy and flag.Value.Set.
  • Formatting: Corrected formatting issues with gofumpt.
  • Vet and staticcheck:
    • Resolved a potential context leak in the GCS output by ensuring the cancel function is always called.
    • Replaced deprecated io/ioutil with io and os packages.
    • Replaced deprecated zap.OnFatal with zap.WithFatalHook.
    • Fixed an issue in TCP and TLS outputs where the write buffer was being modified, which is unsafe. A new buffer is now used.
    • Simplified various struct field selectors and boolean expressions.
  • Revive Linter:
    • Added comments to all exported functions, types, and methods to improve documentation.
    • Replace unused function parameters with blank identifier (_).
    • Changed function signatures to place context.Context as the first argument.
  • Code Organization:
    • Added package-level comments to all packages.
    • Renamed the internal/output/tls and internal/output/udp packages to match their dir names.
    • Added go-licenser and golangci-lint as go.mod tool dependencies. Removed tools.go.

The only remaining linter warning is for the TODO in the udp output.

@andrewkroh andrewkroh force-pushed the fix/linter-warnings branch 4 times, most recently from 1230f42 to 8523016 Compare July 10, 2025 00:48
@andrewkroh andrewkroh force-pushed the fix/linter-warnings branch from 8523016 to ba94778 Compare July 15, 2025 18:08
@andrewkroh andrewkroh marked this pull request as ready for review July 15, 2025 18:12
@elasticmachine
Copy link

💚 Build Succeeded

History

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