Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

govendor doesn't work from cmd

Tags:

bash

go

govendor

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
like image 940
rjxby Avatar asked Oct 18 '25 21:10

rjxby


2 Answers

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

like image 169
theeddieh Avatar answered Oct 21 '25 14:10

theeddieh


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.

like image 40
ceoehis Avatar answered Oct 21 '25 16:10

ceoehis