mirror of
https://github.com/golang/go
synced 2024-11-17 05:54:46 -07:00
cmd/go/internal/clean: make 'go clean -testcache' a no-op if the cache directory is gone
Fixes #29100 Change-Id: I195191aad825266ab55d38addef9d662cfc72dff Reviewed-on: https://go-review.googlesource.com/c/go/+/212099 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
5481a97ab0
commit
a197c7bbf2
@ -178,10 +178,12 @@ func runClean(cmd *base.Command, args []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if _, statErr := os.Stat(dir); !os.IsNotExist(statErr) {
|
||||||
base.Errorf("go clean -testcache: %v", err)
|
base.Errorf("go clean -testcache: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if cleanModcache {
|
if cleanModcache {
|
||||||
if modfetch.PkgMod == "" {
|
if modfetch.PkgMod == "" {
|
||||||
|
@ -9,6 +9,13 @@ go clean -testcache
|
|||||||
go test x_test.go
|
go test x_test.go
|
||||||
! stdout 'cached'
|
! stdout 'cached'
|
||||||
|
|
||||||
|
# golang.org/issue/29100: 'go clean -testcache' should succeed
|
||||||
|
# if the cache directory doesn't exist at all.
|
||||||
|
# It should not write a testexpire.txt file, since there are no
|
||||||
|
# test results that need to be invalidated in the first place.
|
||||||
|
env GOCACHE=$WORK/nonexistent
|
||||||
|
go clean -testcache
|
||||||
|
! exists $WORK/nonexistent
|
||||||
|
|
||||||
-- x/x_test.go --
|
-- x/x_test.go --
|
||||||
package x_test
|
package x_test
|
||||||
|
Loading…
Reference in New Issue
Block a user