fmt.Println
is used for debugging purposes
import "fmt" fmt.Println("debug message") // string interpolation name := "Sam" fmt.Sprintf("Hi, my name is %v", name)
Printf
prints the string
Sprintf
creates string and returns it
log.Println
is used for logging purposes
import "log" log.Println("debug message")
log.Fatal
- logs the message and calls os.Exit(1)
log.Panic
- logs the message and calls panic
log.Print
- logs the message