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

     1  # We're testing cache behavior, so start with a clean GOCACHE.
     2  env GOCACHE=$WORK/cache
     3  
     4  # Build something so that the cache gets populates
     5  go build main.go
     6  
     7  # Check that cache contains directories before running
     8  exists $GOCACHE/00
     9  
    10  # Run go clean -cache -n and ensure that directories weren't deleted
    11  go clean -cache -n
    12  exists $GOCACHE/00
    13  
    14  # Re-run go clean cache without the -n flag go ensure that directories were properly removed
    15  go clean -cache
    16  ! exists $GOCACHE/00
    17  
    18  ! go clean -cache .
    19  stderr 'go: clean -cache cannot be used with package arguments'
    20  
    21  # GOCACHE must be an absolute path.
    22  env GOCACHE=.
    23  ! go clean -cache
    24  stderr 'go: GOCACHE is not an absolute path'
    25  
    26  -- main.go --
    27  package main
    28  
    29  import "fmt"
    30  
    31  func main() {
    32  	fmt.Println("hello!")
    33  }
    34  

View as plain text