github.com/hikaru7719/go@v0.0.0-20181025140707-c8b2ac68906a/src/cmd/go/testdata/script/mod_download.txt (about) 1 env GO111MODULE=on 2 3 # download with version should print nothing 4 go mod download rsc.io/quote@v1.5.0 5 ! stdout . 6 7 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info 8 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod 9 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip 10 11 # download -json with version should print JSON 12 go mod download -json 'rsc.io/quote@<=v1.5.0' 13 stdout '^\t"Path": "rsc.io/quote"' 14 stdout '^\t"Version": "v1.5.0"' 15 stdout '^\t"Info": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.info"' 16 stdout '^\t"GoMod": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.mod"' 17 stdout '^\t"Zip": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.zip"' 18 stdout '^\t"Sum": "h1:6fJa6E\+wGadANKkUMlZ0DhXFpoKlslOQDCo259XtdIE="' # hash of testdata/mod version, not real version! 19 stdout '^\t"GoModSum": "h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe\+TKr0="' 20 ! stdout '"Error"' 21 22 # download queries above should not have added to go.mod. 23 go list -m all 24 ! stdout rsc.io 25 26 # add to go.mod so we can test non-query downloads 27 go mod edit -require rsc.io/quote@v1.5.2 28 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info 29 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod 30 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip 31 32 # module loading will page in the info and mod files 33 go list -m all 34 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info 35 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod 36 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip 37 38 # download will fetch and unpack the zip file 39 go mod download 40 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info 41 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod 42 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip 43 exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2 44 45 go mod download -json 46 stdout '^\t"Path": "rsc.io/quote"' 47 stdout '^\t"Version": "v1.5.2"' 48 stdout '^\t"Info": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.info"' 49 stdout '^\t"GoMod": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.mod"' 50 stdout '^\t"Zip": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.zip"' 51 stdout '^\t"Dir": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)rsc.io(\\\\|/)quote@v1.5.2"' 52 53 # download will follow replacements 54 go mod edit -require rsc.io/quote@v1.5.1 -replace rsc.io/quote@v1.5.1=rsc.io/quote@v1.5.3-pre1 55 go mod download 56 ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.1.zip 57 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip 58 59 # download will not follow replacements for explicit module queries 60 go mod download -json rsc.io/quote@v1.5.1 61 exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.1.zip 62 63 -- go.mod -- 64 module m