Go Cheatsheet - Format Errors

·

1 min read

Errors

Return simple error string

return errors.New("Invalid Parameter")

Return string with format

return fmt.Errorf("user %q (id %d) not found", name, id)