The tools need to be placed inside your Go workspace. The go workspace is a directory with a specific structure where Go expects you to put your source code. $GOPATH should point to this workspace directory, not to the Go binary. You can read more about $GOPATH here: go command - cmd/go - Go Packages
People usually set $GOPATH to $HOME/go. Then you must clone the tools into $GOPATH/src/github.com/mongodb/mongo-tools.
These are all Go conventions. We’re working on updating the readme to make this a bit clearer. We’ll also soon be migrating to go modules, which will allow you to keep the tools source code outside of the Go workspace if you wish.
By the way, is there a particular reason you’re building the tools yourself rather than downloading the pre-built binaries? I work on the tools, so I’m always interested in learning more about how people are using the tools.
Great to hear it’s working! Thanks for the info on your use case. Just make sure to always build from a version tag (e.g. git checkout 100.0.2). The master branch is unstable and could break at any time, but the version tags will always be stable.
You mentioned a similar requirement for building the server from source. I will reiterate my comment on that discussion since it also applies here:
It is fine if you prefer to build from source, but typically the motivation for doing so would be to make alterations or build for an unsupported platform. If security is a key concern, you should also keep up with the latest minor releases.