github.com/zxy12/go_duplicate_112_new@v0.0.0-20200807091221-747231827200/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 of an invalid path should report the error
    12  ! go mod download this.domain.is.invalid/somemodule@v1.0.0
    13  stderr 'this.domain.is.invalid'
    14  ! go mod download -json this.domain.is.invalid/somemodule@v1.0.0
    15  stdout '"Error": ".*this.domain.is.invalid.*"'
    16  
    17  # download -json with version should print JSON
    18  go mod download -json 'rsc.io/quote@<=v1.5.0'
    19  stdout '^\t"Path": "rsc.io/quote"'
    20  stdout '^\t"Version": "v1.5.0"'
    21  stdout '^\t"Info": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.info"'
    22  stdout '^\t"GoMod": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.mod"'
    23  stdout '^\t"Zip": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.zip"'
    24  stdout '^\t"Sum": "h1:6fJa6E\+wGadANKkUMlZ0DhXFpoKlslOQDCo259XtdIE="'  # hash of testdata/mod version, not real version!
    25  stdout '^\t"GoModSum": "h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe\+TKr0="'
    26  ! stdout '"Error"'
    27  
    28  # download queries above should not have added to go.mod.
    29  go list -m all
    30  ! stdout rsc.io
    31  
    32  # add to go.mod so we can test non-query downloads
    33  go mod edit -require rsc.io/quote@v1.5.2
    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  # module loading will page in the info and mod files
    39  go list -m all
    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  
    44  # download will fetch and unpack the zip file
    45  go mod download
    46  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
    47  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
    48  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
    49  exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    50  
    51  # download repopulates deleted files and directories independently.
    52  rm $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
    53  go mod download
    54  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
    55  rm $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
    56  go mod download
    57  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
    58  rm $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
    59  go mod download
    60  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
    61  rm -r $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    62  go mod download
    63  exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    64  
    65  # download reports the locations of downloaded files
    66  go mod download -json
    67  stdout '^\t"Path": "rsc.io/quote"'
    68  stdout '^\t"Version": "v1.5.2"'
    69  stdout '^\t"Info": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.info"'
    70  stdout '^\t"GoMod": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.mod"'
    71  stdout '^\t"Zip": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.zip"'
    72  stdout '^\t"Dir": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)rsc.io(\\\\|/)quote@v1.5.2"'
    73  
    74  # download will follow replacements
    75  go mod edit -require rsc.io/quote@v1.5.1 -replace rsc.io/quote@v1.5.1=rsc.io/quote@v1.5.3-pre1
    76  go mod download
    77  ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.1.zip
    78  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip
    79  
    80  # download will not follow replacements for explicit module queries
    81  go mod download -json rsc.io/quote@v1.5.1
    82  exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.1.zip
    83  
    84  -- go.mod --
    85  module m