The Go track has been an incredibly positive experience for me. The exercises have given me essential practice while also helping me uncover my misunderstandings in a simple and safe environment.
Now it is time to go beyond the syntax to write better, more idiomatic, and maintainable code. What are your favorite resources for writing better Go code? The following are some of the resources that I have found helpful.
Go Code Review Comments
Uber Go Style Guide
What’s in a name?
Twelve Go Best Practices
A good place to go for better and more idiomatic and maintainable code might be right there in front of us. We can go back and revisit the exercises and have these goals as our specific aim!
I have had over 30 iterations of some exercises, focusing on different aspects. Some a bit loony, some reasonable and naive, some obfuscated, some idiomatic, some to explore a specific aspect of the language, etc.
Asking for mentoring and stating the specific goal can help the mentor be immediately aligned with your goals.
I am adding “Happy path is aligned to the left” from Matt Ryer’s “Idiomatic Go Tricks talk.”
Also Mat’s Medium article expanding on this topic.
A great blog post is also Digital Ocean: How to Add Extra Information to Errors in Go.
It’s a great overview of errors in Go, how to add more information to them and what is error wrapping. The brilliance of this blog post is that goes steps by step, explaining the simple forms first, their shortcomings, and improving incrementally. Good explanations on why you might want to use a particular way of handling errors or another.