Package Management and Go Modules

What are Go modules?

A module is a collection of packages that are released, versioned, and distributed together. In simple words, a Go module is a built-in dependency management system. It automates the downloads and updates of the package dependencies and even removes the ones no longer being used. It’s supported by Go 1.13 onward and manages third-party dependencies as well as local packages. 

So, what did we do before Go 1.13?

History of Go's dependency management

Go is a very new language, so its history isn't that long. But it's essential to have a look at it to understand why certain things happen the way they do in Go.

Package or dependency management is a nightmare in some languages, while others fare better. It's often the cause of a lot of bugs and frustration! It's especially annoying for someone who is new to the language and finds out that the error they spent the last three days debugging was actually due to a mismatched dependency.

So let's start at the very beginning!

The go get command

There was no proper dependency management system in Go before v1.11. The only way to fetch the dependencies was to use the command go get .

Get hands-on with 1200+ tech skills courses.