This used to work okay-ish until Go 1.5. Then Go 1.6 introduced vendoring support (i.e. you put the code for the libraries you need into your own repo) which is very nice if it works, so I wanted to have it. But `go build` stubbornly refuses to look at vendored code when you are not in the exact correct location inside the GOPATH.
To preserve the familiar build semantics, I set up the GOPATH inside the repo. Roughly like this:
$ git clone https://github.com/foo/bar && cd bar
$ mkdir -p .gopath/src/github.com/foo
$ ln -sTf ../../../.. .gopath/src/github.com/foo/bar
$ GOPATH=$PWD/.gopath go build github.com/foo/bar
Of course, all that bullshit can be nicely tugged away in the Makefile. For example: https://github.com/sapcc/swift-drive-autopilot/blob/a3d5d02b...You can find this either hilarious or sad. I like the irony in using make(1) to patch up the deficiencies of a tool that was created decades after it.