Skip to content

Fix golangci-lint warnings, update GitHub Actions#71

Closed
umputun wants to merge 1 commit intomasterfrom
fix/lint-issues
Closed

Fix golangci-lint warnings, update GitHub Actions#71
umputun wants to merge 1 commit intomasterfrom
fix/lint-issues

Conversation

@umputun
Copy link
Copy Markdown
Collaborator

@umputun umputun commented Mar 14, 2026

  • add http.MaxBytesReader (64MB cap) to form handlers (gosec G120)
  • replace sort with slices.Sort/SortFunc (revive)
  • use min() builtin instead of if/else (modernize)
  • extract setupLog helper with secret masking
  • add modernize linter to golangci config
  • bump docker/setup-qemu-action and setup-buildx-action to v4

- add http.MaxBytesReader (64MB cap) to form handlers (gosec G120)
- replace sort with slices.Sort/SortFunc (revive)
- use min() builtin instead of if/else (modernize)
- extract setupLog helper with secret masking
- add modernize linter to golangci config
- bump docker/setup-qemu-action and setup-buildx-action to v4
Copilot AI review requested due to automatic review settings March 14, 2026 23:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses static-analysis/lint warnings and modernizes parts of the Go codebase and CI configuration, primarily around request body limits, newer stdlib helpers, and GitHub Actions updates.

Changes:

  • Add http.MaxBytesReader to form handlers to cap request body size.
  • Modernize Go code by switching to slices.Sort/SortFunc and the min() builtin.
  • Update lint configuration (enable modernize) and bump Docker build actions in CI.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
backend/rest/server.go Adds request body size limiting to form-parsing handlers and minor error-handling refactor.
backend/main.go Refactors logger initialization into a helper intended to include secret masking.
backend/extractor/text.go Uses min() builtin for snippet sizing logic.
backend/extractor/pics.go Replaces sort usage with slices/cmp helpers.
backend/.golangci.yml Enables the modernize linter and normalizes formatter exclusions.
.github/workflows/ci.yml Bumps Docker QEMU/Buildx setup actions to v4.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +69 to +74
log.Secret(secrets...)
if dbg {
log.Setup(log.Debug, log.CallerFile, log.Msec, log.LevelBraces)
return
}
log.Setup(log.Msec, log.LevelBraces)
@umputun
Copy link
Copy Markdown
Collaborator Author

umputun commented Mar 15, 2026

Superseded by recent refactoring — project structure flattened, CI migrated to native ARM64 runners, tests reworked, and all lint fixes applied directly to master.

@umputun umputun closed this Mar 15, 2026
@umputun umputun deleted the fix/lint-issues branch March 15, 2026 06:38
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