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