Golang is turning 10! To celebrate the occasion and to find out what are the main advantages of the language we talked with our colleague David Lubomirov. He is a Resilience Engineer at the SeatGeek team at Questers. His work consists of analysing system performance by building various load test scenarios and in case, the system shows a decrease in performance, he investigates its architecture, examines the code and proposes solutions for improvements. Read what he shared with us for his experience with Go.
When did you start using Golang and what was the first project you worked on with it?
I’ve started using Go a little more than a year ago. The first project I worked on started as a proof of concept. At that time, I was working as a Python developer and my team was responsible for maintaining a solution built by a number of microservices. One of the microservices was performing a lot of data transformation, and with time its dependencies were continuously growing. The computation was taking more and more time, and we had to find a way to lower the response time. Our research led us to two options: move the complex logic to C extension in Python - which is great pain, or re-write everything in Go.
Golang build process is extremely simple and we didn’t have to think about Makefiles or writing additional scripts to achieve the automation we already had in place for our CI/CD. So, we re-wrote the service with Go and the results were astonishing after just a couple of tests.
Upon having such great success with this “proof of concept” and by doing so, reducing the expenses on hardware, our company gave us green light to rewrite all other services with Golang.
What are the main advantages of the language?
The main advantage for me is that the language is compiled, thus it provides instant feedback on your work.
Creators of Go (Google geniuses) wanted something very powerful like C, but at the same time with greater simplicity and safety - and I think they’ve done an incredible job.
What’s the deal with the concurrency in Go?
Concurrency is extremely important nowadays and its inseparable part of every HTTP server. In Go, just like in other languages the libraries are simplifying your work when it comes to building a REST API used mainly as a transport layer. But even if you need to implement something more complex – for example REST API but with internal shared in-memory datastore that exchanges data with multiple services, you can do this with ease using goroutines and channels. In case you leave a big mess, the garbage collector will save your day).
There’s one thing I’d like to mention - colleagues coming from other languages tend to think that concurrency in Go is the well-known parallelism (yes, they are synonyms), but that is wrong, and I’ll try to explain the difference.
Concurrency (in Golang) is when you’re performing multiple things at once, but that doesn’t mean it’s happening at the same time. Parallelism is performing those things at once at the same time!
What are the most common traps of the language for developers coming from other languages?
Traps is a too strong concept. There’s always a learning curve with any programming language. It depends on the language from which you are transferring and the experience you have, but in general just by spending a couple of hours going over the Golang documentation should be more than enough to set you on the right path.
Image source: GitHub, MariaLetta