7 ms·
I agree on all of these. #1 would even count as gotcha when it would the loop would yield a reference instead of the a copy, since lots of code might expect a c
by Matthias247 9y ago
I agree on all of these. #1 would even count as gotcha when it would the loop would yield a reference instead of the a copy, since lots of code might expect a copy. I think in some other languages (e.g. C#) there was also some confusion and change about that.
There are of course also the usual gotchas when capturing things in a closure (is it by value or by reference?). But this is not Go specific.
You explained the main Go-specific Gotcha in my opinion: The dual-nullability of interface types, and the fact that non-null interface objects might contain null pointers to structs that implement the interface.
- Dylan16807 9y ago> I think in some other languages (e.g. C#) there was also some confusion and change about that. Nah. They wanted references, they got references. The issues were an oversight related to scope.