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

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

View as plain text