My experience with Golang
Lately Go has become one of the preferred languages to write systems applications, especially in the container world. My overall experience with the language has been great, albeit with hiccups.
Stuff I liked
- Speed!: Perfomance is one of the priorities for Go. It providies very efficient abstractions. You will love Go for the speed, especially if you are coming from say Python or Ruby.
- Easy to get started: Go comes with a small set of features. If you already have some programming experience, then A Tour of Go is great place to get acquainted to the language quickly.
- Easy to read: Readability is very important since developers spend more time reading code than writing it. This has always been the best thing about Python. Go fairs very well in this regard. All Go code is expected to be formatted using the bundled gofmt tool, which reformats your code very nicely. Also, Go avoids sigils in syntax, giving it a clean Python-ic feel.
- Fast compile times: Quick compilation was one of the priorities from Go's early days. This helps a lot while using go run, which compiles and runs your code. It's so fast, it sometimes feels like using an interpreted language. If you come from a Java world, you will definitely notice the difference.
- Static compilation: Go builds all your code into a single binary. This removes any hassles of dependency management for binary distributions. For source distribution though, it's a totally different story!
- Concurrency: This is hands down the best thing about Go. Go provides semantics - goroutines and channels, that make it a lot easier to write concurrent code. This style of concurrency is put into words aptly through one of the mottos of Golang - share by communicating. I've personally felt that the Go's channels are an easier to gawk abstraction for concurrency than the usual threads/pools.
The frustrating things
- Lacking goodies: Coming from Python, you will immediately notice the lack of rich semantics(and to some extent Python's awesome data structures) you are used to. This seems to be a deliberate choice mostly and can be dealt with some extra effort. But I really, really miss Python's in operator!
- Where is my debugger?: It's surprising that Go does not yet have an official debugger. In this day there is no good reason to not have a debugger!
- No generics: A static lanugage with no generics is certainly cumbersome. There are ways to get around this constraint, but hey, just gimme some generics yo!
- Imports, Dependencies & Build: The very, very frustrating thing about Go is certainly how dependencies and packages are handled. It's pretty bad! It made me seriously consider writing code in Go! Checkout this excellent presentation by @davecheney, where he goes into a lot more detail and also discusses his attempt to solve this problem using gb - the build tool he has created.