5 Useful Golang Modules Developers Should Know in 2021.

Share on facebook
Share on google
Share on twitter
Share on linkedin
These Go modules will save you a lot of time.

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
Gen — Github

Installing the module

Run the following command:

go get github.com/clipperhouse/gen

How to use it

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
Go Kit — Github

Installing the module

Run the following command:

go get github.com/go-kit/kit

How to use it

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:https://bryandijkhuizen.com/media/cf0881a38df42b4a0aa3aed1d99b63cf

Now we need to create our service:https://bryandijkhuizen.com/media/68bf5da5f7f973b600666f8b81de6e5e

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
Fuzzy — Github

Installing the module

Run the following command:

go get github.com/jroimartin/gocui

How to use it

On the GitHub page of Fuzzy, this piece of example code has been given:https://bryandijkhuizen.com/media/750a58c446f0674a0580d79b8eff7211

And for detailed documentation, see GoDoc.


Etcd

Etcd is a reliable distributed key-value store.

screenshot of Etcd from GitHub
Etcd — Github

Installing the module

Run the following command:

go get 

How to use it

Create client using clientv3.New:https://bryandijkhuizen.com/media/0222405b8e10ead65e6b3236e4bfa27b

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
Ginkgo — Github

Installing the module

Run the following command:

go get github.com/onsi/ginkgo/ginkgo

How to use it

Create a new Go project. For example, import the gomega package in your test code:https://bryandijkhuizen.com/media/db80bbac21fc86ff4551d0909611a6e5


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!

bryan@dijkhuizenmedia.com

bryan@dijkhuizenmedia.com

Leave a Replay

Sign up for our Newsletter

Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit