Skip to main content

Learning Go

Our team has recently been getting into the world of Go. We have worked with REST and Python for many years and broadening our understanding into other open source programming languages, including Go. Our technical team have been learning Go and it has given new perspectives when it comes to concurrency, performance optimization, static typing, tooling, web development, deployment, and community engagement. Here are some learnings we have had so far;

The need for speed.

Go is VERY fast. Build times are quick.

Remember pointers.

In Go, values are passed by copying when you pass them to functions or methods. Therefore, if you're writing a function that needs to modify the original value (mutate its state), you'll need to pass a pointer to that value as an argument. Checking pointers is something to remember (but not overly onerous).

Tracing.

The tracebacks when running locally leave a bit to be desired. Both Python and Rust have very good tracebacks that help the user.

Errors, errors everywhere.

Returning and checking errors all over the place is nice as it keeps you thinking about the errors. More explicit than hoping something will be uncovered and catch your attention.

Typing.

Coming from Python’s dynamic typing, Go’s static typing introduces a different approach to handling types and variables. The type system is quite nice, but I don’t like that you cannot have a generic struct with attributes, it only interfaces.

Build-in API support.

with routing is pretty decent and allows basic/small APIs to be created without any sort of framework or utilising generated code, however, you wouldn’t want to use JUST the built-in support for a large project.

Related Articles