Use non-zero exit codes for failures in cmd/describe/
lukeyeager opened this issue · 1 comments
lukeyeager commented
It would be nice to use log.Fatal()
here (and in the 3 other spots in that function which are treated as irrecoverable errors):
Lines 81 to 82 in 30abb01
When testing new versions, I like to loop through my BMCs to see whether this library can connect to them w/o errors (FYI, as of #51 (comment), they all work! 🎉). I'll work on getting approval for sending PRs in the future.
gebn commented
log.Fatal()
is suboptimal as it ignores defer
red logic. I agree with your point though. The nicest way I can think of is to create a wrapper function:
func main() {
if err := realMain(context.Background()); err != nil {
log.Fatal(err)
}
}
func realMain(ctx context.Context) error {
// current main() here, deferring clean-up logic and returning fatal errors
}