github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/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 # An explicit GOCACHE=off also disables builds. 14 env GOCACHE=off 15 ! go build -o triv triv.go 16 stderr 'build cache is disabled by GOCACHE=off' 17 18 # If GOCACHE is set to an unwritable directory, we should diagnose it as such. 19 [windows] stop # Does not support unwritable directories. 20 [root] skip # Can write to unwritable directories. 21 22 mkdir $WORK/unwritable/home 23 chmod 0555 $WORK/unwritable/home 24 [!plan9] env HOME=$WORK/unwritable/home 25 [plan9] env home=$WORK/unwritable/home 26 27 env GOCACHE=$WORK/unwritable/home 28 ! go build -o triv triv.go 29 stderr 'failed to initialize build cache.* permission denied' 30 31 -- triv.go -- 32 package main 33 func main() {}