Agent skill

go-vet

Fix go vet warnings

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/go-vet

SKILL.md

go vet

Built-in static analyzer that catches common mistakes.

Usage

bash
go vet ./...
go vet ./pkg/...

Common Warnings

Printf Format Mismatch

go
// Bad
fmt.Printf("%d", "string")

// Good
fmt.Printf("%s", "string")

Unreachable Code

go
// Bad
return value
fmt.Println("never runs")

// Good
fmt.Println("runs")
return value

Composite Literal Uses Unkeyed Fields

go
// Bad
Person{"Alice", 30}

// Good
Person{Name: "Alice", Age: 30}

Nil Dereference

go
// Bad
var p *int
fmt.Println(*p)

// Good
if p != nil {
    fmt.Println(*p)
}

Suspicious Mutex Usage

go
// Bad - mutex copied
func process(mu sync.Mutex) {
    mu.Lock()
}

// Good - pass pointer
func process(mu *sync.Mutex) {
    mu.Lock()
}

Lost Context

go
// Bad
ctx := context.TODO()

// Good
ctx := context.Background()
// or accept ctx as parameter

Fix All Issues

bash
go vet ./... 2>&1 | tee vet.log

Didn't find tool you were looking for?

Be as detailed as possible for better results