GoVendor无法从CMD工作



我尝试在我的项目文件夹中使用 govendor /d/projects/go/src/github.com/user/dbot

govendor 初始化

但 Bash 回归

bash:govendor:找不到命令

对于安装,我只是按照说明和使用

go get -u github.com/kardianos/govendor

关于我需要知道的还有其他事情

$ go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:projectsgo
set GORACE=
set GOROOT=C:Go
set GOTOOLDIR=C:Gopkgtoolwindows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:UsersVLADYS~1.KOCAppDataLocalTempgo-build082923582=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1

如果你所做的只是:

go get -u github.com/kardianos/govendor

然后,这只是安装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.

您的错误:

bash: govendor: command not found

来自govendor二进制文件不在您的PATH之下的事实.

要解决此问题,请首先检查$GOPATH/bin是否在您的PATH中,然后运行

go install github.com/kardianos/govendor

这将构建govendor并置于$GOBIN之下(默认情况下为 $GOPATH/bin (。

正如@theeddieh提到的,这是因为$GOPATH/bin不在$PATH中。

将以下内容添加到您的.bash_profile,然后重新启动终端应用程序。

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

最后,运行go get -u github.com/kardianos/govendor进行安装。 govendor现在应该在全球范围内可用。

$ ls -alR /data/data/com.termux/files/home/go|grep vendor
drwx------  3 u0_a131 u0_a131 4096 Jul 30 17:02 govendor
/data/data/com.termux/files/home/go/pkg/mod/cache/download/github.com/kardianos/govendor:
/data/data/com.termux/files/home/go/pkg/mod/cache/download/github.com/kardianos/govendor/@v:
-rw-------  1 u0_a131 u0_a131  372 Jul 30 17:02 govendor@v1.0.9
dr-x------ 14 u0_a131 u0_a131 4096 Jul 30 17:02 govendor@v1.0.9
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9:
dr-x------  2 u0_a131 u0_a131 4096 Jul 30 17:02 vendor
dr-x------  2 u0_a131 u0_a131 4096 Jul 30 17:02 vendorfile
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/cliprompt:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/context:
-r--------  1 u0_a131 u0_a131  1691 Jul 30 17:02 vendorFile.go
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/doc:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/help:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/internal:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/internal/gt:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/internal/pathos:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/internal/vfilepath:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/internal/vos:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/migrate:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/pkgspec:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/prompt:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/run:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/vcs:
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/vendor:
-r--------  1 u0_a131 u0_a131 1494 Jul 30 17:02 vendor.json
/data/data/com.termux/files/home/go/pkg/mod/github.com/kardianos/govendor@v1.0.9/vendorfile:
-r--------  1 u0_a131 u0_a131 3475 Jul 30 17:02 vendor.go

相关内容

  • 没有找到相关文章

最新更新