Problems with installing third-party packages

It’s not the first time that I’m installing a third party go packages via go get -u github.com/ ....
The problem is that after “installing” the program that the package is providing is not available.

For instance, the errcheck program. In my command-line, I run go get -u github.com/kisielk/errcheck and it’s done without a problem. But what then? How can I use the errcheck program in the command-line?

Another example is go-bindata.

I tried to find any script in the errcheck package that supposedly would be the program but there was nothing like that?

What can you suggest?

Thanks

Command go

Executables are installed in the directory named by the GOBIN environment variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH environment variable is not set.

Is your installation directory in your PATH environment variable?

image

Is there something wrong with my GOBIN path?

go env GOPATH/home/aram/go

go env GOBIN//home/aram/go/bin

What is your output from:

$ dir /home/aram/go/bin

$ which errcheck

$ env $PATH

  1. asmfmt go-bindata godoctor go-outline goreturns goxygen motion cobra go-callvis gogetdoc gopkgs go-symbols guru re dlv gocode goimports goplay got hello rice errcheck gocode-gomod golangci-lint gopls gotags iferr shadow fillstruct go-code-visualizer golint gops gotest impl staticcheck first_webapp godef gomodifytags gorename gotests keyify tour

  2. errcheck not found

  3. env: ‘/home/aram/.nvm/versions/node/v13.3.0/bin:/home/aram/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/bin:/usr/local/go/bin:/home/aram/.fzf/bin:/usr/local/go/bin:/home/aram/.local/bin’: No such file or directory

errcheck is in dir /home/aram/go/bin

/home/aram/go/bin is not in env $PATH.

I added export GOPATH="$HOME/go" PATH="$PATH:GOPATH/bin" to my ~/.zshrc.

Now my env $PATH looks like this:
env: ‘/home/aram/.nvm/versions/node/v13.3.0/bin:/home/aram/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/bin:/usr/local/go/bin:/home/aram/.fzf/bin:/usr/local/go/bin:/home/aram/.local/bin:GOPATH/bin’: No such file or directory

That didn’t work! You have GOPATH, not $GOPATH in your export statement`.

1 Like

I fixed it and it worked. Thanks.