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

Stop using log.Fatal #86

Description

@kennygrant

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions