this:
foo, err := Bar()
There're a few cases where the compiler comes to the rescue:
* I forgot to do something about it: I get "declared and not used" from go
* I forgot it can fail I might get a "multi-value in single-value context"
error
* If I decide it's not an important error I can explicitly ignore it with a
blank identifier
The code feels much more robust compared to Java's unchecked exceptions or
C's return codes but I can still screw up if I'm working with a function
that solely returns an error and I forget to do something with it:
err := Baz()
Baz()
In the rare cases where the second case is legitimate, the _ could just be
used instead. Are there any reasons the compiler lets me get away with
ignoring return values?
--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.