On my Mac, install.sh script doesn't support multiple directories in GOPATH. It gives an error saying the directory is not existed when more than one path are set in GOPATH.
I expect the install.sh takes the first directory in GOPATH and install it in [FIRST GOPATH DIR]/bin.
As a workaround, you can edit the install.sh at line 73 to:
GOBIN="${GOPATH%:*}/bin"
This will return the first path in your GOPATH and will be used to install dep.
If you are on Windows, the path separator is ; so you will need to change the bash string operator.
Thank you gerep.
Actually, a more easier workaround is temporarily change the GOPATH to the one I want to install it to, than change it back afterward.
I'm not looking for a workaround. I want it to be fixed permanently which will give others an easier life.
Try following command to install on Unix-like system:
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | GOBIN="${GOPATH%:*}/bin" sh
@rousan: I agree with @uynap . The workaround is easy, but is an unnecessary stumbling point for what is supposed to be a hands-off installation method. The convention of defaulting to the first path is established in other go tools.
While installing dep using install.sh script, there is an environment variable named INSTALL_DIRECTORY to set your custom installation directory, So for the platforms having multiple directories in GOPATH should do some manual efforts as follows:
$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | GOBIN="${GOPATH%%:*}/bin" sh
or edit the install.sh file like what @gerep said.
or set INSTALL_DIRECTORY environment variable like this:
$ INSTALL_DIRECTORY="${GOPATH%%:*}/bin" curl https://raw.githubusercontent.com/golang/dep/master/install.sh
So, I don't think this is a smart default. So need to be fixed this one,
And I'm working on this issue and will send PR ASAP.
Most helpful comment
Thank you gerep.
Actually, a more easier workaround is temporarily change the GOPATH to the one I want to install it to, than change it back afterward.
I'm not looking for a workaround. I want it to be fixed permanently which will give others an easier life.