...

Text file src/cmd/go/testdata/script/mod_download_partial.txt

Documentation: cmd/go/testdata/script

     1# Download modules and populate go.sum.
     2go get -modcacherw
     3exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
     4
     5# 'go mod verify' should fail if we delete a file.
     6go mod verify
     7rm $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
     8! go mod verify
     9
    10# Create a .partial file to simulate an failure extracting the zip file.
    11cp empty $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.partial
    12
    13# 'go mod verify' should not fail, since the module hasn't been completely
    14# ingested into the cache.
    15go mod verify
    16
    17# 'go list' should not load packages from the directory.
    18# NOTE: the message "directory $dir outside main module or its selected dependencies"
    19# is reported for directories not in the main module, active modules in the
    20# module cache, or local replacements. In this case, the directory is in the
    21# right place, but it's incomplete, so 'go list' acts as if it's not an
    22# active module.
    23! go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    24stderr 'outside main module or its selected dependencies'
    25
    26# 'go list -m' should not print the directory.
    27go list -m -f '{{.Dir}}' rsc.io/quote
    28! stdout .
    29
    30# 'go mod download' should re-extract the module and remove the .partial file.
    31go mod download -modcacherw rsc.io/quote
    32! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.partial
    33exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
    34
    35# 'go list' should succeed.
    36go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    37stdout '^rsc.io/quote$'
    38
    39# 'go list -m' should print the directory.
    40go list -m -f '{{.Dir}}' rsc.io/quote
    41stdout 'pkg[/\\]mod[/\\]rsc.io[/\\]quote@v1.5.2'
    42
    43# go mod verify should fail if we delete a file.
    44go mod verify
    45rm $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
    46! go mod verify
    47
    48# 'go mod download' should not leave behind a directory or a .partial file
    49# if there is an error extracting the zip file.
    50rm $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    51cp empty $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
    52! go mod download
    53stderr 'not a valid zip file'
    54! exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    55! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.partial
    56
    57-- go.mod --
    58module m
    59
    60go 1.14
    61
    62require rsc.io/quote v1.5.2
    63
    64-- use.go --
    65package use
    66
    67import _ "rsc.io/quote"
    68
    69-- empty --

View as plain text