Part 3: Under the Hood dives into the inner workings of CLI application development, with real-world examples written in Go. This section of the website provides complete, working code samples—along with compiling instructions—so readers can quickly get hands-on with the concepts. It also includes examples from Part 4: The Modern CLI, which explores patterns, practices, and design strategies in greater depth. Together, these examples bring the book’s ideas to life and support deeper learning through practical application.
Getting started with Go is straightforward, and there are several ways to create, edit, and compile a program. You might use VS Code on Windows or macOS, or Vim in a Linux terminal—whatever environment you prefer works just fine. Begin by installing the latest official Go release following the instructions at go.dev/doc/install. If you run into setup issues, it can be helpful to discuss specifics with an LLM for troubleshooting tips. Once installed, familiarize yourself with essential Go commands such as go mod, go fmt, go run, go build, and go test. From there, experiment with the examples in this book—or dive into your own projects and ideas. Content and concepts that did not make the book will be posted periodically in the Overflow section of this site.
One final note: Go is more than just a programming language—it is a complete software engineering ecosystem. Its toolchain supports the entire development lifecycle, from source editing and static analysis, through building and testing, to profiling and debugging compiled programs. Combined with well-defined runtime semantics such as garbage collection and concurrency primitives, Go provides a cohesive environment that streamlines development and operations. The earlier you explore these integrated capabilities, the sooner you will appreciate the full depth and power of the platform.
| Example | Purpose |
|---|---|
| IP Tool | A simple CLI that demonstrates the use of flags and switches while interacting with an external API to retrieve the public IP address of the host machine. |
| Cobra CLI | A straightforward yet fully functional example showcasing the object-command model implemented using the Cobra package. It demonstrates how to structure commands, flags, and subcommands following modern CLI design principles. |
| Logger | Demonstrates configurable logging using the ZeroLog library, with support for adjustable severity levels to suit various runtime environments. |
| Exit Code | A minimal example that demonstrates how to return meaningful exit codes from a command-line application to signal success or failure. |
| Task CLI | This example was designed to demonstrate object return values and structured exit codes, as discussed in the chapter “Put On Your PowerShell® Hat.” It illustrates how to build CLIs that integrate cleanly with scripting environments like PowerShell. |
| Output CLI | This example can be examined to better understand default formatting and using a flag to specify various alternate formats. |
| REPL CLI | This example showcases a Read-Eval-Print Loop (REPL) style interface. It echoes user input and includes basic built-in commands such as HELP and EXIT, providing a simple foundation for interactive CLI applications. |
| Languages | This page highlights key language differences—such as readability and type systems—through side-by-side “Hello, World” examples written in Python, Rust, and Go. |
| Keyforge | This is a fully working CLI built to demonstrate an object command model in action. |
Additional relevant topics that did not make the book can be found in this site’s Overflow section.