3 ms·
The ugliest part of Go, imho, is that in some situations it may appear as if nil != nil. See for example the confusion in [1], and for an explanation, [2] [1]
by amelius 11y ago
The ugliest part of Go, imho, is that in some situations it may appear as if nil != nil. See for example the confusion in [1], and for an explanation, [2]
[1] http://stackoverflow.com/questions/21460787/nil-slice-when-passed-as-interface-is-not-nil-why-golang http://stackoverflow.com/questions/21460787/nil-slice-when-p...
[2] https://golang.org/doc/faq#nil_error https://golang.org/doc/faq#nil_error
- tjholowaychuk 11y agoI'd have to agree! Some little quirks like this sort of make sense after they're explained but they're certainly not intuitive. Assignability is another that I find awkward, I had to dig around to find the reasoning behind named/unnamed types being handled the way they are.