Jump to ratings and reviews
Rate this book

100 Go Mistakes and How to Avoid Them

Rate this book
Spot errors in your Go code you didn’t even know you were making and boost your productivity by avoiding common mistakes and pitfalls.

100 Go Mistakes and How to Avoid Them introduces dozens of techniques for writing idiomatic, expressive, and efficient Go code that avoids common pitfalls. By reviewing dozens of interesting, readable examples and real-world case studies, you’ll explore mistakes that even experienced Go programmers make. This book is focused on pure Go code, with standards you can apply to any kind of project.

As you go, you’ll navigate the tricky bits of handling JSON data and HTTP services, discover best practices for Go code organization, and learn how to use slices efficiently. Your code speed and quality will enjoy a huge boost when you improve your concurrency skills, deal with error management idiomatically, and increase the quality of your tests.

384 pages, ebook

Published October 4, 2022

151 people are currently reading
524 people want to read

About the author

Teiva Harsanyi

1 book20 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
157 (70%)
4 stars
58 (26%)
3 stars
8 (3%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 30 of 39 reviews
Profile Image for Mike Fowler.
207 reviews9 followers
January 25, 2023
I thoroughly enjoyed reading this book. While I have been writing Go for 6 years, I was pleased to learn a fair amount. Some of the mistakes I have made and found similar solutions for and I smiled knowingly as I read them. Other mistakes I still make not realising they were mistakes at all. The reader most likely to benefit from this is someone who has some familiarity with Go but I do think it will make a good teaching tool to help avoid many problems.

My only complaint is that each mistake closed with a paragraph introducing the next mistake. After the first few mistakes I simply skipped these paragraphs, I can read the heading instead.
6 reviews
March 7, 2024
The book is outstanding, particularly the well-crafted examples for each topic. The explanation of Concurrency, a challenging subject for me, is brilliantly done – a true work of genius. The conclusion on CPU caching and optimization is both satisfying and enlightening. Overall, a great resource. Thanks, @Teiva Harsanyi, for this excellent work!
This entire review has been hidden because of spoilers.
Profile Image for Dinko.
25 reviews
July 5, 2023
While this isn’t really a type of the book to read from cover to cover in one pass, it is really a treasure trove. Hundreds of Golang code recommendations and typical issues, really well explained and reasoned. I cannot recommend this book enough, it’s a gold mine that you will be returning to.
Profile Image for Kris.
250 reviews14 followers
December 18, 2022
This book made me realise that Go is not a simple language even if it’s sold as one.

In a buch of places I was surprised as how bad it was. Leaky abstractions were the most common one.

I disagree with table testing - it’s a bad idea and it shouldn’t be promoted.

Also turns out that there is a lot of similarities to JavaScript.
1. floats use the same standard
2. closures and asynchronous code lead to the same bugs

For range seems good only for the string iteration.
Slices easily leak memory.
Arrays are useless - this one is mostly because they were barely mentioned.

There is a lot I learned from this book in a more positive light. I more appreciate defer and finally understand how to properly handle errors there.

Chapters about flags like -race, mechanical sympathy, profiling and default clients among other things were incredible.

I can recommend it if you like Go - you will learn how to avoid shooting yourself in the foot.
I can recommend it if you don’t like Go - you will learn a lot about bad parts of this language.

Overall it’s worth reading.
Profile Image for Maria Ines.
65 reviews10 followers
November 27, 2023
Oh my god I had to physically stop myself from checking our Go codebase at the end of each chapter. I'm pretty sure we are making some of the mistakes mentioned :( we have parallel tests written but we aren't setting the -parallel flag! We are mis-using time.After! We return interfaces! We probably have defers inside for loops! Aaaaghhhhh

This was a fun, informative read! My only nitpick is that it would be nice if the code were printed with color for an easier read, but that would make the book expensive 😅
1 review
May 8, 2024
This book is written brilliantly. Coming from an OOP background and having used mostly C#, I felt like a fish out of water when it came to programming with Go until I read this book. Syntax is easy enough to pick up but understanding the nuances and reasoning behind a language is what inspires competence in that language. This book provided the breadth and depth required to make me confident in Go. I read it cover to cover and really enjoyed reflecting on my progress every so often as there is so much insight in this book. I also found myself bringing it to work everyday as I would frequently go back and reference certain bits. This book is so clear. It can be easy to be intimidated by books as technical as this one but after the first few ‘mistakes’ I began to really trust that the author would guide me through the content in a way that kept me engaged. I especially loved the summaries of the main messages after each ‘mistake’.
7 reviews
April 3, 2023
I like concept of this book. Small chapters, they're explaining some common concepts the Go developers are using. Very easy to read. I think this is not an entry book to Go language. The book is great for all people who did own mistakes with Go :)
Profile Image for Christoph Kappel.
463 reviews9 followers
October 16, 2023
This is a really good read and a highly recommended source of information, if you want to quick dive into golang and refresh your knowledge about some internals and idioms of the language.

It is also a recommended book for veterans - I had some funny discussions about e.g. the behavior of slices with other developers.
17 reviews
February 22, 2023
Although Go is coined as a simple language to learn, it still has pitfalls and tricks that developers should know beforehand to write performant and elegant code. This book presents exactly that in a highly organised and coherent manner.
Profile Image for Lucy  Batson.
468 reviews9 followers
November 2, 2022
A sweeping read that covers lots of gotchas and finer points of Golang that aren't featured in the docs. Everything from basic tips on strings and structs to exhaustive breakdowns of how certain architectural decisions affect memory and caching on a machine level is included here. This seems like it should absolutely belong on the shelf of every Go dev.
43 reviews
January 2, 2023
I see other reviewers have already compared this book to `Effective Java`, with 100 Go Mistakes being the equivalent book for the Go community. I think this is a totally fair comparison, and I found the book to be very practically useful. I would recommend this book to anyone who either works professionally with Go or has the aspiration to do so. Though I have worked through all 100 mistakes, I will be sure to dive back in from time to time - when dealing with the various topics touched upon by the book.
Profile Image for Krystian.
11 reviews
December 28, 2022
This is an exceptional book. Usually, if a book contains either high-quality explanations or is written succinctly, I consider myself lucky to have found it. This one combines these two characteristics, which is super rare. It's another Go book for me and I still had quite a lot of "a-ha!" moments while reading it, and all of that without the unnecessary fluff, just straight to the point.
Profile Image for Adam Wan.
17 reviews2 followers
January 17, 2023
I am one of the reviewers of this book. I love this book very much.
It is one of the few books in Golang explaining the language in a variety aspect.
This is more like a cookbook that you can understand the language bit by bit.
3 reviews
March 20, 2022
Really useful book which has helped me two times at my job! Sometimes boring
1 review
October 13, 2022
Great book! For a newcomer in Go like me - very valuable lessons.
Not only that you should do certain things Go way, but WHY as well
Profile Image for Alain O'Dea.
15 reviews
March 29, 2024
Excellent walkthrough of Go programming mistakes. I like the author's approach of going from conceptually simple and easy to grasp mistakes at the beginning of the boom to truly expert and advanced computer science concepts-based mistakes at the end of the book. This makes the book usable and consumable by a broad variety of practioners at different levels of experience and expertise. Novices and journeypeople will get huge actionable value from the first 4-6 chapters. Intermediate folks will get a lot from 7-10. Chapters 11 and 12 are definitely advanced to expert topics (at least from my perspective). Chapter 12 is particularly deep on mechanical sympathy and other deeper optimizations.

The biggest insights for me personally were in the semantics of variable sharing in loops and how to use errgroup.

A deeply satisfying read. I feel far better informed about Go programming after reading this.
Profile Image for Yifan Yang.
45 reviews7 followers
September 10, 2024
Overall, this is a good book on Go, covering important internal concepts developers should know to avoid mistakes, like "#30: ignoring that elements are copied in range loops" and "#31: misunderstanding how arguments are evaluated in range loops." It also touches on idiomatic conventions, such as "#11" on the builder and functional options patterns.

However, some topics are too basic to be included, and most of the content in the final chapter on optimizations feels either too low-level(e.g. CPU instructions and caches) or lacks depth(e.g. GC and profiling). It seems the author stretched to fill "100 mistakes." Additionally, I find the use of "mistakes" in section titles unhelpful, as it makes reviewing the table of contents harder compared to clearer headings focused on best practices.
Profile Image for Serge.
7 reviews
January 1, 2024
Got it as part of the Manning Early Access Program , which was an excellent companion to my occasional nighttime reading. It came with the early online chapters, which proved to be an exciting read. Learning from the “how NOT to do things” types of materials is fun. At the end of 2022, this book is as current as it can get and is up-to-date with Go 1.19 examples. Not that a lot was added to the language itself — it’s just the recency and real-life context that fascinates me while reading it. I’m using this book now to get new engineers in my team to get up-to-speed with the ecosystem. You should probably also follow Teiva Harsanyi on Medium.

6 reviews1 follower
April 29, 2023
Overall, it was an easy book to read. I personally like blog posts and this book was like a 100 smaller blog posts. That made it simple to read from time to time.
For me, the book was more like 10-20 common mistakes and the rest was mostly useful tips on how to use the language. But I don't blame the author for choosing a more eye catching title.
The book would definitely won't be a replacement for reference Go book, but can be an interesting item in your list to refer back to.
Profile Image for Redowan Delowar.
46 reviews4 followers
March 10, 2024
If you're already somewhat familiar with Go syntax and don't want to pick up another book that will bore you to death by droning on about how to define variables, conditionals, or associative arrays, this book won't disappoint.

It's succinct and doesn't feel like a blog stretched into a book just for the sake of it. It taught me a few concurrency pitfalls of which I was previously unaware. Definitely a reference material. Highly recommended!
Profile Image for José  Córdova.
35 reviews1 follower
December 21, 2023
This is a wonderful book, despite there were a lot of complex example, it was proficient to understand them, IMHO this is not a beginner book, you need to get at least a mid knowledge of golang in order to get more reference by yourself.

I consider this book a reference guide in real situation, when you tackle different topics in golang, it is mandatory do a refresh and be aware.
Profile Image for Ivan Ivanov.
26 reviews
February 22, 2024
Great book!

A lot of the mistakes were interesting/useful to me, some were related to programming in general not Go, but still interesting/useful. I didn't enjoy reading about every mistake, but IMO this is expected - you can't read a book iterating over 100 different things and find all of them to be useful.
Profile Image for Vinicius Souza.
54 reviews2 followers
May 30, 2024
Best intermediate/advanced go book available in the market today. Highly recommend it. Just don't try to start programming in go through it. It requires some relevant knowledge and experience in the language. It's the only one I know that deals with topics like garbage collection, memory management (stack vs heap), profiling, coding best practices in general
36 reviews45 followers
August 29, 2024
I’ve made a lot of the mistakes mentioned in this book. I think it would have been helpful to make a list of the top 10 or 20 mistakes if the reader doesn’t want to go through all 100 - I think some of those were likely filler to get to exactly 100.

Regardless, one of the best books to take you from a more advanced practitioner of Go.
Profile Image for Novikov_Konstantin.
46 reviews
December 14, 2023
Солянка из хаков и известных проблем в Go. Можно прочесть, если junior/middle go developer. Любой из книги что-то новое достанет или хотя бы вспомнит забытое, но в целом будто бы полезнее подписаться на какой-нибудь канал Tips & Tricks in Go и читать по посту в день с очередным приколом.
Profile Image for Nick Belhomme.
114 reviews2 followers
January 13, 2024
Really a wealth of information.
This one is a keeper and I will be rereading certain chapters again and again.
I will have to because the information is too packed to remember it all at one go (pun intended)
Profile Image for Jonathan Yee.
5 reviews
March 9, 2024
Even as a non professional gopher (just a hobbyist) I've found this book very helpful with general hygiene as a developer. Sure some lessons are specific to Go but they are all gems. I'm 4 chapters in (12 in total) and I'm already confident to give my ratings for the book! Got so much off it.
Displaying 1 - 30 of 39 reviews

Can't find what you're looking for?

Get help and learn more about the design.