Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Logging Fatal errors

  • Fatal, Fatalf, and Fataln print the message and call os.Exit(1) for the program to exit with code 1.
  • Does not execute the lines after calling Fatal
package main

import (
	"log"
)

func main() {
	log.Print("First")
	log.Fatal("Oups")
	log.Print("Last")
}
2020/04/10 08:49:41 First
2020/04/10 08:49:41 Oups
exit status 1