possible to just write:
myStruct.MyMethod()
and the compiler doesn't complain, silently ignoring the discarded return
value. This can lead to bugs if for instance MyMethod is in a library and
the user for some reason doesn't realise that it returns something.
My proposal is for the compiler to complain, requiring the programmer to
write
_ = myStruct.MyMethod()
if they wish to ignore the return value. This eliminates the possibility of
the programmer not realising that a method returns something, and makes
code review easier as it's clear where a return value/error is being
ignored.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.