Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
-
flag is a Go standard library for parsing command-line arguments. It is simple but limited. For more discussions, please refer to Parse Command Line Arguments Using Flag in Go .
-
spf13/cobra, urfave/cli, and spf13/viper are popular good 3rd-party libraries. spf13/cobra is the most popular one and is used in many Go projects such as Kubernetes, Hugo, Github CLI, etc. spf13/viper's power is on application configuration even though it can also be used to parse command-line arguments.
To sum up, I'd suggest using spf13/cobra for parsing command-line arguments and spf13/viper for application configuration.