I’m reading The Go Programming Language, and in all the examples I’ve seen using the flag package, package-level variables are used to hold the flags. Examples:
The forum won’t let me make this a link, but here’s another: https://github.com/adonovan/gopl.io/blob/master/ch7/sleep/sleep.go#L16
My question is, why? Making it a package variable is non-obvious to me. The examples seem to work just as well if I move the declarations into main().