Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Stop using log.Fatal #86

Open
kennygrant opened this issue Sep 28, 2017 · 0 comments
Open

Stop using log.Fatal #86

kennygrant opened this issue Sep 28, 2017 · 0 comments

Comments

@kennygrant
Copy link

In many examples you're using log.Fatal, this will exit the program immediately with os.Exit(1) and probably isn't something you should encourage newcomers to the language to use. It would be nice if the examples just returned errors or logged them, not exited the program (which should be very unusual in go code). It also means things like defer statements you have in there wouldn't run.

So this example is misleading for example:

http://go-database-sql.org/prepared.html

because the defer is never called, since you call log.Fatal which calls os.Exit.

The comment about Go 1.4 will probably cause confusion now too as it is really out of date, probably better just to remove that now that the fix is in, or demote it to a footnote?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant