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