Open johanbrandhorst opened 7 years ago
Another bit of conversation from Slack: We can't apply the check to exported methods because of interfaces. We can't apply them to exported functions because of function types. We can apply them to unexported functions and methods if we can prove that they're not used to implement interfaces in the same package, or to match a function type in the same package, or passed as an argument where the argument type is from another package. The same goes for assignment to variables (including fields, maps and so on)
A couple of times I've come across functions that used to return errors, but for some reason they were refactored so that they no longer return errors and the refactoree forgot to change the signature, ending up with a function that only ever returns the zero value of the error.
As discussed on gophers slack this could probably be extended to any type which is only returned as its zero-value.
It would be nice to warn the user that the function no longer needs to return all the types.