should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
52func equalCompare(a, b any) (bool, error) {
53 typeEql := reflect.TypeOf(a) == reflect.TypeOf(b)
54 if typeEql == false {
55 return false, errors.New(fmt.Sprintf("type equality: %v", typeEql))56 }
57
58 switch a.(type) {
Description
Error construction could be simplified by using fmt.Errorf(…)
Bad practice
errors.New(fmt.Sprintf(...))
Recommended
fmt.Errorf(...)