-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: clean -cache -n should not delete cache
Uses the `cfg.BuildN` flag to avoid deleting inside the `if cleanCache` block. Introduces a test in src/cmd/go/testdata/script. Fixes golang#39250 Change-Id: I857c441b1d7aa7c68cfd646d6833e6eaca5b18d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/235140 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
1 parent
b2ce393
commit c0e8e40
Showing
2 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# We're testing cache behavior, so start with a clean GOCACHE. | ||
env GOCACHE=$WORK/cache | ||
|
||
# Build something so that the cache gets populates | ||
go build main.go | ||
|
||
# Check that cache contains directories before running | ||
exists $GOCACHE/00 | ||
|
||
# Run go clean -cache -n and ensure that directories weren't deleted | ||
go clean -cache -n | ||
exists $GOCACHE/00 | ||
|
||
# Re-run go clean cache without the -n flag go ensure that directories were properly removed | ||
go clean -cache | ||
! exists $GOCACHE/00 | ||
|
||
-- main.go -- | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("hello!") | ||
} |