Golang resources and tricks

It has been almost a month since I started learning the Go programming language. This is the first time in 20 years (I took courses on C and C++ at university but that knowledge is not in my brain anymore.) that I pick a static typed language and has learnt a lot.

Go is a really elegant language and whilst it comes with more boilerplates than other languages such as Python or Ruby it is very easy to get used to this new syntax.

I’d like share with you bits of my journey so newcomers might avoid some silly misunderstandings. Without further ado let’s get started.

Go Version

At time of writing this post I have learning Go with version 1.14. Why do I mention this you may ask? Most blogs, articles and videos I came across are pre < 1.13 and the way you setup your Go environment is different or at least different from the new suggested path that are Modules.

Prior to 1.13 you had to setup the Go workspace with a bunch of environment variables such as $GOPATH and had to save your packages following a predefined folder structure. You still can but with Go Modules you are now free to put your packages anywhere in your local drive.

With newest versions you just need donwload and install Go for your operating system and off you go. You may still want to setup of env variables such as $GOBIN etc.

So beware when reading blog posts suggesting this structure. By the way, there is nothing wrong (at least from my point of view) if you want to follow this “old” pattern, I just think one should embrace new developments.

Here is a great article regarding using Go Modules.

Learning Resources

In a previous post I mentioned that A tour of Go should be your first port of call when learning the language. I still think so, no worries if some concepts are difficult to grasp, I’ll give you links to more resources where you can reinforce these concepts.

Courses

I found Stephen Grider’s Go: The Complete Developer’s Guide (Golang) in Udemy of great help to clarify important concepts such as pass-by-value and pass-by-reference, receivers, concurrency and pointers. Unfortunately he doesn’t cover Modules and he does not answer questions on the forums anymore. I did not require any help from the forums so this did not affect me much.

Practice

Next step is finding exercise/projects that can help you practice the language. I came across Exercism.io where you can progress your learning through completing challenges. To pass to the next challange you need to submit your solution where a mentor will provide you feedback on your code (approval) or suggest different approach if he/she thinks there is a more efficient way.

I like the whole concept and went well initially, only slightly issue is that mentors may reply a few days later which can hinder your progress.

Another good resource is The Go Playground. Here you write Go code in the browser and can share it with the rest of world. It is quite handy when asking questions in StackOverflow, you can provide a working code so people can feedback on live code.

Last, but not least, there is Gophercises. A number of videos where Jon Calhoun shows how to tackle different problems. I haven’t used it myself but I read only good things about it.

Books

There are plenty of books out there, some free, some paid. Regardless of the Go version, the language itself still pretty similar among versions. But again beware of the version when suggesting installation and workspace configuration.

Here is a large list of books availables: Go Books

This is it! I hope you find useful all this information.

Until next post, Stay safe!!

Comments

comments powered by Disqus