4

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
5
  • 2
    This sounds like an path issue. If you just installed go try restart your terminal. If that dosn't work try adding C:\Go\bin to your path. Feb 10, 2017 at 9:54
  • Restarted terminal and puted C:\Go\bin to my Path still not work for me.
    – rjxby
    Feb 10, 2017 at 10:13
  • You need to set $GOPATH/bin which is D:\projects\go\bin into your path. Feb 10, 2017 at 10:23
  • doesn't help - govendor: command not found
    – rjxby
    Feb 10, 2017 at 10:41
  • restart windows machine helped! thanks a lot!
    – rjxby
    Feb 10, 2017 at 11:41

3 Answers 3

7

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).

1
  • first do go get -u github.com/kardianos/govendor then do govendor init. that worked for me (go 1.15)
    – user12504785
    Aug 27, 2020 at 14:23
1

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.

2
  • i can't found govendor in whole disk files. but go get -u github.com/kardianos/govendor has been run
    – CS QGB
    Jul 30, 2022 at 9:15
  • in $GOPATH, there is only pkg directory, no bin directory,see my answser
    – CS QGB
    Jul 30, 2022 at 9:17
0
$ 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.