go version)?$ go version go version go1.11.5 darwin/amd64
Yes
go env)?go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mmatthias/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mmatthias/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/yp/hpn6fn356nzfqkk0l319033c00kx44/T/go-build874912687=/tmp/go-build -gno-record-gcc-switches -fno-common"
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jbjbThe help output for the jb command
bash: jb: command not found
I got this to work by adding ~/go/bin to my $PATH.
Either the Mac installer should do this automatically, or there needs to be an update to the documentation https://golang.org/doc/install to note that to be able to install and run third-party go binaries, you'll need to add this directory to your $PATH.
I believe that is not a good idea. GOPATH can be set to things other than $HOME/go and installing Go should not be modifying user profile (I personally would not like anything that takes liberty of modifying my profile without asking me first).
Generally it is a trivial thing to do by yourself (by editing $HOME/.bash_profile). Also this is not specific for macOS (OSX is no more, btw). Go installation does not do this on any system (on Linux it depends on package maintainers if install from 3rd party repos).
See https://golang.org/doc/code.html#GOPATH, linked from https://golang.org/doc/install#testing:
Before rushing off to write Go code please read the How to Write Go Code document, which describes some essential concepts about using the Go tools.
Thanks. As @bcmills noted, this is properly documented, so I’m going to close this issue. If you’re not satisfied with this outcome, feel free to comment.
I don't understand how a comment in the article titled "How to Write Go Code" helps someone downloading and using a Go tool. If a user wants to be able to install packages via go get, then it's required that they're a Go developer and go through that tutorial too?
I think adding a sentence to the Go install documentation to talk about the GOPATH would be very helpful for people installing Go so they can use a Go binary via go get. As it stands, there isn't a clear way for someone to install Go and run go get and then be able to use the downloaded binary.
Edit: I agree with @akamensky that it's trivial to fix this from a user's perspective and it's probably not the best thing to automatically do during install, but this should be called out to the user via documentation or command output.
The thing I'm trying to call out here is how you do you address this flow for new Go people:
go get <pkg>Not saying you should be able to run pkg, just saying it should be clearer in documentation what is needed to be able to run pkg on a fresh install.
Hi, for what it's worth, I'm brand new to Go and have stumbled into this exact issue (whilst installing govendor) and ended up on this page when searching for a solution.
Most helpful comment
Hi, for what it's worth, I'm brand new to Go and have stumbled into this exact issue (whilst installing govendor) and ended up on this page when searching for a solution.