A small change to #Go that I think would have been an easy sell before 1.0, but isn't worth the change today:
- `main()` returns `error`
- `os.Exit()` takes an `error` arg instead of an `int`
- there is an auxiliary interface along the lines of `type ExitError interface { ExitCode() int }` that if if the error implements it controls the numeric exit code; otherwise nil is 0 and non-nil is 1.
Bonus, but maybe a little harder sell:
- no `os.Exit()`; only way to exit is by returning from main
IME, one of the hardest things getting programmers from other languages used to with Go is drilling in that "the 'default' thing to do with an error is to return it". `main()` is a notable exception to that rule of thumb. It's almost like code in main() is a different dialect than the rest of the codebase. Let's just make it uniform.
I feel like a lot of the griping that people have about Go error handling would go away if people internalized that rule of thumb, and this would make that easier.
This is one of the few places where the language design encourages you to do the "wrong" thing and introduces bad habits. When you're first starting out, or messing around on the playground where maybe main() is the only function: It makes `panic(err)` the convenient/quick-and-dirty way of handling errors. Simply having main() return an error would make the correct thing the easy thing. And bad habits never get formed.