go compiler to raise an error if function not explicitly return nil
with return value of interface type signature
#46627
Labels
return nil
with return value of interface type signature
#46627
Many known that the famous
nil != nil
trap when using interface variable. The Golang FAQ "Why is my nil error value not equal to nil?" says:And the FAQ show an bad(wrong) coding paradigm when a function with return value of interface type signature:
So, would it be a good idea for go compiler, to discover these kind of bad code and treats as a programming error(or a friendly warning) that must be fixed? Whenever a function has return value of interface signature, it must explicitly has at least one line of
The text was updated successfully, but these errors were encountered: