Skip to content

Instantly share code, notes, and snippets.

@abdullin
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdullin/271f22cea4ebbc18fa0b to your computer and use it in GitHub Desktop.
Save abdullin/271f22cea4ebbc18fa0b to your computer and use it in GitHub Desktop.

Go: The Good Parts

Go is a programming language initially developed by Google in 2007. It is a statically typed language with a simple syntax, resembling C or JavaScript. It features garbage collection, type safety and large standard library.

Go can be statically compiled into a single executable binary, which could target a large number of operating systems (from Linux and Windows to Plan 9) and processors (i386, amd64 and ARM).

Note
In HappyPancake project we found that Golang was a good fit for developing event-driven backend services. Other contenders included Scala, C#, Haskell and Erlang.

Good parts

  • Concise and simple syntax, easy to get started with.

  • Good facilities for writing concurrent programs that share state by communicating (goroutines and channels).

  • Good ecosystem for developing backend servers, all major drivers and libraries are available.

  • Decent integration story with native code.

  • Lightweight development stack with major IDE-like features provided by command-line tools (and available in different editors).

  • Unified formatting style for the language, provided by gofmt.

  • Compilation is fast even with large projects.

  • Go supports all major OSes and CPU architectures.

Not so good parts

  • You must set and tweak GOMAXPROCS variable for each program which needs parallel execution.

  • You can build web applications and native UIs with Golang, but ecosystem there is rather immature, if compared to the other platforms.

  • Debugging golang code is neither easy nor reliable.

  • Golang has prominent explicit error handling style; if followed blindly, it can turn code into a spaghetti of error checks.

  • Golang stores all dependencies as folders in GOPATH, e.g. abdullin/chk. Having a single global workspace makes things tricky, when you need to work with multiple versions of a library.

Note
This is the state of Golang at the moment of writing. Things will improve over time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment