Small Go CLI notes
A command-line tool stays kind when it does one job and exits with a clear status. I keep most of mine in the standard library until a second command appears.
Flags before files
The flag package is enough for a first version. Name flags after the noun they change. Print usage to stderr and return a non-zero status when the user omitted a required path.
One package, then two
I start with main and a few functions in the same file. A second package appears when I want a test that should not import main. Not sooner.
Exit codes are part of the interface
Zero means the work finished. One means the user can fix the input. A different number is only useful if a script already depends on it. Document the ones you keep.