Unit Testing CLI Programs in Go
It’s a common scenario — for me at least — to be building a CLI tool (
main package) that has CLI options (
flags package) that I want to add unit tests to.
Here’s a simple example of a CLI tool that adds or multiplies some input numbers: