These patches adjust the Go build system to use Guix's regular
native-search-paths mechanism instead of ad-hoc GOPATH trickery.
The context is that I needed to hack on a Go package, and was somewhat
surprised that my usual workflow of "guix environment PKG" did not work.
It still does not work "out of the box", but these patches bring it a
step further. Now "all" that is needed is to:
$ cd ~/src/go-foo
$ guix environment go-example-com-foo
$ mkdir -p $(dirname $NAMESPACE)
$ ln -s $PWD $NAMESPACE # or git worktree add $NAMESPACE
$ export GOPATH="$MYGOPATH:$GOPATH"
$ go build # no 'go get' necessary!
I don't know how feasible it is to avoid making a local directory and
symlinking the project to the expected namespace. Still a complete Go
newbie, but this approach feels more natural and idiomatic Guix-wise.
Marius Bakke (3):
build-system/go: Use a native-search-path for GOPATH.
gnu: hyperledger-fabric: Do not assume GOPATH contains a single entry.
gnu: go-gotest-tools-assert: Provide internal inputs with the source.
gnu/packages/golang.scm | 49 +++++++++++++++++++++++-----------
gnu/packages/hyperledger.scm | 6 ++++-
guix/build/go-build-system.scm | 37 +++----------------------
3 files changed, 43 insertions(+), 49 deletions(-)