golang/go

cmd/go: several commands require the build cache but don't use it

Offen

#39.882 geöffnet am 26.06.2020

 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Go (19.008 Forks)batch import
GoCommandNeedsFixhelp wanted

Repository-Metriken

Stars
 (133.883 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Steps to repro:

docker run -i golang:1.15beta1 <<-SCRIPT

        set -ex

        go version
        go env

        mkdir /tmp/foo
        cd /tmp/foo
        go mod init test
        go mod edit -go=1.13

        HOME= GOCACHE= go mod edit -go=1.14

SCRIPT

I think this should succeed. go mod edit -go=X only has to modify a line in go.mod, it shouldn't require the build cache to exist or be writeable. However, that last command fails:

+ go mod edit -go=1.14
build cache is required, but could not be located: GOCACHE is not defined and neither $XDG_CACHE_HOME nor $HOME are defined

I encountered this while writing some tests, which are run in a temporary directory with a near-empty environment (partly to not pollute the user's $HOME and such).

Contributor Guide