20 Go Packages You Can Use in Your Next Project
By: Fernando Souza
Tags: Curated Lists, Go, Software Engineering, Programming, Libraries

Golang-Set

An attempt to mimic the primary features of the set data structure from Python into Go. An example of the use:

You can know more about it here.

Go kit

It is a toolkit to implement microservices. It handles the basic about a distributed system, so you can focus on your business logic.

If you want to adopt a microservice architecture in your solution, “Go kit will help you structure and build out your services, avoid common pitfalls, and write code that grows with grace”.

Check out here.

GRequests

It is a Go “clone” of the famous Python requests library. You can easily do a HTTP request, upload/download a file, or serialize a response into JSON or XML.

If you have worked with Python, you will feel very comfortable using it.

Ws

The package ws implements a client and server for the WebSocket protocol. It has some nice features, such as zero-copy upgrade and low-level API in case you want to write your own logic.

You can know more about it here.

Email

A robust and flexible email library. It provides a more human interface to send emails using Go.

You can add attachments, send text / html messages, or add custom headers, in a very clear way.

You can know more about it here.

Gin

With more than 44k stars on Github, it is one of the most popular Go library. It is a web framework, and it focus on productivity and performance.

It has a lot of features, such as middleware customization, serving static files, handle multiple data formats, and HTML rendering.

If you want to develop an API or a Web application, you should definitely consider using Gin.

Fuzzy

Go library that provides a fuzzy string matching in the same style as Sublime, VSCode, etc.

It only depends on the Go standard library, and it is fast. It is a good choice if you want to add a search functionality to your application.

Github here.

Authboss

Authentication is a mandatory part of any modern web application. Creating all the necessary boilerplate can be cumbersome, and you can actually miss something.

This library aims to help you implement an authentication system, saving you time and avoid some mistakes that you might do.

Check the documentation here.

Uuid

This package provides a pure Go implementation of UUID, supporting both creation and parsing.

It supports from version 1 to 5, and it is simple to use.

More information here.

Gorm

If you are implement an API, there are good chances you will need to connect to a database. While you can do this by hand, using a ORM can save you a lot of time.

Gorm is a fantastic ORM library for Go. You can create models, associations, hooks, transactions, and a lot more nice features.

It is also a mandatory library if you want to work with a database.

Graphql

If you want to add support to GraphQL, then this is your package. It supports queries, mutations, and subscriptions.

Check the Github here.

Source here.

Ginkgo

One of the biggest complains of the community is the poor native Go testing packages.

Ginkgo extends standard testing package, allowing expressive BDD (Behavior-Driven Development) style tests.

Check the documentation here.

Errors

Outstanding library for error handling. The main feature is to handle the error identical to the official way, but with the addition of an annotation without losing the original error context (files and line numbers).

As stated in the documentation, the error handling becomes:

if err := SomeFunc(); err != nil {

return errors.Annotate(err, "more context")

}

This can save a lot of time during your development or even when trying to find that annoying bug.

Source here.

Cobra

It is both a library to create CLI programs as well as a program to help you create a well-structure application.

It has great features as nested commands, flags, intelligent suggestions, help generation, and more.

If you need to create a CLI program, cobra is the only tool you need.

Logrus

Another popular library for Go, Logrus is a structured logger that provides a comprehensive extension for the native logging package.

You can also add some hooks to be executed when a certain error level occurred.

Check the documentation to see how to use it.

Dateparse

With this library you can parse date strings without knowing the format. It reads the bytes and uses a state machine to find the correct format.

t, err := dateparse.ParseAny("3/1/2014")

Check the documentation for more examples.

Gonum

A set of numeric libraries for Go. It contains libraries for matrices, statistics, integration, differentiation, among others.

If you need to include some mathematics in your code, you have to use it. It saves you time and gives you a consistent scientific code.

Check the documentation for how to use.

Gopsutil

Another library that was inspired by a Python package. You can retrieve information about running process and system utilization on different platforms.

It is useful to monitor your system resources and processes.

Check the documentation here.

Source here.

Fyne

You can create a beautiful GUI application for desktop and mobile using the nice Fyne package.

It is based on Material Design, so it has nice features of usability, widgets, layouts, and it is designed to be easy to develop.

Check out the documentation.

Ants

A nice feature of the Go language is the concurrency support and the goroutines . But managing all the routines in an application can be really challenging.

The ants library implements a pool that manage and recycle a massive number of goroutines, automatically. It has nonblocking mechanisms and handle panic without crashing an application.

If you need to create an application that uses concurrency, you should definitely check this library out.