Often, empty error strings (errors.New("")
or fmt.Errorf("")
) are present in the codebase so that they can be later replaced
with appropriate errors, but they sometimes might get missed. We recommend checking the
empty error strings in your codebase to see if they are intentional or need to be replaced
with appropriate errors.
func doWork(n int) error {
if n < 0 {
return errors.New("")
}
return nil
}
func doWork(n int) error {
if n < 0 {
return errors.New("n is less than 0")
}
return nil
}