Go has an amazing standard library; building web servers and working with JSON doesn’t require any 3rd-party code — but for complex applications, you’ll find yourself exploring 3rd-party packages. Many newcomers to Go frequently ask me which packages I most commonly use outside of the standard library — so here is my list!
Dep https://github.com/golang/dep will help you manage all of the packages you’re using — an appropriate first entry in my list :)
Don’t be put off by the words “official experiment” in its README. Dep is the best tool for your production-ready code right now. Modified BSD 3-Clause license.
Go Meta Linter https://github.com/alecthomas/gometalinter helps you run a huge number of linters that exist for Go — 17 by default, with an additional 12 available — and normalises their output to a standard format.
I find it best to disable all linters by default, then explicitly enable the ones you want. You can create a `.gometalinter.json` file at the root of your project so contributors to your project can easily run the same configuration as CI. MIT license.
YAML & TOML
For YAML: https://github.com/go-yaml/yaml is based on a Go port of the well-known libyaml C library, supports most of YAML 1.1 and 1.2, and is developed by Canonical as part of the juju project. Apache 2.0 license.
The standard library provides a generic interface around SQL databases, but you’ll need to choose a driver.
You might also want to consider https://github.com/jmoiron/sqlx which extends the standard database/sql interfaces and adds concepts such as named parameter support in prepared statements, and the ability to marshal rows into structs/maps/slices. MIT license.
For some reason, logging is a highly contentious topics in terms of Go package selection. Go already has a great built-in log package. Personally I’m a huge fan of structured logging, and I’m going to list two packages you should consider for that:
If you’re struggling to choose between these, I’d suggest go-kit/log.
If you’re coming from another programming language, you might be looking for a “framework” that can help you build-out web applications quickly, following best practices and using common conventions. Keep in mind “framework” might not be the right label for what you’re looking for in Go.
https://github.com/go-kit/kit is “a set of packages and best practices, which provide a comprehensive, robust, and trustable way of building microservices for organizations of any size”. I already linked to the log package above, but there’s a whole toolkit that you should check out if you’re building Microservices in Go. MIT license.
These are only a handful of awesome Go packages — there are many great packages out there, and the ecosystem is constantly evolving so I encourage you to continue evaluating the latest and greatest packages.