4 ms·
The compiler prohibits declaring variables (and imports) without using them. You can get around this with result, _ := someFunc() or in a (anti) pattern
by libria 10y ago
The compiler prohibits declaring variables (and imports) without using them. You can get around this with
result, _ := someFunc()
or in a (anti) pattern I use sometimes
_ = []interface{}{ err1, err2, var1, etc }
with underscore being a special variable name indicating to the compiler you understand you're ignoring it.
Nice writeup btw. Did generics/GC play any part in the decision making process?