Build a Real CLI Tool in Go
Build til, a note-taking CLI in Go - subcommands, flags, safe JSON storage on disk, aligned table output, real tests, and cross-compiled binaries you can put on your PATH.
Download EPUB- Why Go, and a Compiling Project Create the til module with go mod init, read command-line arguments from os.Args, and compile your first self-contained binary with go build.
- Flags and the add Command Dispatch subcommands from os.Args, give each one its own flags with flag.NewFlagSet, and build the add command that parses tags and note text.
- JSON on Disk, Safely Persist notes to ~/.til/notes.json with encoding/json - struct tags, a missing file treated as a first run, and atomic writes so a crash can't corrupt the store.
- list, search, and tags Finish the subcommand set - list with -n and -tag flags, case-insensitive search, a tags summary - and align it all into clean tables with text/tabwriter.
- Tests That Catch Real Bugs Write table-driven tests for the search and filter logic, round-trip the JSON storage through t.TempDir, and watch go test catch a planted bug.
- Cross-Compile and Ship It Build til for Windows, macOS, and Linux from one machine with GOOS/GOARCH, install it on your PATH with go install, and map the honest next steps.