fmt.Errorf is usually used with the first parameter being a format string.
In your case there is a plain string used, so errors.New(..) should suffice.
If you want to be more fancy, you may implement the error interface like this
type Error string
func (e Error) Error() string {
return string(e)
}
const (
ErrNotFound = Error("not found")
)
fmt.Errorf is usually used with the first parameter being a format string. In your case there is a plain string used, so errors.New(..) should suffice.
If you want to be more fancy, you may implement the error interface like this