1 env GO111MODULE=off
2
3 # Integration test for cache directory calculation (cmd/go/internal/cache).
4
5 [windows] skip
6 [darwin] skip
7 [plan9] skip
8
9 mkdir $WORK/gocache
10 mkdir $WORK/xdg
11 mkdir $WORK/home
12
13 # Set GOCACHE, XDG_CACHE_HOME, and HOME.
14 env GOCACHE=$WORK/gocache
15 env XDG_CACHE_HOME=$WORK/xdg
16 env HOME=$WORK/home
17
18 # With all three set, we should prefer GOCACHE.
19 go env GOCACHE
20 stdout '\$WORK/gocache$'
21
22 # Without GOCACHE, we should prefer XDG_CACHE_HOME over HOME.
23 env GOCACHE=
24 go env GOCACHE
25 stdout '\$WORK/xdg/go-build$$'
26
27 # With only HOME set, we should use $HOME/.cache.
28 env XDG_CACHE_HOME=
29 go env GOCACHE
30 stdout '\$WORK/home/.cache/go-build$'
31
32 # With no guidance from the environment, we must disable the cache, but that
33 # should not cause commands that do not write to the cache to fail.
34 env HOME=
35 go env GOCACHE
36 stdout 'off'
37
View as plain text