https://studygolang.com/articles/20219
在下载包时经常被墙,所以使用 gopm来实现下载。
gopm能实现对go的各种包管理,在国内有加速效果
go get -v -u github.com/gpmgo/gopm
在上述下载gopm时,发现会提示
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
package github.com/gpmgo/gopm: exit status 1
估计是最开始 上面下载vscode插件时,也把这个下载下来了,但是没有下载成功,然后在 $GOPATH/src/github.com/
下已经存在了 gopm
这个文件夹,现在只要 将它删除, 然后在该目录 使用git clone
git clone https://github.com/gpmgo/gopm.git
接下来 又会提示 一个什么Unknown的包也和刚刚的情况一样,于是只先进入$GOPATH/src/github.com/Unknwon
删除掉com目录,然后重新克隆
git clone https://github.com/unknwon/com.git
接下来再次
go get -v -u github.com/gpmgo/gopm
就能下载完所有包,然后可以看到在 $GOPATH/bin
中多了一个 gopm.exe
gopm help
发现提示 bash: gopm: command not found
应该是需要将其添加到环境变量中,我的解决方法有点暴力,我直接把gopm.exe复制到 $GOROOT/bin
下,然后就可以在任何地方使用了…
通过’gopm get -g xxx’,可以将指定的包下载到GOPATH下。(建议使用)
https://www.jianshu.com/p/db9e6ae0d227
https://www.jianshu.com/p/a7c3aeb0948d