@@ -137,6 +137,9 @@ dependencies, so it should be self-contained."
;; Using the current working directory as GOPATH makes it easier for packagers
;; who need to manipulate the unpacked source code.
(setenv "GOPATH" (string-append (getcwd) ":" (getenv "GOPATH")))
+ ;; Unconditionally set the -trimpath option to avoid spurious store references
+ ;; from having multiple GOPATH entries. See <https://bugs.gnu.org/33620>.
+ (setenv "GOFLAGS" "-trimpath")
;; Go 1.13 uses go modules by default. The go build system does not
;; currently support modules, so turn modules off to continue using the old
;; GOPATH behavior.
@@ -188,8 +191,6 @@ unpacking."
(apply invoke "go" "install"
"-v" ; print the name of packages as they are compiled
"-x" ; print each command as it is invoked
- ;; Trim store references from the compiled binaries.
- "-trimpath"
;; Respectively, strip the symbol table and debug
;; information, and the DWARF symbol table.
"-ldflags=-s -w"
@@ -202,6 +203,9 @@ unpacking."
;; Can this also install commands???
(define* (check #:key tests? import-path #:allow-other-keys)
"Run the tests for the package named by IMPORT-PATH."
+ ;; Remove the global -trimpath option because it can break some test
+ ;; suites.
+ (unsetenv "GOFLAGS")
(when tests?
(invoke "go" "test" import-path))
#t)