import (
	"log"
)

The docstring says this is equivalent to calling Print() and os.Exit(1).

err := foo()

if err != nil {
  log.Fatal(err)
}

You can also use Fatalln.