Jump to ratings and reviews
Rate this book

Learning Go: An Idiomatic Approach to Real-World Go Programming

Rate this book
Go has rapidly become the preferred language for building web services. Plenty of tutorials are available to teach Go's syntax to developers with experience in other programming languages, but tutorials aren't enough. They don't teach Go's idioms, so developers end up recreating patterns that don't make sense in a Go context. This practical guide provides the essential background you need to write clear and idiomatic Go.

No matter your level of experience, you'll learn how to think like a Go developer. Author Jon Bodner introduces the design patterns experienced Go developers have adopted and explores the rationale for using them. This updated edition also shows you how Go's generics support fits into the language.

This book helps

Write idiomatic code in Go and design a Go projectUnderstand the reasons behind Go's design decisionsSet up a Go development environment for a solo developer or teamLearn how and when to use reflection, unsafe, and cgoDiscover how Go's features allow the language to run efficientlyKnow which Go features you should use sparingly or not at allUse Go's tools to improve performance, optimize memory usage, and reduce garbage collectionLearn how to use Go's advanced development tools

850 pages, Kindle Edition

Published January 10, 2024

354 people are currently reading
677 people want to read

About the author

Jon Bodner

1 book17 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
233 (53%)
4 stars
172 (39%)
3 stars
25 (5%)
2 stars
4 (<1%)
1 star
3 (<1%)
Displaying 1 - 30 of 58 reviews
Profile Image for Mohsen.
118 reviews26 followers
February 18, 2022
هدف کتاب همون‌طور که از عنوانش بر میاد اینه که چطور طبیعی و «فصیح» با گو کد بزنیم؛ (در مقابل این که عادت‌هامون از یه زبون دیگه رو وارد گو کنیم و صرفا سینتکس گو رو استفاده کنیم) برای رسیدن به این هدف، علاوه بر معرفی ویژگی‌های مختلف زبان، خیلی جاها فکر پشت طراحی اون ویژگی رو هم بررسی می‌کنه و خوبی‌ها و بدی‌هاش رو میگه. (حتی در فصل آخر، ژنریک‌ها که قراره در ورژن بعدی به زبان اضافه بشوند رو هم بررسی می‌کنه که به چه صورت اضافه میشن و چرا بعضی ویژگی‌های ژنریک تو بقیه زبان‌ها رو نداره) در نتیجه علاوه بر آشنایی با گو، از رویکرد مهندسی نرم‌افزار هم کتاب جالبیه. البته پیامد این رویکرد اینه که کتاب نسبتا پیشنیازهای زیادی میخواد و هرچند به آشنایی قبلی با زبان گو تقریبا نیاز نداره ولی به آشنایی خوبی با نرم‌افزار به صورت کلی می‌طلبه
Profile Image for Yuri Bilyk.
15 reviews1 follower
May 31, 2021
Would recommend this one over the classic one, as it gives much more insight on a way real programs are written. The explanations are clear and concise, without diving too deep into the details.

It will probably not teach you programming, but if you have couple of languages under your belt, you will not need more.
Profile Image for Diana Pojar.
162 reviews171 followers
December 20, 2021
Really good book for getting to know some of the GO fundamentals. This was part of a team bookclub and even the folks experienced in Go, still learnt a few new things, which is great. I also enjoyed some of the sprinkled humorous bits that were here and there.
Profile Image for Jeethu Rao.
8 reviews2 followers
September 23, 2021
This book is a good intro to golang for people who have prior experience with more than one programming languages. Or, for people like me, who've touched golang in the distant past, but have forgotten about it.
Profile Image for Max Wolffe.
231 reviews14 followers
July 21, 2021
This is a great introduction to Go for those with some existing programming experience.

Bodner covers the basics very quickly and then focuses on the aspects of Go which may be tricky to the target audience. I particularly appreciated the opinionated advice - from passing of arguments (e.g. should one use a pointer or a struct directly?), tooling (editor recommendations, 3rd party libraries, etc), to patterns for concurrency (done/cancel channels, when to use buffered channels, etc). These are patterns which are common in open source projects which I didn't fully grok the usage of before reading this book. I also appreciate just how up to date this book is (at time of reading in 2021), which is important for an ecosystem as fast moving as Go's.

My only complaints with the book are:
- There are no practice problems. This is an issue with a lot of O'Reilly books, but I find learning via doing much more effective than passively consuming the content. I appreciate that the examples used in the text are available for the reader to run themselves, but I do wish that there were just a handful of practice problems at the end of each chapter to help the reader test their knowledge. I'm coming from the other extreme of this (Functional Programming in Scala - https://www.goodreads.com/en/book/sho...) which almost certainly has too many exercises, so the absence here was particularly notable.
- Somewhat inconsistent use of Go Playground vs GitHub (This is mainly because some features are not supported on Go Playground - but I wish they'd just been consistent and put everything on GitHub)

Overall - strong recommend for folks new to Go.
Profile Image for Allisonperkel.
848 reviews39 followers
November 13, 2021
Easily one of the best books on how to think about writing software. You’ll also learn Go but really this book teaches you how to think.

Full disclosure, I work with author which is cool as I heard his voice in my head while I read this book.
Profile Image for Ieva Gr.
185 reviews33 followers
November 3, 2024
Why I read this book: I’ve been coding with Ruby for the past 5 years in my current job. Some time ago Go was chosen as the second official programming language in the company. Time finally came for me to do some coding with Go. But I’ve heard many Go developers complain about people new to the language writing some ugly and complex code. I wanted to avoid making the same mistakes. In the foreword of this book it literally says “This book is for a reader that wants to write Go code that looks like Go code”. So it seemed like exactly the book I needed.

What I liked about it
- The book is exactly what I was looking for - introduction to the programming language with explanations of what code is Go-like and why.
- The explanations were really good. If I couldn’t grasp what was being said from the text alone, the code snippets usually helped me to figure it out.
- It was the most interesting to read about all the under the hood stuff with pointers e.g. why passing a slice to a function behaves oddly: “Slice is implemented as a struct with 3 fields: length, capacity and a pointer to a block of memory. When a slice is passed to a function, a copy is made of those 3 fields. Changing the value of the slice changes the memory the pointer points to. Changing the capacity means that the pointer is now pointing to a new, bigger, block of memory. Changing the length of the slice within the available capacity still does not change the length value of the original slice - it is not able to see the change, even if it happened in the same memory location.”

What I disliked
These are not necessarily dislikes, but some limitations of the book (or maybe me in some cases):
- There were places that I found hard to grasp. Mostly concurrency and reflections. But that might have required a bit more effort than I was willing to put in.
- My focus and effort dwindled towards the last chapters. Which is unfortunate as they were more complex and most likely more useful.
- Only reading about the programming language is not enough to really learn it. I’ve heard that the second edition of the book has some exercises at the end of each chapter. That could be a pretty big improvement. I’m hoping to cover this gap in my knowledge by attending a few workshops.
- Since I read the first edition of the book, it only mentioned generics at the very last chapter as a newly added thing. Through the book there were quite a few places that emphasised something being done in a particular way because Go doesn’t have generics.

You can find a lengthier version of this review, with what I found written about the philosophy of Go, the features that seemed most interesting to me moving to this language from Ruby and etc on my blog
Profile Image for Vinicius Souza.
54 reviews2 followers
November 5, 2022
The best book on Go I've ever read. It is a very pleasant and fluid read. It brings all the "beginners" topics, like types, loops, structs, etc, and, also, more advanced topics, such as concurrency, memory management (the best explanation I've read for why not to use pointers everywhere) and tooling. Besides the Go language, it also teaches you some general programming concepts, like tests, concurrency issues and some web programming. If you are an experienced programmer and need to learn Go, this is the book for you.

It is good to mention that, for today, it is quite up to date, including even the recent generics feature.
Profile Image for Stephen.
Author 7 books16 followers
February 22, 2022
This was a good overview of how to write idiomatic go. I found it useful as a reference for things I needed to lookup and a good way to discover things that I didn’t realize were useful. While much of what’s here could be found in other sources (like the Effective Go site), Bodner’s approach is a good way to get started.
Profile Image for Matt.
Author 1 book25 followers
August 1, 2025
This is a solid book about Go. I learned a lot!
3 reviews
October 11, 2021
A great introduction to Go. You will get the most out of this book if you already have some prior experience with another programming language.
25 reviews2 followers
June 1, 2024
"Learning Go" by Jon Bodner is an exemplary guide for anyone looking to master the Go programming language, whether you're a seasoned developer or a newcomer to coding. Bodner’s extensive experience and clear understanding of Go shine through in this well-structured and highly informative book.

Content and Structure
The book is meticulously organized, starting with the basics and gradually delving into more complex topics. It begins with a comprehensive introduction to Go's syntax and core concepts, making it accessible for beginners. Each chapter builds upon the previous ones, ensuring a smooth learning curve. The progression from simple to advanced topics is logical and well-paced, which helps maintain the reader's interest and understanding.

Depth of Information
Bodner covers a wide range of topics, including:

Basic syntax and control structures
Data types and their applications
Functions, methods, and interfaces
Concurrency and parallelism
Error handling
Testing and debugging
Best practices and idiomatic Go
Each topic is explained with clarity and depth, supported by practical examples and exercises. The examples are particularly effective, as they are relevant and help reinforce the concepts discussed. Bodner's approach to explaining concurrency, a notoriously difficult subject, is especially commendable for its clarity and thoroughness.

Overall, "Learning Go" is a highly recommended read for its clarity, depth, and practical approach to teaching one of the most powerful and efficient programming languages today.

Profile Image for Chris Austin.
76 reviews10 followers
November 27, 2021
A very well planned introduction to Go that introduces topics in layers that build upon the earlier chapters, while also having some early hints to prep you for those subjects.

There are some aspects of the language that irritate me, but the author did an excellent job of presenting them with enough context that I can see why most of those choices were made (except the date format - pretty sure that one is just using annoyance as a mnemonic). It also made me question some of my assumptions about relative performance, e.g. cost of copying objects and adding to the stack vs cost of heap access.

The signal to noise ratio is also excellent, with no random filler added that I need to skim past (a pet peeve with many books).
Profile Image for Alex Gholamian.
2 reviews
March 24, 2022
I could say it was the best book I've read about the golang. Perfect for newbies and people who have some experience with the language. Covers most of corner cases which you wouldn't notice normally and wouldn't read or see somewhere else and you would find out facing a bug.
2 reviews
April 15, 2024
It's great, explains everything in small pice of code examples.
I can read and learn every section independent from other sections.
Profile Image for Iain Davis.
14 reviews1 follower
December 5, 2024
I got a lot of value out of this book. At least from this Go novice's point of view, it seems a worthy survey and overview of the language.

TL;DR: An effort to read (at least in a short time) but valuable for providing an overview of the main language and ecosystem concepts, and the ways Go makes different prioritizations than other languages (which are many).

I'm a professional web developer, working mostly in JavaScript/TypeScript and Java. I picked up this book both because I've run into a few Go services in my work and was curious, and also because another book I was reading provides examples written in Go, and I wanted to understand what was being demonstrated better (without any of the "I guess it's doing this..."). I didn't need especially deep knowledge in Go, so I skipped over some of the exercises toward the end of the book, and didnt' worry myself too much about not having a firm grasp of concurrency and reflection in Go. I mostly focusing on the language constructs, and then the testing library (which is oddly almost the last subject covered). If you are looking for some specific subdomain of go functionality (http support, concurrency, etc.) to expand on your existing Go skills, you would do well to find a book dedicated to those domains. But for a general overview, I do recommend this book.

I'd also like to see more examples at the end of each chapter. That's not a fault of this book in particular though, but of the industry, I think. I'd like to see more college-textbook sections with the same concept covered by multiple examples, and a few more stretching-your-learning type examples that prompt you to take the next step beyond what the chapter has explicitly described. I suppose all that takes expensive paper and ink, and O'Reilly has stockholders to please. I would love to see some supplementary examples online, though.

I did not find this book a joy to read. It was work, just by virtue of being as long as it was. Paginated for my little 10" tablet, at a font size that was comfortable for me, it ran to about 650 pages (570 or so, leaving out the backmatter). I think some of that could be helped by having more periodic exercises that let you step out of the "absorbing information" headspace and into the "building something" headspace. I definitely had "absorbing information" fatigue all through the latter chapters of the book. That said, I don't feel like there was much wasted space, and I do feel like the experience was valuable overall.

I also think this book could benefit from the inclusion of more diagrams. There are a few, but I think there could be many many more. I did some of my earliest programming training in C, and having diagrams really helped with the quick understanding of what was going on, especially when dealing with pointers (which are common between C and Go). I think the sections on concurrency and reflection also would benefit from the inclusion of visual explanations to augment, or even replace some sections of text.

I do not feel like I can run out and write complex Go systems after reading this book, but I think that's much too much to ask of any one book. What I can do is read and understand Go programs, and summarize the key ways the language differs from others (which I will be doing shortly on my developer blog at iaindavis.dev/blog), and that's a pretty good step, in just a couple of weeks. I think this book could be improved, but I do recommend it.
33 reviews
July 24, 2025
Solid readable introduction to the Go programming language, from a practical perspective.

The book assumes that you know how to program, so it doesn't need to teach you how to do basic tasks or explain the elementary concepts of what a variable it is. It instead assumes that you are somewhat proficient practitioner of some standard-ish programming language and want to learn how to use Go as a tool. Thus it focus heavily on the practicalities of the language, its tooling, and how to write idiomatic code that will be maintainable.

When theory or more more academic discussions help justify or elucidate the text they appear, but unlike some texts on programming, it isn't like 90% theoretical discourse with no practical examples.

Overall I think the writing is solid, and I did most of the end of chapter exercises, since they were relatively short and focused on reinforcing the concepts introduced, instead of being like a selection of problems for university course to be graded on.

My one major complaint, which moved this book from 5 to 4 stars for me, is that in some the later chapters, the ones of the standard library, contexts, etc, the text shifts from using somewhat contrived, but universal examples that don't really require external domain knowledge to really hitting on writing a web server server with Go, and assuming a lot of knowledge about how HTTP requests work and are handled.

I understand that this is a very good example for demonstrating a lot of Go's features, and realistically why many of them exist, but though I have a cursory knowledge of how HTTP works, I have never written an web server, nor do I have a particular interest in learning how one would to understand examples in a learn-a-language book.

My interest in Go comes from needing to maintain and expand an existing codebase of DevOps tooling that is written in Go (instead of something like Python), so my time would have been better spent on chapters getting into like the details of best practices for command line parsing, or working with external processes or file systems.

It was just kinda disappointing for the first 2/3s of the book to be broadly generally applicable to pivoting to some pretty domain specific examples, or more to the point discussing potentially general features in very domain specific terms. Like I have seen the use of contexts in non-web server code for passing around program state, it would have been nice to have the usage presented without the web server context baked into it.

I would have preferred to have some of these later chapters broken up into a language feature discussion, and then a more worked out example using domain specific terminology, so that as a reader it was more clear what was skippable for my situation. The frustration for me I think came from skimming these chapters and seeing that later on in them there was potentially useful information, so I needed to rewind, and read for context and make sure I didn't miss other relevant bits. Whereas earlier on it was more just a straight read everything approach.
Profile Image for Zahra Dashti.
437 reviews120 followers
May 31, 2025

کتاب Learning Go نوشته‌ی Jon Bodner یک راهنمای کاربردی و ساختارمند برای یادگیری زبان برنامه‌نویسی Go یا همان Golang است. برخلاف بسیاری از منابعی که صرفاً به آموزش syntax می‌پردازند، این کتاب تمرکز ویژه‌ای بر *idiomatic Go* و نحوه‌ی استفاده‌ی صحیح و مؤثر از زبان در پروژه‌های واقعی دارد.


این کتاب به‌ویژه برای برنامه‌نویسانی طراحی شده که پیش‌زمینه‌ای در سایر زبان‌های برنامه‌نویسی دارند (مانند Python، Java، یا C++) و به دنبال یادگیری زبان Go به شکل حرفه‌ای و کاربردی هستند. همچنین برای کسانی که می‌خواهند نه فقط قواعد زبان، بلکه best practices و design patterns مورد قبول جامعه‌ی Go را نیز بیاموزند، بسیار مناسب است.

نقاط قوت:
* تمرکز بر نوشتن *idiomatic Go* و نه صرفاً آموزش syntax
* ساختار آموزشی واضح و تدریجی
* مثال‌های عملی و کاربردی که قابل استفاده در پروژه‌های واقعی هستند
* آموزش مفصل مفاهیم *concurrency* و چالش‌های مرتبط با آن
* تطابق کامل با استانداردهای روز *Go community*

نقاط ضعف:
* ممکن است برای کسانی که هیچ تجربه‌ای در برنامه‌نویسی ندارند، سریع و چالش‌برانگیز باشد
* برخی فصل‌ها نیاز به دقت و تمرین زیاد دارند تا به‌خوبی درک شوند

با توجه به اینکه پیش‌زمینه‌ی برنامه‌نویسی در چند زبان دیگر را داشتم، این کتاب برای من دقیقاً همان چیزی بود که نیاز داشتم. برخلاف منابع مقدماتی که بیشتر به syntax می‌پردازند، Learning Go به من کمک کرد تا با تفکر بومی (idiomatic) زبان Go آشنا شوم و درک کنم که چگونه می‌توان از قدرت‌های واقعی این زبان—خصوصاً در زمینه‌ی *concurrency*، ساختار ساده اما قدرتمند و طراحی مینیمالیستی آن—به شکل مؤثر در پروژه‌ها استفاده کرد.

این کتاب باعث شد نه تنها Go را یاد بگیرم، بلکه آن را "درست" یاد بگیرم. به‌عنوان کسی که تجربه‌ی توسعه در زبان‌های دیگر را داشته‌ام، این سطح از عمق و دقت دقیقاً همان چیزی بود که باعث شد روند یادگیری سریع‌تر، مؤثرتر و لذت‌بخش‌تر باشد.

اگر شما هم سابقه‌ی برنامه‌نویسی در زبان‌های دیگر را دارید و قصد دارید به شکل حرفه‌ای با Go آشنا شوید، مطالعه‌ی این کتاب را به‌شدت توصیه می‌کنم.
1 review
May 23, 2022
This is a very good book for the beginner and who wanna has learning experience before. This book has easy to understand. It has vivid examples, with the tips, cautions. After 3 weeks of reading this book. I can apply some knowledge to my work. The knowledge is already updated (Into go ver 1.18), so it is built a very good foundation with the latest knowledge.
One more thing to note, this book has compared Go with other languages like Js, C/C++,... I found that very intesting.
However, this book only covers basic things, and only language only. So that the knowledge may be not applied instantly to work.
Profile Image for Raúl.
79 reviews6 followers
August 14, 2022
I've been programming in Go for the last year and a half, and I still learned things from this book. I'd say it's a pretty good resource if you want to go a bit beyond the Go documentation which is already pretty good. There are a couple of chapters that I found difficult to digest such as Concurrency, and Generics (which at the time of writing hadn't been released) which I skimmed through since I've seen better resources out there.

If you're a beginner in Go, I'd still recommend taking a look at this book. Especially if you're part of the O'Reilly platform since you'll find it available there.
Profile Image for Arthur.
1 review
February 10, 2024
As a programmer with a background in JavaScript, I found this book to be an incredibly useful starting point for diving into the Go programming language. It features a well-designed cover and introduces great basic examples that gradually increase in complexity. As the book progresses, some examples become quite challenging, more so than I initially anticipated. However, I still believe it's an excellent choice for beginners looking to get acquainted with Go. The key takeaway for me is the realization that mastering Go will require a lot of practice. Nonetheless, this book has laid a solid foundation for my journey into Go programming.
Profile Image for Yifan Yang.
45 reviews7 followers
August 30, 2024
This book does an excellent job of teaching the idiomatic way of using Go, just as it promises. I believe that learning a new language involves much more than just understanding its syntax. What's more important is grasping critical implementation details (such as the fact that interfaces in Go have both a value and a type, and that slices and maps are implemented with pointers behind the scenes), naming and structural conventions, widely accepted tools, and the idiomatic way of solving problems and more. Based on Go 1.22, the latest version at the time of my reading, this book covers nearly everything I wanted to know when learning a new language. Highly recommend it!
Profile Image for Anatolij Grigorjev.
39 reviews
November 8, 2024
A very useful book of modern Go fundamentals
Reading this helped me understand the common modern patterns for how the language is used and what problems it is good for solving
I was particularly happy with examples on how different language design decisions synergyze with each other for some aspects, gives a better understanding the language design as a whole (multiple returns + unused var compiler errors)
I was also happy with some straightforward low level explanation of how parts of the language actually work, adding the needed fundamentals
I recommend this to those wanting to get into using the Go language, a lot of useful examples that I see myself returning to later for reference
Profile Image for Alexandru Todea.
16 reviews1 follower
October 10, 2022
My second book on the topic. The big pro about this book is that author does not only share theory about the language but also highlights an idiomatic way of writing Go. My favourite part is the chapter on pointers, because it shares valuable insights on pointer passing performance, variables to take into consideration when it comes to decide between returning a pointer versus returning a value (counter-intuitively it is slower to share data by pointer dereferencing for data structures that are lower than 1 megabyte.). All in all good theoretical book.
Profile Image for Arun.
211 reviews66 followers
September 9, 2022
I recommend this as a good first book on golang for programmers who already have programming experience in other languages like Python/Ruby/Java/C++. My only gripe is in few places his sentence structure is so misplaced/confusing that I didn't understand his explanations even after multiple re-readings.

Backstory: I am not a big fan of golang but merely had to use it in anger at work. So I decided to learn it properly. This book covers all the details on how to write idiomatic golang which was my primary purpose of reading it.
Profile Image for Vasil Kolev.
1,131 reviews198 followers
June 29, 2025
A very good book on Go. Seems to have all the details needed, and, most importantly, stuff like "you can do this, but it's a bad idea and not done", so you don't start writing C in Go.

The language itself is weird in some regards. I kept asking myself "and why the hell did they decide to do it like this" multiple times (especially the implicit semicolon). Might help that the code is more uniform between different developers, but it's not necessary the best way to do it.
Profile Image for Arkadiusz Pajor.
2 reviews
July 16, 2022
Decent and helpful book, however the chapter about testing is poor. The author introduces all relevant built-in tools regarding testing, however his understanding of testing itself, in general, seems to be defective. The author mixes the terminology and doesn't know how to properly apply test doubles. Other than that - definitely worth reading!
Displaying 1 - 30 of 58 reviews

Can't find what you're looking for?

Get help and learn more about the design.