Creating a Simple Commander Program in Go

The commander pattern has become a common approach to writing terminal programs these days. It is something of an extension to the UNIX philosophy because it is both practical and in the original spirit of that philosophy. Even if you never intend your humble command line utility to ever become more it is a really good idea to start with the commander pattern to you can easily add more to it later without it falling apart. Since this isn’t really an abstraction and it incredibly simple to code you are not in danger of putting too much into it.

💬 The popular Cobra commander is ridiculously and unnecessarily bloated compared to this mostly because it doesn’t even follow the UNIX philosophy itself by trying to put everything related to command line parsing into itself and forcing too much.

This guided project also covers how the special Go init() method works.

But First …