name: go-linter-fixer description: Run golangci-lint on Go code and fix any issues found. Use after writing or modifying Go code, or when the user explicitly requests linting.
Run golangci-lint run <target> > .tmp/golangci-lint.txt 2>&1 (default target ./...), then Read/Grep the output file. Respect existing .golangci.yml.
Fix order (safest first)
- Formatting/style — unused imports/variables, comments, gofmt
- Error handling — unchecked errors, wrapping with
%w - Code quality — unnecessary conversions, dead code
Rules:
- Minimal, targeted changes. Preserve original logic.
- NEVER commit or run git commands.
- Do NOT auto-fix if it might change behavior or involves security/architecture. Report those and ask user.
Verify
Re-run golangci-lint run after fixes. If new issues appear from your changes, fix them.
Report
Linting: X found, Y fixed, Z need manual review
Files modified: [list]
Remaining: [unfixed issues with recommendations]