...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2env GOSUMDB=off
     3
     4go mod download example.com/join@v1.1.0
     5
     6# If the proxy serves a bogus result for the @latest version,
     7# reading that version should cause 'go get' to fail.
     8env GOPROXY=file:///$WORK/badproxy
     9cp go.mod.orig go.mod
    10! go get example.com/join/subpkg
    11stderr 'go: example.com/join/subpkg@v0.0.0-20190624000000-123456abcdef: .*'
    12
    13# If @v/list is empty, the 'go' command should still try to resolve
    14# other module paths.
    15env GOPROXY=file:///$WORK/emptysub
    16cp go.mod.orig go.mod
    17go get example.com/join/subpkg
    18go list -m example.com/join/...
    19! stdout 'example.com/join/subpkg'
    20stdout 'example.com/join v1.1.0'
    21
    22# If @v/list includes a version that the proxy does not actually serve,
    23# that version is treated as nonexistent.
    24env GOPROXY=file:///$WORK/notfound
    25cp go.mod.orig go.mod
    26go get example.com/join/subpkg
    27go list -m example.com/join/...
    28! stdout 'example.com/join/subpkg'
    29stdout 'example.com/join v1.1.0'
    30
    31# If the proxy provides an empty @v/list but rejects @latest with
    32# some other explicit error (for example, a "permission denied" error),
    33# that error should be reported to the user (and override a successful
    34# result for other possible module paths).
    35#
    36# Depending on how the specific platform enforces permissions, the 'go get' may
    37# fail either due to the intended permission error or due to a parse error.
    38# We accept either failure message.
    39env GOPROXY=file:///$WORK/gatekeeper
    40chmod 0000 $WORK/gatekeeper/example.com/join/subpkg/@latest
    41cp go.mod.orig go.mod
    42! go get example.com/join/subpkg
    43stderr 'go: module example.com/join/subpkg: (invalid response from proxy ".+": invalid character .+|reading file://.*/gatekeeper/example.com/join/subpkg/@latest: .+)'
    44
    45-- go.mod.orig --
    46module example.com/othermodule
    47go 1.13
    48-- $WORK/badproxy/example.com/join/subpkg/@v/list --
    49v0.0.0-20190624000000-123456abcdef
    50-- $WORK/badproxy/example.com/join/subpkg/@v/v0.0.0-20190624000000-123456abcdef.info --
    51This file is not valid JSON.
    52-- $WORK/badproxy/example.com/join/@v/list --
    53v1.1.0
    54-- $WORK/badproxy/example.com/join/@v/v1.1.0.info --
    55{"Version": "v1.1.0"}
    56-- $WORK/emptysub/example.com/join/subpkg/@v/list --
    57-- $WORK/emptysub/example.com/join/@v/list --
    58v1.1.0
    59-- $WORK/emptysub/example.com/join/@v/v1.1.0.info --
    60{"Version": "v1.1.0"}
    61-- $WORK/notfound/example.com/join/subpkg/@v/list --
    62v1.0.0-does-not-exist
    63-- $WORK/notfound/example.com/join/@v/list --
    64v1.1.0
    65-- $WORK/notfound/example.com/join/@v/v1.1.0.info --
    66{"Version": "v1.1.0"}
    67-- $WORK/gatekeeper/example.com/join/subpkg/@v/list --
    68-- $WORK/gatekeeper/example.com/join/subpkg/@latest --
    69ERROR: Latest version is forbidden.
    70-- $WORK/gatekeeper/example.com/join/@v/list --
    71v1.1.0
    72-- $WORK/gatekeeper/example.com/join/@v/v1.1.0.info --
    73{"Version": "v1.1.0"}

View as plain text