TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The Go Beartrap Lying in the Shadows

9 pointsby bitofenglishover 10 years ago

2 comments

mholtover 10 years ago
From the Go language spec[1]:<p>&gt; 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.<p>So if this is something you&#x27;re not used to,it might be a good idea to avoid multi-variable short declarations in critical code. (Declare with `var` beforehand.)<p>Also, for more credibility in writing, call it Go, not golang. #golang is just a hashtag (and domain name).<p>[1]: <a href="https:&#x2F;&#x2F;golang.org&#x2F;ref&#x2F;spec#Short_variable_declarations" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;ref&#x2F;spec#Short_variable_declarations</a>
评论 #8524279 未加载
kxoover 10 years ago
&gt; It takes the best of C++, Java and Python … and then it really tightens everything up.<p>&quot;in 2004&quot; belongs in that statement.