4 ms·
Any error return values in go must be assigned to a variable at call time, otherwise it's a compile error. Nonsense. fmt.Println("Hello world!") I just ig
by danieldk 10y ago
Any error return values in go must be assigned to a variable at call time, otherwise it's a compile error.
Nonsense.
fmt.Println("Hello world!")
I just ignored an error and it compiles fine. Go check the return type of Println:
https://golang.org/pkg/fmt/#Println https://golang.org/pkg/fmt/#Println
tl;dr, it's very easy to accidentally ignore errors in functions that are side-effecting or modify parameters. Been there, done that.
- pmarreck 10y agoYeah, that's what I thought. And I've also been there, done that. Is there basically some willful blindness around this issue with Go fans, or something? Or a lack of experience doing code? Or am I completely missing something?