Errorf in Go

Posted by GoDoc
Public (Editable by Users)

The Errorf function lets us use formatting features to create descriptive error messages.

Go
Edit
package main

import "fmt"

func main() {
	const name, id = "bueller", 17
	err := fmt.Errorf("user %q (id %d) not found", name, id)
	fmt.Println(err.Error())
}