Build a CLI Tool in Go
Turn a script into a real command-line tool with subcommands, flags, and help text people can actually use.
Prerequisites: completion of Go Fundamentals and Tooling, or equivalent comfort with go run/go build.
Version note: verified against current docs as of July 2026, targeting the common Go 1.25/1.26 feature set.
Docker, Kubernetes' kubectl, Hugo, and the GitHub CLI are all written in Go, and nearly all of them use the same library — Cobra — for structuring commands, flags, and help output. This project builds a small task-tracker CLI (todo add, todo list, todo done) using Cobra, then ships it as a single cross-platform binary.
Scaffold the app
Add flags and arguments
Persist state to a local file, then cross-compile and ship a binary
Secret Mission: Shell completion
Before You Go
Test what you just learned
Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.
Log in to unlock0 / 6 complete
