G
Go Gotchas
devs.cloudimmunity.com · Personal blog · on HN since 2015
A single long guide listing traps, gotchas, and common mistakes for new Go developers, with code examples.
What HN saysHN links it as a good read on Go quirks like variable shadowing, though one commenter says a section is outdated and another finds it daunting.
21HN people shared it
10linked it in comments
13stories submitted
213story points
3 years agolast shared
2015people per year2026
Most-shared posts
- 1Common Mistakes for New Golang Devs19 people · 207 points · first shared 2015 · 35 comments on HN
- 2Traps, Gotchas, and Common Mistakes for New Golang Devs3 people · 3 points · first shared 2015 · 1 comments on HN
- 350 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs1 people · 3 points · first shared 2015 · discussion on HN
What HN people wrote when they linked it
altmind · 2020-02-28
50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs, a good read about go quirks and unexpected behaviors
http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
sAbakumoff · 2017-10-05
Yeah, I also love Golang, though I am a full-job front-end developer. Sometimes it can make me shout "WHAT THE FUCK"[1] to the IDE, but it's the most enjoyable language I worked with during last 20 years.
[1] http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
kylequest · 2021-03-23
Golang gotchas are fun :) Some of them are for beginners while others will trip you up even when you've done a lot (e.g., variable shadowing). Here's another golang gotchas post from a while back: http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang
isaachawley · 2018-06-20
This is outdated and incorrect http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
nazka · 2018-06-19
I really want to use Go and I already know the language itself but this post[1] makes me scared to the point where a language as big as Scala makes more sense to me than learning a simple language but with a ton of things on the side to know. Is it really accurate compared to this post?
I feel like I will have more to learn with Scala but at least it will be useful things.
[1] http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
0xmohit · 2018-03-02
50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs [0] might serve as a nice supplement to this article.
[0] http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
Spiritus · 2015-05-17
Seems like I messed up the URL and included an anchor link. Should be:
http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
avinassh · 2023-05-23
We hire people from different backgrounds and experience levels, from 1 to ~10 YOE. Only some require a week to get familiar with Go, but I have seen senior developers (say 6+ years) requiring time to get the hang of the language and the features. E.g., I have hired Python programmers, and the concurrency primitives, the concept of CSP, and channels are very new to them.
Go is simple, but it also has many gotchas. Knowing them also helps.
Also, when someone new has joined, the new environment could be overwhelming for them, and I'd like to ease all this and slowly induct them.
---
If you are curious, here are the Go onboarding resources (doing them in this order is preferred)
- The tour of Go - https://tour.golang.org/welcome/1
- Go concurrency exercises - https://github.com/loong/go-concurrency-exercises
- Common Go gotchas - http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
- Concurrency is not parallelism - https://vimeo.com/49718712
gmjosack · 2016-12-29
In my experience working with new and experienced Go developers that simplicity is pretty superficial.
Take a look at SliceTricks[0]. These are all pretty simple operations in other languages that the Go authors think users should be forced to write manually so they understand the costs. Reading these in code reviews is definitely not a breath of fresh air.
I also see Go users develop bad habits that will burn them in other languages, like returning a reference to a "stack" allocated variable. In the same vein, if you care about performance you have to internalize the escape analysis rules, which most new users won't know about.
There are tons of footguns[1] in Golang as well. I constantly see people get burned by issues at runtime. I truly believe that the Golang benefits are short-sighted. You get some upfront development gains that you end up pain for with less reliable software. I personally would rather pain that cost upfront where possible with the compiler telling me when something is wrong.
[0] https://github.com/golang/go/wiki/SliceTricks
[1] http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
albumdropped · 2018-01-30
A Tour of Go https://tour.golang.org
Todd McLeod on YouTube https://www.youtube.com/channel/UCElzlyMtkoXaO3kFa5HL0Xw
Go by example https://gobyexample.com/
Go Documentation https://golang.org/doc/
50 Shades of Go: Common Mistakes for New Devs
http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang…
Two Free Books http://www.golang-book.com/
Build Web Applications with Go
https://github.com/astaxie/build-web-application-with-golang
Not really aimed at beginners, but Francesc Campoy's YouTube channel is really good. Just for Func.
https://www.youtube.com/channel/UC_BzFbxG2za3bp5NRRRXJSw
For more advanced topics, anything by Kelsey Hightower. There are several of his conference talks online.