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