-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change encodes the current behavior in mod_clean_cache.txt. A fix for that behavior will probably have to wait for 1.13. Updates #28680 Change-Id: I216b5a783971309cc75187502bddccc58c3a9c35 Reviewed-on: https://go-review.googlesource.com/c/153818 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
- Loading branch information
Bryan C. Mills
committed
Dec 12, 2018
1 parent
cc8ae42
commit c4a8a68
Showing
1 changed file
with
38 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,59 @@ | ||
env GO111MODULE=on | ||
|
||
# 'mod download' should download the module to the cache. | ||
go mod download rsc.io/quote@v1.5.0 | ||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info | ||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod | ||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip | ||
|
||
# '-n' should print commands but not actually execute them. | ||
go clean -modcache -n | ||
stdout '^rm -rf .*pkg.mod$' | ||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info | ||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod | ||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip | ||
|
||
# 'go clean -modcache' should actually delete the files. | ||
go clean -modcache | ||
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info | ||
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod | ||
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip | ||
|
||
# 'go clean -r -modcache' should clean only the dependencies that are within the | ||
# main module. | ||
# BUG(golang.org/issue/28680): Today, it cleans across module boundaries. | ||
cd r | ||
exists ./test.out | ||
exists ../replaced/test.out | ||
go clean -r -modcache | ||
! exists ./test.out | ||
! exists ../replaced/test.out # BUG: should still exist | ||
|
||
# 'go clean -modcache' should not download anything before cleaning. | ||
# BUG(golang.org/issue/28680): Today, it does. | ||
go mod edit -require rsc.io/quote@v1.99999999.0-not-a-real-version | ||
! go clean -modcache # BUG: should succeed | ||
stderr 'finding rsc.io' # BUG: should not resolve module | ||
go mod edit -droprequire rsc.io/quote | ||
|
||
-- go.mod -- | ||
module m | ||
|
||
-- m.go -- | ||
package m | ||
package m | ||
|
||
-- r/go.mod -- | ||
module example.com/r | ||
require example.com/r/replaced v0.0.0 | ||
replace example.com/r/replaced => ../replaced | ||
-- r/r.go -- | ||
package r | ||
import _ "example.com/r/replaced" | ||
-- r/test.out -- | ||
DELETE ME | ||
|
||
-- replaced/go.mod -- | ||
module example.com/r/replaced | ||
-- replaced/replaced.go -- | ||
package replaced | ||
-- replaced/test.out -- | ||
DO NOT DELETE |