replace
func(x, y error) bool {
return errors.Is(x, y)
}
with errors.Is
36 return reflect.DeepEqual(x, y)
37 })
38
39 ErrorComparer = Comparer(func(x, y error) bool {40 return errors.Is(x, y)
41 })
42
Description
Function literals that only call a single function, without making any other changes to the value of the inner function, can be removed, as they are redundant. Instead, the inner function, that is being called inside the outer function should be called.
Bad practice
_ = func(x int, y int) int { return add(x, y) }(1, 2)
Recommended
_ = add(1, 2)