Modules are the new way of doing dependency management in Golang.
A module is a collection of packages that are distributed together (e.g. a single binary). A module contains a
go.mod file at its root.
With modules, it is not necessary to have our code in
$GOPATH/src anymore, so we can create a project anywhere.
Let’s start a new project:
1 mkdir ~/project
And make it a module:
1 2 cd ~/project go mod init mymodule/hello