bash govendor 不能从 cmd 工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42155805/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
govendor doesn't work from cmd
提问by rjxby
I try to use govendor in my project folder /d/projects/go/src/github.com/user/dbot
我尝试在我的项目文件夹中使用 govendor /d/projects/go/src/github.com/user/dbot
govendor init
管理员初始化
but bash returns
但 bash 返回
bash: govendor: command not found
bash: govendor: 命令未找到
for installation I just follow instruction and use
安装我只需按照说明和使用
go get -u github.com/kardianos/govendor
there is something else about what I need to know
还有一些我需要知道的事情
$ go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\projects\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\VLADYS~1.KOC\AppData\Local\Temp\go-build082923582=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
回答by theeddieh
If all you are doing is:
如果您所做的只是:
go get -u github.com/kardianos/govendor
then that just installs the govendor
source files and dependencies.
From go help get
:
然后只安装govendor
源文件和依赖项。来自go help get
:
The -u flag instructs get to use the network to update the named
packages and their dependencies. By default, get uses the network
to check out missing packages but does not use it to look for updates
to existing packages.
Your error:
你的错误:
bash: govendor: command not found
comes from the fact that the govendor
binary is not under your PATH
.
来自govendor
二进制文件不在您的PATH
.
To fix this, first check that $GOPATH/bin
is in your PATH
, then run
要解决这个问题,首先检查它$GOPATH/bin
在你的 中PATH
,然后运行
go install github.com/kardianos/govendor
That will build govendor
and put under $GOBIN
(which by default is $GOPATH/bin
).
这将构建govendor
并放入$GOBIN
(默认情况下为$GOPATH/bin
)。
回答by ceoehis
As @theeddiehmentioned, it's because the $GOPATH/bin
is not in the $PATH
.
正如@theeddieh 所提到的,这是因为$GOPATH/bin
不在$PATH
.
Add the following to your .bash_profile
, then restart your terminal app.
将以下内容添加到您的.bash_profile
,然后重新启动您的终端应用程序。
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
Finally, run go get -u github.com/kardianos/govendor
to install. govendor
should now be available globally.
最后,运行go get -u github.com/kardianos/govendor
安装。govendor
现在应该可以在全球范围内使用。