我尝试dep ensure
在 Ubuntu 16.04 上运行该命令,但系统无法找到该命令。当我运行sudo apt install dep
或任何其他安装命令时,我总是在运行时收到此错误dep ensure
:
No command 'dep' found, did you mean:
Command 'dp' from package 'speech-tools' (universe)
Command 'iep' from package 'emboss' (universe)
Command 'dwp' from package 'binutils' (main)
Command 'dex' from package 'dex' (universe)
Command 'rep' from package 'rep' (universe)
Command 'delp' from package 'fp-utils-3.0.0' (universe)
Command 'xep' from package 'pvm-examples' (universe)
dep: command not found
有人告诉我我需要 Ubuntu 18 才能运行dep
,但我想知道如何在我当前的 Ubuntu 上安装它。谢谢。
答案1
答案2
Ubuntu 16.04上go-dep的安装及使用:
在里面创建bin
目录$GOPATH
cd $GOPATH
mkdir bin
现在下载编译后的dep
文件。
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
将dep
文件从$GOPATH/go/bin
复制到项目的根位置。
dep
使用命令执行文件
./dep [command]
dep
命令:
Usage: "dep [command]"
Commands:
init Set up a new Go project, or migrate an existing one
status Report the status of the project's dependencies
ensure Ensure a dependency is safely vendored in the project
version Show the dep version information
check Check if imports, Gopkg.toml, and Gopkg.lock are in sync
Examples:
dep init set up a new project
dep ensure install the project's dependencies
dep ensure -update update the locked versions of all dependencies
dep ensure -add github.com/pkg/errors add a dependency to the project
Use "dep help [command]" for more information about a command.
答案3
你可以将它放在你的 PATH 中
curl -LO https://raw.githubusercontent.com/golang/dep/master/install.sh
chmod 700 install.sh
./install.sh
chmod +x $GOPATH/bin/dep
sudo mv $GOPATH/bin/dep /usr/local/bin/
这样你就可以从任何地方调用它dep