Commit 3b846961 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: Fix build to be robust to $GOBIN set from outside

Xavier Thompson reports that when Theia is compiled inside Theia, Go
fails to install with the error showing that golang14's make.bash calls
`go install` to install cmd/go and other commands to the outer
go.work/bin instead of inside $GOROOT_FINAL set by the build recipe.

Similarly to nexedi/slapos!928 this
might be to the fact that internal `go install` prioritizes $GOBIN even
in the presence of set $GOROOT_FINAL.

-> Don't try to fix Go itself, and make the compilation more robust by
unsetting $GOBIN, so that even if that variable is set in the
environment where buildout runs, it does not affect the compilation
procedure.

Fixes: 8eac67a5 (golang: Prepare for future GOPATH removal)
Reported-on: https://www.erp5.com/group_section/forum/Go-compilation-error-P6f5WisQkc
Tested-by: @xavier_thompson
Reviewed-on: nexedi/slapos!932
parent 3de38b60
...@@ -16,7 +16,7 @@ shared = true ...@@ -16,7 +16,7 @@ shared = true
configure-command = : configure-command = :
location = @@LOCATION@@ location = @@LOCATION@@
make-binary = make-binary =
make-targets= cd src && ./all.bash && cp -alf .. ${:location} make-targets= cd src && unset GOBIN && ./all.bash && cp -alf .. ${:location}
# some testdata files have an issue with slapos.extension.strip. # some testdata files have an issue with slapos.extension.strip.
post-install = ${findutils:location}/bin/find ${:location}/src -type d -name testdata -exec rm -rf {} \; || true post-install = ${findutils:location}/bin/find ${:location}/src -type d -name testdata -exec rm -rf {} \; || true
environment = environment =
...@@ -29,7 +29,7 @@ environment = ...@@ -29,7 +29,7 @@ environment =
url = https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz url = https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz
md5sum = dbf727a4b0e365bf88d97cbfde590016 md5sum = dbf727a4b0e365bf88d97cbfde590016
environment-extra = environment-extra =
make-targets= cd src && ./make.bash && cp -alf .. ${:location} make-targets= cd src && unset GOBIN && ./make.bash && cp -alf .. ${:location}
[golang1.12] [golang1.12]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment