5 Useful Golang Modules Developers Should Know in 2021.

These Go modules will save you a lot of time

Bryan Dijkhuizen
Nov 27, 2020 · 3 min read
two women analyzing computer code on a laptop
two women analyzing computer code on a laptop
By Christina Morillo on Pexels

Go is an incredibly powerful and versatile language for multiple purposes. It’s reliable, fast, and easy to use.

Golang has fantastic documentation. Go also is very easy to scale. Today, we look into the best Go modules to make working with Go even easier. So here’s a list of ten useful Go modules!

Gen

Gen is a tool that actually generates code for you, how handy? It’s intended to offer generics-like functionality on your types.

screenshot of Gen from GitHub
screenshot of Gen from GitHub
Gen — Github

Run the following command:

go get github.com/clipperhouse/gen

To use this module you first create a new Go project and define a type:

// +gen slice:"Where,Count,GroupBy[string]"
type MyType struct {}

And at the command line, simply type:

gen

You should see a new file, named mytype_slice.go.

Go Kit

Go Kit is a standard library for Go-related microservices. It offers support for specialized microservices.

screenshot of Go Kit from GitHub
screenshot of Go Kit from GitHub
Go Kit — Github

Run the following command:

go get github.com/go-kit/kit

We are going to create a new Go project and create a new model. We’re creating an article. Enter the following lines of code:

Now we need to create our service:

To get more information on how to implement this service, I recommend you visit Microservices with GoKit.

Fuzzy

Fuzzy is a Go library that provides fuzzy string matching optimized for filenames and code symbols.

screenshot of Fuzzy from GitHub
screenshot of Fuzzy from GitHub
Fuzzy — Github

Run the following command:

go get github.com/jroimartin/gocui

On the GitHub page of Fuzzy, this piece of example code has been given:

And for detailed documentation, see GoDoc.

Etcd

Etcd is a reliable distributed key-value store.

screenshot of Etcd from GitHub
screenshot of Etcd from GitHub
Etcd — Github

Run the following command:

go get github.com/etcd-io/etcd

Create client using clientv3.New:

For more information on how to use this somewhat more advanced module, you should check out the official docs.

Ginkgo

Ginkgo is a behaviour-driven development testing framework. It allows you to write your tests in a syntax that resembles the English language.

screenshot of Gingko from GitHub
screenshot of Gingko from GitHub
Ginkgo — Github

Run the following command:

go get github.com/onsi/ginkgo/ginkgo

Create a new Go project. For example, import the gomega package in your test code:

Conclusion

In this article, I hopefully have taught you a couple of new Go modules that you can use in your future projects. Of course, there are many more handy Go modules that you can use, but I found these the best at this moment. Enjoy exploring these Go modules!

Better Programming

Advice for programmers.

By Better Programming

A weekly newsletter sent every Friday with the best articles we published that week. Code tutorials, advice, career opportunities, and more! Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Bryan Dijkhuizen

Written by

Pursuing my Bachelor in Computer Science. Dutch parliament ambitions. Editor of Lessons From History — Evolve You — Political Sense and History in Context.

Better Programming

Advice for programmers.

Bryan Dijkhuizen

Written by

Pursuing my Bachelor in Computer Science. Dutch parliament ambitions. Editor of Lessons From History — Evolve You — Political Sense and History in Context.

Better Programming

Advice for programmers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store