← 返回 CLI 目录 抓取的
Go CLI
$ go 官方出品 低风险 The Go Authors · 代码托管与研发协同 · BSD-3-Clause · macos / linux / windows
Go 语言官方命令行工具链,覆盖编译、模块管理、静态检查(vet)、格式化与测试。内置 go list -json、go test -json 结构化事件流以及 go build -n 编译命令预演,且编译速度极快。
FCRS-1.0 综合评分
94 /100
极佳 (Excellent)
高置信度 (实测)
零摩擦安装命令
brew install go CLI vs MCP 选型建议 仅 CLI 可用
直接在本地 Go 包上执行编译、go vet 与 go test -json,依托亚秒级缓存无需 MCP。
Agent 友好度体检单
本地探针实测证据 ✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
✓ 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md
实测版本
go version go1.26.5 darwin/arm64
冷启动耗时
11 ms
退出码 (help / 非法参数)
2 / 2
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
Go is a tool for managing Go source code. Usage: go <command> [arguments] The commands are: bug start a bug report build compile packages and dependencies clean remove object files and cached files doc show documentation for package or symbol env print Go environment information fix apply fixes suggested by static checkers fmt gofmt (reformat) package sources generate generate Go files by processing source get add dependencies to current module and install them install compile and install packages and dependencies list list packages or modules mod module maintenance work workspace maintenance run compile and run Go program telemetry manage telemetry data and settings test test packages tool run specified go tool version print Go version vet report likely mistakes in packages Use "go help <command>" for more information about a command. Additional help topics: buildconstraint build constraints buildjson build -json encoding buildmode build modes c calling between Go and C cache build and test caching environment environment variables filetype file types goauth GOAUTH environment variable go.mod the go.mod file gopath GOPATH environment variable goproxy module proxy protocol importpath import path syntax modules modules, module versions, and more module-auth module authentication using go.sum packages package lists and patterns private configuration for downloading non-public code testflag testing flags testfunc testing functions vcs controlling version control with GOVCS Use "go help <topic>" for more information about that topic.
FCRS-1.0 六维评分拆解
Agent 友好度 24 / 25
内置 go list -json、go test -json、go version -m 与 go build -n,全 CLI 零交互提示。
go test -jsonstreams structured per-test JSON eventsgo list -jsonoutputs complete package and module JSON
安全与权限边界 22 / 25
具备 go.sum 密码学校验和、go build -n 预演模式,且无远程发包副作用。
- Cryptographic
go.sumverification and-ndry-run mode
安装与运行摩擦 14 / 15
跨 macOS、Linux 与 Windows 的自包含工具链压缩包或 Homebrew 安装,原生支持交叉编译。
- Single toolchain archive with cross-compilation built in
能力覆盖与边际价值 15 / 15
单二进制内建高速增量编译、gofmt、go vet、竞态检测与测试运行器。
- Unified build, test, vet, and module tooling
维护与来源背书 10 / 10
由 Go 官方团队(Google 支持)以 BSD-3-Clause 协议维护,遵守严格的 Go 1 兼容性承诺。
- First-party
golang/gotoolchain
文档与可验证性 9 / 10
pkg.go.dev/cmd/go 与内置 go help <topic> 文档权威详实。
- Complete command documentation via
go helpand pkg.go.dev
安全边界、鉴权与放权指南
鉴权方式
无需鉴权 本地配置文件
凭证存储位置
拉取公开模块无需认证;私有模块结合 GOPRIVATE 读取 ~/.netrc 或 Git 凭证。
潜在副作用
只读查询 本地写入
费用与配额提示
BSD-3-Clause 开源免费工具链。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Go CLI (go) Agent Rules - Prefer `go test -json ./...` and `go vet ./...` for structured verification. - Use `go list -json ./...` instead of parsing `go.mod` or directory trees manually.
Agent 高频安全命令配方
只读查询(安全推荐)
以 JSON 查看 Go 包与依赖元数据
go list -json ./...
在不构建二进制的前提下输出包含导入、文件列表与模块信息的 JSON 描述。
预演构建命令而不实际编译
go build -n ./...
打印将要调用的精确编译器与链接器命令,但不执行。
受控写入与预演
以结构化 JSON 事件流运行测试
go test -json ./...
运行包测试并按用例流式输出通过/失败/输出 JSON 事件。
核心优势
- +
go test -json与go list -json开箱即用提供一流的结构化输出。 - + 高速增量编译缓存配合内置
go vet与-race竞态检测。 - + 零交互提示且具备严格的向后兼容性。
注意事项与踩坑点
- !
go build编译错误输出仍为文本行而非 JSON(go test -json会封装输出)。 - ! 交叉编译包含 cgo 的包时仍需目标平台的 C 交叉编译器。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI