Write Professional Command-line Programs in Go
Gain insights into writing professional command-line programs in Go. Delve into structuring Go programs, writing idiomatic code, testing effectively, and impressing users and managers.
I'm a long time software developer. I started programming in the early 80s (yes, the previous millennium) on the Dragon 32 and I never grew out of it. I was born and raised in Israel, served in the IDF (Israeli Defense forces) for three and a half years in the paratroopers and special forces. I even got shot in the leg during my military service, but don't worry I healed completely and even ran a half marathon a few months later. I studied computer science at Tel-Aviv university and got an MBA too. I started developing software professionally in 1995 and I'm still at it. I'm currently a principal software architect at Helix (http://www.helix.com) - Where we build a consumer genomics and bioinformatics platform. I've had a very diverse career, mostly working for startup companies where I wore multiple hats, often at the same time. I always follow my passion and try to work in a new interesting domain. Here are some of the domains and industries I contributed to: - instant messaging (when it just started) - morphing - chip fabrication process control - embedded multimedia applications for game consoles (Sony PlayStation) - brain-inspired machine learning (Numenta) - custom browser development (Rockmelt) - web services for 3D distributed game platforms (Roblox), - IoT sensors (Aclima) - virtual reality (stealth startup) In addition to working in very different domains I also traveled across the tech stack from Windows desktop applications, through cross-platform engine to cloud-based distributed systems, and databases. Here some of the programming languages I used professionally: - Go, - Python, - C, - C++, - C#, - Java, - Delphi, - JavaScript - Cobol - PowerBuilder I also programmed against many operating systems (often at a very low-level): - Windows (3.11 through 7) - Linux (so many distros) - macOS - Lynx (embedded) - Sony Playstation These days it's all about cloud-native computing with Docker and Kubernetes. I've deployed production systems on AWS, GCE, Azure and even Alibaba cloud. Outside of work, I have a lovely wife and 3 kids. We love traveling, hiking, sports (weight lifting, Crossfit, martial arts) and board games (Settlers of Catan, Dominion, Seven Wonders, Puerto Rico). I used to play a lot of basketball and do Crossfit. These days my athletic outlet is Brazilian Jiu Jitsu. I also spend a lot of time learning and sharing what I've learned with the world through open source (http://github.com/the-gigi), articles and books.
Join 3.1 million developers at
What You'll Learn
- Identify CLI inputs/outputs: commands, flags, args, streams, piping, and exit codes
- Refactor a Go CLI into modular packages and a cmd/ structure using Go modules
- Write and run unit tests with Go testing, including table-driven and parallel tests
- Create BDD unit and end-to-end tests with Ginkgo/Gomega and generate coverage profiles
- Build structured CLIs with Cobra using root commands, subcommands, and persistent/local flags
- Implement configuration with Viper across flags, env vars, files, and remote sources with precedence
- Automate builds and releases using go build flags, GitHub Actions, Docker, and Makefiles
Learning Roadmap
1.
Overview
Overview
2.
Restructuring multi-git
Restructuring multi-git
3.
Testing 1,2,3...
Testing 1,2,3...
11 Lessons
11 Lessons
4.
Adding Smart Command-Line Parsing
Adding Smart Command-Line Parsing
13 Lessons
13 Lessons
5.
Adding Advanced Configuration
Adding Advanced Configuration
13 Lessons
13 Lessons
6.
Adding Bells and Whistles
Adding Bells and Whistles
13 Lessons
13 Lessons
Show License and Attributions
Gigi Sayfan
I'm the DevOps team manager at Helix - a bioinformatics and genomics start-up, author of several books on Kubernetes and Go as well as hundreds of technical articles. I program professionally for 20+ years and still amazed when anything actually works.
Trusted by 3.1 million developers working at companies
Anthony Walker
@_webarchitect_
Evan Dunbar
ML Engineer
Software Developer
Carlos Matias La Borde
Souvik Kundu
Front-end Developer
Vinay Krishnaiah
Software Developer
Built for 10x Developers












Free Resources