LLM Skills
~/catalogue/debugging et maintenance//go-build

Go : compilation et correction d'erreurs

/go-build

Diagnostique et corrige les erreurs de compilation, dépendances et configuration Go.

affaan-maffaan-m
240.5k
20 mai 2026
MIT License
// contenu du skill

description: Fix Go build errors, go vet warnings, and linter issues incrementally. Invokes the go-build-resolver agent for minimal, surgical fixes.


Go Build and Fix

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

bash
# 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

Example Session

text
User: /go-build

Agent:
# Go Build Resolution

## Initial Diagnostics

$ go build ./...

internal/service/user.go:25:15: undefined: UserRepository

internal/handler/api.go:42:9: cannot use x (type string) as type int

internal/handler/api.go:58:2: missing return at end of function


Errors found: 3

## Fix 1: Undefined Identifier

File: internal/service/user.go:25
Error: undefined: UserRepository
Cause: Missing import

// Added import

import "project/internal/repository"

// Changed

var repo UserRepository

// To

var repo repository.UserRepository

$ go build ./...

2 errors remaining


## Fix 2: Type Mismatch

File: internal/handler/api.go:42
Error: cannot use x (type string) as type int

// Changed

count := params.Get("count")

// To

countStr := params.Get("count")

count, _ := strconv.Atoi(countStr)

$ go build ./...

1 error remaining


## Fix 3: Missing Return

File: internal/handler/api.go:58
Error: missing return at end of function

func GetUser(id string) (*User, error) {

if id == "" {

return nil, ErrInvalidID

}

user := findUser(id)

// Added missing return

return user, nil

}

$ go build ./...

Build successful!


## Final Verification

$ go vet ./...

No issues

$ go test ./...

ok project/internal/service 0.015s

ok project/internal/handler 0.023s


## Summary

| Metric | Count |
|--------|-------|
| Build errors fixed | 3 |
| Vet warnings fixed | 0 |
| Files modified | 2 |
| Remaining issues | 0 |

Build Status: PASS: SUCCESS

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

Fix Strategy

  1. Build errors first - Code must compile
  2. Vet warnings second - Fix suspicious constructs
  3. Lint warnings third - Style and best practices
  4. One fix at a time - Verify each change
  5. Minimal changes - Don't refactor, just fix

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

Related Commands

  • /go-test - Run tests after build succeeds
  • /go-review - Review code quality
  • verification-loop skill - Full verification loop

Related

  • Agent: agents/go-build-resolver.md
  • Skill: skills/golang-patterns/
// source originale publique
affaan-m/ECC
/commands/go-build.md
Licence : MIT License
Projet indépendant, non affilié à Anthropic. Ce skill reste la propriété de son auteur original.
// installer ce skill
Collez cette commande dans votre terminal à la racine de votre projet :
mkdir -p .claude/commands && curl -o ".claude/commands/go-build.md" "https://raw.githubusercontent.com/affaan-m/ECC/main/commands/go-build.md"
Ensuite dans Claude Code, tapez /go-build pour l'activer.
open_in_newVoir la source originale
// sauvegarder
Sauvegarde disponible après connexion.
loginSe connecter pour sauvegarder
// informations
Créateuraffaan-m
Étoiles 240.5k
LicenceMIT License
Mis à jour20 mai 2026
Format.md
AccèsGratuit
// similaires

Skills Debugging et maintenance

Voir toutarrow_forward