简体   繁体   中英

govendor doesn't work from cmd

I try to use govendor in my project folder /d/projects/go/src/github.com/user/dbot

govendor init

but bash returns

bash: govendor: command not found

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

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 :

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 .

To fix this, first check that $GOPATH/bin is in your PATH , then run

go install github.com/kardianos/govendor

That will build govendor and put under $GOBIN (which by default is $GOPATH/bin ).

As @theeddieh mentioned, it's because the $GOPATH/bin is not in the $PATH .

Add the following to your .bash_profile , then restart your terminal app.

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.

$ 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM