Hands-On System Programming with Go
上QQ阅读APP看书,第一时间看更新

Strengths and weaknesses

Go is a very opinionated language; some people love it while some people hate it, mostly due to some of its design choices. Some of the features that have not been well received are as follows:

  • Verbose error handling
  • Lack of generics
  • Missing dependency and version management

The first two points will be addressed with the next major version, while the latter was addressed by the community first (godep, glide, and govendor) and by Google itself with dep for the dependencies, and by gopkg.in (http://labix.org/gopkg.in) in terms of version management.

The strengths of the language are countless:

  • It's a statically typed language, with all the advantages that this brings, like static type checking.
  • It does not require an integrated development environment (IDE), even if it supports many of them.
  • The standard library is really impressive, and it could be the only dependency of many projects.
  • It has concurrency primitives (channels and goroutines), which hides the hardest parts of writing asynchronous code that are both efficient and safe.
  • It comes with a formatting tool, gofmt, that unifies the format of Go code, making other people's code look really familiar.
  • It produces binaries, with no dependencies, making deployments fast and easy.
  • It's minimalistic and has a few keywords, and the code is really easy to read and understand.
  • It's duck typed, with implicit interface definition (if it walks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck). This comes in very handy when testing a specific function of a system because it can be mocked.
  • It is cross platform, meaning that it's able to produce binaries for architecture and OS that are different from the hosting ones.
  • There are a huge amount of third-party packages and so it leaves very little behind in terms of functionality. Each package that's hosted on a public repository is indexed and searchable.