guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Marius Bakke
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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]