Why we switched to GoLang

Samuellaroche
3 min readFeb 13, 2022

--

Some time ago, one of our team leader at Cookit was ranting how great Go is. He’s the kind of guy always trying the latest frameworks and new tools. I was telling myself, “another shinny tech that we are not going to use”. 2 months, later, I was interviewing at Coinbase and found out they were using it quite a lot. I started reading and learning its basics realizing, this language is pretty cool! Our team first started a small POC for a use-case requiring high concurrency. In the span of 2 weeks, we became quite confortable writing decent code for production. This small project became a great success and allowed all the members of the team to learn Go rapidly. Fast forward to this moment, the team is writing all of the new micro-services in Go instead of Node.js and Spring boot.

What we’ve learned

Onboarding of new employees is a lot faster on Go projects. All of our developers had never coded a single line of Go before. Within a few weeks, most are able to learn the basics and code most features. All of our projects are built following the same architecture, which make it really easy to switch between one project to the other.

Hexagonal Architecture is the cleanest and most efficient way to organize our Go projects. Minimal boilerplate code and simple structure make it super efficient to add new features and modify existing ones. Most having worked with a Layered Architecture will find similarities which make it very easy to organise code.

You have to implement more yourself. In comparaison with a frameworks like Spring Boot where most of the use-cases have a module built-in, there is more you have to implement yourself. The upside is the this makes the code lighter, you only keep what you need. In comparaison with npm projects, they are less modules available. Some Go modules seem not being maintained as much as the most popular modules on NPM, which makes you doubt if you should use them or not.

Go is impressively light and fast. Most of our APIs barely use more than 50mb of RAM vs >300mb with Spring boot. Boot time is instant and CPU usage is minimal. All these performance are impressive but you have to implement your code wisely and make careful usage of pointers.

Error handling can be arduous. Sometimes you miss the ol' Try Catch. Errors get returned as values which is a change for most developers. You end up writing a LOT of

if err != nil {
// error handling ...
}

A lot of developers want to learn and work in Go, which makes recruiting a bit easier. Lately almost all developers I have interviewed told me how excited they would be to come work in a Go environment. It's true, coding in Go is fun. Much more tempting then coding the same old java.

Go is built for concurrency. Builtin syntax such as channels and goroutines are extremely useful and easy to use and understand.

Samuel Laroche, Director of Tech Infrastructure and Architecture @ Cookit
Linkedin
Web

--

--