[PATCH] Adopt Go workspace best practices
Filippo Valsorda
filippo at ml.filippo.io
Sun May 20 20:57:02 CEST 2018
Relative imports break when the project is built from within GOPATH,
where most Go developers prefer to develop:
device.go:10:2: local import "./ratelimiter" in non-local package
tun_darwin.go:10:2: local import "./rwcancel" in non-local package
noise-protocol.go:10:2: local import "./tai64n" in non-local package
cookie.go:10:2: local import "./xchacha20poly1305" in non-local package
On the other hand, the vendor folder is not supported outside of
GOPATH, so it's unclear how/if that ever worked.
Moreover, using go get instead of dep means that dependencies are not
pinned, and HEAD is used instead, which makes builds unreproducible.
This adds a Makefile that creates a local GOPATH with a symlink
trick, so developing outside GOPATH still works. Not only that, but
a system GOPATH is not required at all as long as the Makefile is used.
And if the project is cloned in the right place in GOPATH all standard
tools will work as expected.
So all workflows should work just as weel or better. The only new
requirement is dep, but that's unavoidable for reproducible builds.
Finally, run goimports on all files to format import statements.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Adopt-Go-workspace-best-practices.patch
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20180520/3e215e78/attachment.ksh>
More information about the WireGuard
mailing list