The first impression isn’t always right.

I’ve heard about Go for a pretty long time. I also tried reading some resources of Go, but I didn’t think the language was so attractive, because it seemed too low-level. I’ve been a big fan of high-level script languages such as JavaScript or Python. I’ve also enjoyed writing code in Scala, which is a high-level, functional and object-oriented language. When I saw that Go had no high-level API for array or string and no functional methods like map or reduce, but it had a pointer syntax, I thought it might not be a language for me.

I was completely wrong.

Last week, I decided to make a Markdown previewer, but didn’t want it to have dependency on Node, Python or any script language platform. I wanted it as a binary so that it could be used anywhere. So, I decided to go with Go. It turned out to be a big success. I read a great learning resource, called ‘Go by example’. And in a while, I found myself writing code in Go with great pleasure.

First of all, as I mentioned above, the language doesn’t have some features common in other high-level languages. However, it makes Go very concise and easy to learn. Furthermore, while I was writing Go code, I felt that I had no problem without these ‘high-level’ features. For example, array and maps are iterable with range. There’s len to get the length of them, which is the same with Python. All the functional tools I love were actually not so essential. Go doesn’t have a large grammar set, but provides a wide range of buildt-in packages including http, path and even time. You can just import them, and there you go. I could write everything I wanted with Go.

Secondly, the platform itself is awesome. We can install Go packages with go get command. They don’t necessarily need to be registered as a public package in some main package managers like npm, but can be installed from a GitHub repository. They are installed and managed only in $GOPATH, and we don’t need to care anywhere else. Go also has its own formatting tool, gofmt. It means we even don’t need to care about code convention. Go will do it for us.

Lastly, goroutine really gets rid of every concern needed to implement concurrency, and help developers to focus on interesting things. We don’t need to write a callback hell, don’t need to care if an API is blocking or non-blocking, and don’t even need to use another tool to defer a job thanks to built-in defer syntax. These advantages also help us to write modular code, which eventually makes it easy to write module tests and leads us to the right way to develop a program.

In conclusion, I once thought Go code was somewhat difficult to read and became reluctant to try it. But now I find everything in Go fascinating and surprisingly enjoyable. I was just wrong and should have given it a shot. If you’re considering using Go, please please try writing anything in it. I’m sure you’ll also find it fun.

One more thing, gopher is cute.

Gopher, the mascot character of Go