9951 explained code solutions for 126 technologies


golangHow to log fatal error


Errors can be logged as simply as:

package main
import "log"

func main() {
  log.Fatal("oh no")
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically

log.Fatal(

will log message and call os.Exit(1) after that