...

Text file src/cmd/go/testdata/script/build_nocache.txt

Documentation: cmd/go/testdata/script

     1env GO111MODULE=off
     2
     3# As of Go 1.12, the module cache is required.
     4
     5# If none of the variables we use to locate GOCACHE are set, the cache is off
     6# and we cannot build.
     7env GOCACHE=
     8env XDG_CACHE_HOME=
     9env HOME=
    10[GOOS:plan9] env home=
    11[GOOS:windows] env LocalAppData=
    12! go build -o triv triv.go
    13stderr 'build cache is required, but could not be located: GOCACHE is not defined and .*'
    14
    15# If GOCACHE is set but is not an absolute path, and we cannot build.
    16env GOCACHE=test
    17! go build -o triv triv.go
    18stderr 'build cache is required, but could not be located: GOCACHE is not an absolute path'
    19
    20# An explicit GOCACHE=off also disables builds.
    21env GOCACHE=off
    22! go build -o triv triv.go
    23stderr 'build cache is disabled by GOCACHE=off'
    24
    25# If GOCACHE is set to an unwritable directory, we should diagnose it as such.
    26[GOOS:windows] stop # Does not support unwritable directories.
    27[root] skip # Can write to unwritable directories.
    28
    29mkdir $WORK/unwritable/home
    30chmod 0555 $WORK/unwritable/home
    31[!GOOS:plan9] env HOME=$WORK/unwritable/home
    32[GOOS:plan9] env home=$WORK/unwritable/home
    33
    34env GOCACHE=$WORK/unwritable/home
    35! go build -o triv triv.go
    36stderr 'failed to initialize build cache.* permission denied'
    37
    38-- triv.go --
    39package main
    40func main() {}

View as plain text