Skip to main content

/go-build Command

This command invokes the go-build-resolver agent to incrementally fix Go build errors with minimal changes.

What This Command Does

  1. Run Diagnostics: Execute go build, go vet, staticcheck
  2. Parse Errors: Group by file and sort by severity
  3. Fix Incrementally: One error at a time
  4. Verify Each Fix: Re-run build after each change
  5. Report Summary: Show what was fixed and what remains

When to Use

Use /go-build when:
  • go build ./... fails with errors
  • go vet ./... reports issues
  • golangci-lint run shows warnings
  • Module dependencies are broken
  • After pulling changes that break the build

Diagnostic Commands Run

# Primary build check
go build ./...

# Static analysis
go vet ./...

# Extended linting (if available)
staticcheck ./...
golangci-lint run

# Module issues
go mod verify
go mod tidy -v

Command Syntax

/go-build
No arguments required - automatically detects and fixes Go build errors.

Common Errors Fixed

ErrorTypical Fix
undefined: XAdd import or fix typo
cannot use X as YType conversion or fix assignment
missing returnAdd return statement
X does not implement YAdd missing method
import cycleRestructure packages
declared but not usedRemove or use variable
cannot find packagego get or go mod tidy

Stop Conditions

The agent will stop and report if:
  • Same error persists after 3 attempts
  • Fix introduces more errors
  • Requires architectural changes
  • Missing external dependencies
  • Agent: agents/go-build-resolver.md
  • Skill: skills/golang-patterns/
  • Commands: /go-test, /go-review, /verify