GNU bug report logs - #50227
[PATCH 0/3] go-build-system and GOPATH improvements

Previous Next

Package: guix-patches;

Reported by: Marius Bakke <marius <at> gnu.org>

Date: Fri, 27 Aug 2021 15:12:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Marius Bakke <marius <at> gnu.org>
To: 50227 <at> debbugs.gnu.org
Subject: [bug#50227] [PATCH 0/3] go-build-system and GOPATH improvements
Date: Fri, 27 Aug 2021 17:10:52 +0200
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
  $ MYGOPATH="$HOME/tmp/go"
  $ NAMESPACE="$MYGOPATH/src/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(-)

-- 
2.31.1





This bug report was last modified 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.