News for hackers. Stuff that matters.
Re:The Go Beartrap Lying in the Shadows by mholt on Tuesday October 28, 2014 @04:28PM (#8523376)
From the Go language spec[1]:

> Unlike regular variable declarations, a short variable declaration may redeclare variables provided they were originally declared earlier in the same block with the same type, and at least one of the non-blank variables is new. As a consequence, redeclaration can only appear in a multi-variable short declaration. Redeclaration does not introduce a new variable; it just assigns a new value to the original.

So if this is something you're not used to,it might be a good idea to avoid multi-variable short declarations in critical code. (Declare with `var` beforehand.)

Also, for more credibility in writing, call it Go, not golang. #golang is just a hashtag (and domain name).

[1]: https://golang.org/ref/spec#Short_variable_declarations

Re:The Go Beartrap Lying in the Shadows by xkarga00 on Tuesday October 28, 2014 @07:11PM (#8524279)
Actually the problem here has to do with the scope where the declaration happens. If redeclaration happened as mentioned in your quoted text ie. assignment of a new value, there would be no problem. As is [in a different scope], a redeclaration of err is actually a declaration of a shadowed err variable.