Installing the Mux package is fairly simple. You need to run this command in the Terminal (Mac and Linux):
go get -u github.com/gorilla/mux
If you get any errors saying package github.com/gorilla/mux: cannot download, $GOPATH not set. For more details see--go help gopath, set the $GOPATH environment variable using the following command:
export GOPATH=~/go
As we discussed in the previous chapter, this says that all the packages and programs go into this directory. It has three folders: bin, pkg, and src. Now, add GOPATH to the PATH variable, to use the installed bin files as system utilities that have no ./executable style. Refer to the following command:
PATH="$GOPATH/bin:$PATH"
These settings stay until you turn off your machine. So, to make it a permanent change, add the preceding lines to your bash profile:
vi ~/.profile
(or)
vi ~/.zshrc
Now, we are ready to go. Assuming Gorilla Mux is installed, proceed to the basics.