Commit 8eac67a5 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: Prepare for future GOPATH removal

GOPATH is going to be removed in Go1.17 (see e.g. https://github.com/golang/go/issues/37755#issuecomment-771879911).

-> Prevent programs suddenly become installed into $HOME/go/bin instead of
gowork/bin, and mod cache to become something like $HOME/go/... instead of
being kept under gowork/

No change in behaviour for Go ≤ 1.16
parent 79dbfe67
......@@ -142,7 +142,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/goenv.sh.in
output = ${gowork:directory}/env.sh
depends = ${gowork.mkdir:recipe}
md5sum = 09c229292b341da0de933f5900de7011
md5sum = 6efdf5d63381c240c7d206d7939a63f7
[gowork.mkdir]
# NOTE do not use slapos.cookbook:mkdirectory here - if anything in software (not instance)
......
......@@ -10,11 +10,14 @@ export PKG_CONFIG_PATH=$(echo -n "${gowork:cpkgpath}" |tr '\n' ':'):$PKG_CONFIG_
# ---- 8< ----
export GOPATH=$X:$GOPATH
export PATH=$X/bin:$PATH
export PS1="(`basename $X`) $PS1"
export GOBIN=$X/bin
export GOCACHE=$X/cache
export GOMODCACHE=$X/pkg/mod
export GOENV=$X/goenv
export PATH=$GOBIN:$PATH
export PS1="(`basename $X`) $PS1"
# by default make go run in module-aware mode only if go.mod is present, and in GOPATH-mode otherwise.
# (we still have some GOPATH uses; TODO -> default to "on" after GOPATH-mode usage is gone)
export GO111MODULE=auto
......
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