github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_download_partial.txt (about)

     1  # Download a module
     2  go mod download -modcacherw rsc.io/quote
     3  exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
     4  
     5  # 'go mod verify' should fail if we delete a file.
     6  go mod verify
     7  rm $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.
    11  cp 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.
    15  go mod verify
    16  
    17  # 'go list' should not load packages from the directory.
    18  # NOTE: the message "directory $dir outside available modules" is reported
    19  # for directories not in the main module, active modules in the module cache,
    20  # or local replacements. In this case, the directory is in the right place,
    21  # but it's incomplete, so 'go list' acts as if it's not an active module.
    22  ! go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    23  stderr 'outside available modules'
    24  
    25  # 'go list -m' should not print the directory.
    26  go list -m -f '{{.Dir}}' rsc.io/quote
    27  ! stdout .
    28  
    29  # 'go mod download' should re-extract the module and remove the .partial file.
    30  go mod download -modcacherw rsc.io/quote
    31  ! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.partial
    32  exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
    33  
    34  # 'go list' should succeed.
    35  go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
    36  stdout '^rsc.io/quote$'
    37  
    38  # 'go list -m' should print the directory.
    39  go list -m -f '{{.Dir}}' rsc.io/quote
    40  stdout 'pkg[/\\]mod[/\\]rsc.io[/\\]quote@v1.5.2'
    41  
    42  # go mod verify should fail if we delete a file.
    43  go mod verify
    44  rm $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
    45  ! go mod verify
    46  
    47  -- go.mod --
    48  module m
    49  
    50  go 1.14
    51  
    52  require rsc.io/quote v1.5.2
    53  
    54  -- empty --