2 ms·
Here's my current pattern for Makefiles: https://github.com/sapcc/swift-drive-autopilot/blob/3eceb4e0b63732b962531ca1216c332f34395552/Makefile https://github.co
by majewsky 9y ago
Here's my current pattern for Makefiles: https://github.com/sapcc/swift-drive-autopilot/blob/3eceb4e0b63732b962531ca1216c332f34395552/Makefile https://github.com/sapcc/swift-drive-autopilot/blob/3eceb4e0...
It uses a private GOPATH inside the repo, created by:
$ cd /path/to/repo
$ mkdir -p .gopath/src/github.com/username
$ ln -s ../../../.. .gopath/src/github.com/username/projectname
With this you can run `go build` etc. with `GOPATH=/path/to/repo/.gopath` and it will work regardless of where the repo is checked out, and you can also `go get` the repo into the normal `GOPATH`.
It's the best of both worlds, in a way. A Go developer can use `go get` etc. and everything works as he expects. A distro packager can grab a release tarball, unpack it in some random place and do `make && make check && make install DESTDIR=/tmp/build` as she expects.