Thoughts on Golang

Golang is a language made by Google back in 2009. It's widely used internally and outside. 2 years ago I built a large project using it. Now that I am working on it again, I've realized a few things.

Features

What you'll read everywhere is that:

  • it compiles extremely fast.
  • it is made for multi-threading. They are called subroutines, are much lighter-weight than regular threads, and much safer to use.
  • it is more readable and less prone to error than C.
  • it is cross-platform. It can compile and run on Linux, Mac and Windows.
  • it is easy to learn. It has much fewer keywords and constructs than other languages.

Thoughts

It does deliver on the promise of fast compilation and being cross-platform.

I am not so sure about being easy to learn. Its syntax is completely different from other languages. Since it is made to be simple, it also misses libraries that I would have expected to be there. Here's a list of basic things I have a hard time remembering.

Checking if a map contains an element:

if _, ok := dict["foo"]; ok {
    // Do something.
}

References

Since I keep forgetting how to do things in Golang, I've had to use those references: