Go lang - how to install packages ⮐
Set GOPATH environment variable
Set the GOPATH variable which go
compiler uses to search for packages along with GOROOT
environment variable, which is generally the installation of go
Install Mercurial client
Download and install the mercurial client in your machine and set the environment variables for PATH.
If you are running Mac, you can use homebrew to install mercurial in seconds.
Run the go get
command
Lets install a package
This will create two packages
- src - contains the source files of the dependencies
- pkg - contains the compiled binary of the dependencies
Now the dependencies are installed in the folder and you can continue to build the program by go build