Go Tooling & Security
Agent Workflow (MANDATORY)
Before ANY tooling/security change, spawn 3 agents in parallel, one Agent call each with a name:
- fuse-ai-pilot:explore-codebase - Find existing go.mod/go.work,
.golangci.yml, CI files
- fuse-ai-pilot:research-expert - Verify latest golangci-lint v2 + govulncheck docs via Context7/Exa
- mcp__context7__query-docs - Check current Go 1.26
go fix modernizer set
After changes, run fuse-ai-pilot:sniper for validation.
Overview
| Area |
Description |
| Modules & Workspaces |
go.mod directives, go.work for multi-module dev without replace |
| golangci-lint v2 |
Config version "2", formatters section, golangci-lint migrate |
| govulncheck |
Reachability-based scan of the call graph against vuln.go.dev |
| go fix modernizers |
Go 1.26 suite of fixers, //go:fix inline for API migrations |
| CI quality gate |
fmt → vet → golangci-lint → govulncheck → test -race |
Critical Rules
- Never invent flags or directives - Confirm every
go/tool flag against official docs first
- golangci-lint v2 config MUST start with
version: "2" - v1 configs are rejected; migrate, don't hand-edit
- govulncheck runs in source mode by default - Reachability filters noise; only reported findings matter
go.work is usually not committed - Commit only when modules are developed exclusively together
- CI gate order is fail-fast - Formatting/vet before linters before vulnerability scan before tests
Architecture
repo/
├── go.work # optional: multi-module workspace
├── go.work.sum
├── module-a/
│ ├── go.mod # module, go, require, toolchain
│ └── go.sum
├── module-b/
│ └── go.mod
├── .golangci.yml # version: "2"
└── .github/workflows/ci.yml
→ See ci-workflow.md for the complete gate
Reference Guide
Concepts
| Topic |
Reference |
When to Consult |
| Modules & Workspaces |
modules-workspaces.md |
Editing go.mod/go.work, multi-module repos |
| golangci-lint v2 |
golangci-lint-v2.md |
Config, v1→v2 migration, formatters |
| govulncheck |
govulncheck.md |
Dependency vulnerability scanning |
| go fix modernizers |
go-fix-modernizers.md |
Modernizing code, //go:fix inline, PGO |
Templates
| Template |
When to Use |
| golangci-v2-config.md |
Dropping in a recommended .golangci.yml |
| ci-workflow.md |
Wiring the full CI quality gate |
Quick Reference
Workspace bootstrap
go work init ./module-a ./module-b # create go.work
go work use ./module-c # add a module
go work sync # sync build list to modules
→ See modules-workspaces.md
Migrate + run golangci-lint v2
golangci-lint migrate # v1 config → v2 (backs up original)
golangci-lint run ./...
→ See golangci-v2-config.md
Scan for reachable vulnerabilities
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./... # source mode, call-graph reachability
→ See govulncheck.md
Modernize the codebase
go fix ./... # apply Go 1.26 modernizers
→ See go-fix-modernizers.md
Best Practices
DO
- Pin toolchain with the
toolchain directive for reproducible builds
- Gate CI on
govulncheck ./... and treat reachable findings as failures
- Use
go.work for local cross-module work instead of scattering replace directives
- Keep
formatters (gofmt/goimports) separate from linters in the v2 config
DON'T
- Hand-write a v2 config from a v1 file — run
golangci-lint migrate
- Commit
go.work in repos whose modules are also developed with external modules
- Suppress govulncheck findings without confirming the vulnerable symbol is unreachable
- Assume
go vet/gofmt changed in 1.26 — the 1.26 change is go fix, not those
1---2name: go-tooling-security3description: Use when setting up Go modules/workspaces, configuring golangci-lint v2, running govulncheck, or building a Go CI quality gate. Not for app logic or non-Go audits.4versions:5 go: "1.26"6 golangci-lint: "2"7 govulncheck: "latest"8user-invocable: true9references: references/modules-workspaces.md, references/golangci-lint-v2.md, references/govulncheck.md, references/go-fix-modernizers.md, references/templates/golangci-v2-config.md, references/templates/ci-workflow.md10related-skills: solid-go11metadata:12 source: https://skillmd.com/skills/fusengine/go-tooling-security13---1415<objective>16Covers Go tooling and dependency security: modules and workspaces (go.mod/go.work),17golangci-lint v2 configuration and migration, dependency vulnerability scanning18with govulncheck, modernizing code with go fix, and building a Go CI quality gate.19Does not cover writing Go application logic (see the Go expert), non-Go20languages, SOLID/architecture refactoring (see solid-go), or generic dependency21audits in other ecosystems.22</objective>2324# Go Tooling & Security2526## Agent Workflow (MANDATORY)2728Before ANY tooling/security change, spawn 3 agents in parallel, one `Agent` call each with a `name`:29301. **fuse-ai-pilot:explore-codebase** - Find existing go.mod/go.work, `.golangci.yml`, CI files312. **fuse-ai-pilot:research-expert** - Verify latest golangci-lint v2 + govulncheck docs via Context7/Exa323. **mcp__context7__query-docs** - Check current Go 1.26 `go fix` modernizer set3334After changes, run **fuse-ai-pilot:sniper** for validation.3536---3738## Overview3940| Area | Description |41|------|-------------|42| **Modules & Workspaces** | `go.mod` directives, `go.work` for multi-module dev without `replace` |43| **golangci-lint v2** | Config version `"2"`, `formatters` section, `golangci-lint migrate` |44| **govulncheck** | Reachability-based scan of the call graph against `vuln.go.dev` |45| **go fix modernizers** | Go 1.26 suite of fixers, `//go:fix inline` for API migrations |46| **CI quality gate** | fmt → vet → golangci-lint → govulncheck → test -race |4748---4950## Critical Rules51521. **Never invent flags or directives** - Confirm every `go`/tool flag against official docs first532. **golangci-lint v2 config MUST start with `version: "2"`** - v1 configs are rejected; migrate, don't hand-edit543. **govulncheck runs in source mode by default** - Reachability filters noise; only reported findings matter554. **`go.work` is usually not committed** - Commit only when modules are developed exclusively together565. **CI gate order is fail-fast** - Formatting/vet before linters before vulnerability scan before tests5758---5960## Architecture6162```63repo/64├── go.work # optional: multi-module workspace65├── go.work.sum66├── module-a/67│ ├── go.mod # module, go, require, toolchain68│ └── go.sum69├── module-b/70│ └── go.mod71├── .golangci.yml # version: "2"72└── .github/workflows/ci.yml73```7475→ See [ci-workflow.md](references/templates/ci-workflow.md) for the complete gate7677---7879## Reference Guide8081### Concepts8283| Topic | Reference | When to Consult |84|-------|-----------|-----------------|85| **Modules & Workspaces** | [modules-workspaces.md](references/modules-workspaces.md) | Editing go.mod/go.work, multi-module repos |86| **golangci-lint v2** | [golangci-lint-v2.md](references/golangci-lint-v2.md) | Config, v1→v2 migration, formatters |87| **govulncheck** | [govulncheck.md](references/govulncheck.md) | Dependency vulnerability scanning |88| **go fix modernizers** | [go-fix-modernizers.md](references/go-fix-modernizers.md) | Modernizing code, `//go:fix inline`, PGO |8990### Templates9192| Template | When to Use |93|----------|-------------|94| [golangci-v2-config.md](references/templates/golangci-v2-config.md) | Dropping in a recommended `.golangci.yml` |95| [ci-workflow.md](references/templates/ci-workflow.md) | Wiring the full CI quality gate |9697---9899## Quick Reference100101### Workspace bootstrap102103```bash104go work init ./module-a ./module-b # create go.work105go work use ./module-c # add a module106go work sync # sync build list to modules107```108109→ See [modules-workspaces.md](references/modules-workspaces.md)110111### Migrate + run golangci-lint v2112113```bash114golangci-lint migrate # v1 config → v2 (backs up original)115golangci-lint run ./...116```117118→ See [golangci-v2-config.md](references/templates/golangci-v2-config.md)119120### Scan for reachable vulnerabilities121122```bash123go install golang.org/x/vuln/cmd/govulncheck@latest124govulncheck ./... # source mode, call-graph reachability125```126127→ See [govulncheck.md](references/govulncheck.md)128129### Modernize the codebase130131```bash132go fix ./... # apply Go 1.26 modernizers133```134135→ See [go-fix-modernizers.md](references/go-fix-modernizers.md)136137---138139## Best Practices140141### DO142- Pin toolchain with the `toolchain` directive for reproducible builds143- Gate CI on `govulncheck ./...` and treat reachable findings as failures144- Use `go.work` for local cross-module work instead of scattering `replace` directives145- Keep `formatters` (gofmt/goimports) separate from `linters` in the v2 config146147### DON'T148- Hand-write a v2 config from a v1 file — run `golangci-lint migrate`149- Commit `go.work` in repos whose modules are also developed with external modules150- Suppress govulncheck findings without confirming the vulnerable symbol is unreachable151- Assume `go vet`/`gofmt` changed in 1.26 — the 1.26 change is `go fix`, not those