3 ms·
If the user can do anything with the error, then it is idiomatic to return a discrete, comparable error variable var ErrTryAgain = errors.New("...") or an
by sagichmal 9y ago
If the user can do anything with the error, then it is idiomatic to return a discrete, comparable error variable
var ErrTryAgain = errors.New("...")
or an error type with additional contextual information
type RetryError struct { ... }
These are both opt-in; if your users have no need to differentiate or act on errors, fmt.Errorf("...") is totally sufficient.
You're acting as if this is some critical flaw in the language. It's nothing like that.