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