Purpose: capture the project context from
docs/prompt.mdand make it easy for new contributors to ramp up without losing any of the original hand-written details.
| 维度 | Go | Rust | .NET AOT | C/C++ | Node (pkg) |
|---|---|---|---|---|---|
| 单文件静态 exe | ✔ CGO_ENABLED=0 |
需 zig-cc / LLD | ✔ 但 >5 MiB | ✔ 手工繁琐 | ✔ 体积 60 MiB |
| 交叉编译 | 一行环境变量 | 工具链复杂 | 官方组合少 | 各装 SDK | 有缺口 |
| 构建生态 | goreleaser | cargo-release | MSBuild 脚本 | 无统一 | 手写 |
| Hello.exe 体积 | 1.7 MiB (UPX 700 KiB) | 300 KiB | 5-6 MiB | 30 KiB | 60 MiB |
| 新手曲线 | 15 min | 陡峭 | 中 | 内存管理 | 最平 |
| AV 误报 | 低 | 中 | 极低 | 中 | 中 |
结论
- 开发效率 + 产物体积 + 生态模板 三要素,Go 综合最优。
- 初学门槛极低,强劲对手难以在短期内提供“更优解”。
与 README 的 “Why Go” 表格保持一致,必要时在此补充额外的对比数据。
brew install go git goreleaser gh upx
brew install --cask cursor # GUI IDE(可选,但与原手册一致)winget install -e --id Git.Git
winget install -e --id Microsoft.WingetCreate # GUI & CLI
winget install -e --id GoReleaser.GoReleaser
winget install -e --id Cursor.Cursor # 可选 IDE- 创建 Team:
HelloCLI - Milestone:
v1.0.0 上架 winget - 初始 Issue 模板:
- 编写 main.go 打印 Hello, world!
- 配置 goreleaser(windows amd64/arm64)
- 创建 GitHub repo hello-cli 并推送
- 打 tag v1.0.0 -> 触发 Release
- 编写 winget manifest (Moniker=hello)
- 提 PR 到 winget-pkgs
- 在 Win11 终端验证 `winget install hello-cli` 并运行 `hello`
维持线性流:代码 → 发布 → 分发 → 反馈。完成后将卡片拖动到 Done 列。
mkdir hello-cli && cd hello-cli
git init -b main
go mod init github.com/<your-gh-user>/hello-clipackage main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o hello.exe -ldflags "-s -w"
upx hello.exe # 可选压缩// 读取 CLI 参数
name := "world"
if len(os.Args) > 1 {
name = os.Args[1]
}
fmt.Printf("Hello, %s!\n", name)
// 彩色输出
import "github.com/fatih/color"
color.Cyan("Hello, %s!", name)交叉编译更多示例:GOOS=linux GOARCH=arm64 go build -o hello.
- macOS 安装 Go / GoReleaser / Cursor
- Windows 安装 WingetCreate / Cursor
- GitHub 仓库推送并打首个 tag(例如
v1.0.0)触发 Release - winget manifest (Moniker=hello) PR 合并
-
winget install hello-cli成功运行并输出问候 (hello) - Linear 看板任务全部移动到 Done
- 对外宣传(推文 / Hacker News)附带截图 🎉
现在你了解了团队为何选择 Go、如何配置开发环境,以及如何完成 Hello CLI 项目的最小闭环。接下来请继续阅读
docs/release-workflow.md获取完整发布流程。