Go Static Check and Fix Errors Prompt

Last updated on Feb 27, 2026

This prompt instructs an AI agent to run staticcheck on your entire Go codebase, identify code quality and correctness issues, fix them automatically, and verify that all problems are resolved. Staticcheck catches a broader class of bugs than go vet — including deprecated API usage, unnecessary type conversions, inefficient string operations, and subtle correctness issues that compile fine but behave incorrectly at runtime.

Use it in CI pipelines, as a pre-commit check, or for ad-hoc cleanup sessions when you want a thorough sweep beyond what go vet covers. The agent runs the analysis, applies fixes, then re-runs staticcheck to confirm a clean pass — so you get a fully verified codebase in one shot.

Prompt

Analyze the Go codebase using `staticcheck` to find potential issues.

## Instructions:

1. Run `staticcheck ./...` to check the entire codebase
2. Analyze any reported issues
3. Fix all identified problems
4. If fixes were made, run `staticcheck ./...` again to verify they were resolved
5. If no issues were found initially or all issues were fixed, confirm that the code passes all checks

## Expected output:
- List of identified issues (if any)
- Description of fixes implemented
- Confirmation that all issues are resolved

Subscribe for the latest prompts

Get the latest prompts delivered to your inbox