diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm index fc5ee39c8d..a6b9397d35 100644 --- a/guix/build/go-build-system.scm +++ b/guix/build/go-build-system.scm @@ -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 . + (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)