The flag package makes it simple to add command-line flag arguments to a Go application. It has a few shortcomings--you tend to duplicate a lot of code in order to add shorthand versions of flags, and they're ordered alphabetically from the help prompt. There are a number of third-party libraries that attempt to address these shortcomings, but this chapter will focus on the standard library version and not on those libraries.
Using command-line flags
Getting ready
Configure your environment according to these steps:
- Download and install Go on your operating system from https://golang.org/doc/install, and configure your GOPATH environment variable:
- Open a terminal/console application, and navigate to your GOPATH/src and...