github.com/zxy12/go_duplicate_112_new@v0.0.0-20200807091221-747231827200/src/cmd/go/testdata/script/mod_clean_cache.txt (about) 1 env GO111MODULE=on 2 3 # 'mod download' should download the module to the cache. 4 go mod download rsc.io/quote@v1.5.0 5 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info 6 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod 7 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip 8 9 # '-n' should print commands but not actually execute them. 10 go clean -modcache -n 11 stdout '^rm -rf .*pkg.mod$' 12 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info 13 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod 14 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip 15 16 # 'go clean -modcache' should actually delete the files. 17 go clean -modcache 18 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info 19 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod 20 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip 21 22 # 'go clean -r -modcache' should clean only the dependencies that are within the 23 # main module. 24 # BUG(golang.org/issue/28680): Today, it cleans across module boundaries. 25 cd r 26 exists ./test.out 27 exists ../replaced/test.out 28 go clean -r -modcache 29 ! exists ./test.out 30 ! exists ../replaced/test.out # BUG: should still exist 31 32 # 'go clean -modcache' should not download anything before cleaning. 33 # BUG(golang.org/issue/28680): Today, it does. 34 go mod edit -require rsc.io/quote@v1.99999999.0-not-a-real-version 35 ! go clean -modcache # BUG: should succeed 36 stderr 'finding rsc.io' # BUG: should not resolve module 37 go mod edit -droprequire rsc.io/quote 38 39 -- go.mod -- 40 module m 41 -- m.go -- 42 package m 43 44 -- r/go.mod -- 45 module example.com/r 46 require example.com/r/replaced v0.0.0 47 replace example.com/r/replaced => ../replaced 48 -- r/r.go -- 49 package r 50 import _ "example.com/r/replaced" 51 -- r/test.out -- 52 DELETE ME 53 54 -- replaced/go.mod -- 55 module example.com/r/replaced 56 -- replaced/replaced.go -- 57 package replaced 58 -- replaced/test.out -- 59 DO NOT DELETE