Command-line arguments revisited!

As we saw in Chapter 2, Writing Programs in Go, you cannot work efficiently with multiple command-line arguments and options using if statements. The solution to this problem is to use the flag package, which will be explained here.

Remembering that the flag package is a standard Go package and that you do not have to search for the functionality of a flag elsewhere is extremely important.

Get Go Systems Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.