6 Useful Go Frameworks in 2019

6 Useful Go Frameworks in 2019 image

The world needs more Go developers. The 2019 Stack Overflow Developer Survey showed that Go is the third-most-wanted programming language, after Python and JavaScript. That's why it shouldn't come as a surprise that Go developers are compensated highly. They have the second-highest salary globally ($80K) and the third-highest salary in the US ($136K).

Although Go is a relatively simple programming language, particularly when compared to its syntactically similar counterpart C, many complex open-source projects run on Go, from Docker to Terraform to Kubernetes.

Because of the increased need for Go developers and its popularity in big, open-source projects, developers have been wanting to extend the functionality of Go by building a good number of frameworks and libraries for it.

While the stdlib of Go is capable enough to create a production-ready microservice, and while many developers are in favor of using Go without any external libraries or frameworks, your project might require functionality that isn't baked into stdlib.

As such, here are 6 well-liked frameworks, as ranked by GitHub stars, that extend the functionality of Go.

labstack/echo (14K⭐)

Echo is a minimalist web framework that serves as an excellent compromise between stdlib + router and a full-stack web framework. It comes with extensible middleware, central HTTP error handling, and template rendering for any template engine.

Many developers seem to prefer Echo over Gin, the Go framework that currently has most GitHub stars (28K), because Echo has better documentation, a better router pattern matching, and a nicer HandlerFunc signature than Gin.

go-kit/kit (14K⭐)

Go Kit is the most popular toolkit for building microservices in Go. It aims to fill in the stdlib gaps for RPC safety, system observability, infrastructure integration, and program design.

Go Kit is lightly opinionated and designed for interoperability, so you can easily adapt it to your particular situation.

tsenart/vegeta (12K⭐)

Vegeta is an HTTP load testing tool and the number one library to use for Dragon Ball Z fans. In particular, it tests HTTP services with a constant request rate. Use it to find possible bottlenecks in your architecture.

gorilla/mux (9K⭐)

The Gorilla mux package is a URL router and dispatcher. It's not the most lightweight mux, but it's the most feature-rich one. It can match requests based on URL host, path, path prefix, schemes, header and query values, HTTP methods, and even on regex.

stretchr/testify (8K⭐)

The Go stdlib doesn't have assertions, because its developers believe that developers use them as a crutch to avoid thinking about proper error handling and reporting.

But you might think otherwise. That's where Testify comes in: it's a set of packages that allow you to write tests so your code behaves as intended. It includes easy assertions, mocking capabilities, and testing suite interfaces and functions.

jmoiron/sqlx (6K⭐)

Go has a great database/sql library, but it's not perfect. Querying, for example, is a manual process. SQLx is a library where you can marshal rows into structs (with embedded struct support), maps, and slices. It also has named parameter support, including prepared statements, and it helps Get and Select to go quickly from query to struct/slice.

However, SQLx is not an ORM, so you'll still spend some time writing repetitive code. If you want to use an ORM, you can use GORM. However, keep in mind that it's significantly slower than SQLx when it comes to querying.


There you go: six frameworks and libraries that extend the functionality of Go. If you want to explore other Go frameworks, you can find a whole list at avelino/awesome-go.

What about you? Which Go frameworks and libraries do you use?

KEEP MOVING FORWARD

Thomas De Moor / go