# Go Vet

> Fix go vet warnings Use when this capability is needed.

- Skill: `tomevault-io/go-vet` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/go-vet`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/go-vet/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/go-vet

---


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

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/jamesprial) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

