...

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

Documentation: cmd/go/testdata/script

     1[short] skip 'generates a vcstest git repo'
     2[!git] skip
     3
     4mkdir $WORK/mod1
     5mkdir $WORK/mod2
     6env GONOSUMDB=vcs-test.golang.org
     7
     8env GOPROXY=direct
     9env GOMODCACHE=$WORK/mod1
    10
    11
    12# If we query a module version from a git repo, we expect its
    13# Origin data to be reusable.
    14
    15go list -m -json vcs-test.golang.org/git/issue61415.git@latest
    16cp stdout git-latest.json
    17stdout '"Version": "v0.0.0-20231114180001-f213069baa68"'
    18stdout '"Origin":'
    19stdout '"VCS": "git"'
    20stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    21stdout '"Ref": "HEAD"'
    22stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    23
    24go list -reuse=git-latest.json -m -json vcs-test.golang.org/git/issue61415.git@latest
    25stdout '"Version": "v0.0.0-20231114180001-f213069baa68"'
    26stdout '"Origin":'
    27stdout '"VCS": "git"'
    28stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    29stdout '"Ref": "HEAD"'
    30stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    31stdout '"Reuse": true'
    32
    33
    34# Now we construct a filesystem-based module proxy that
    35# contains only an older commit.
    36
    37go clean -modcache
    38
    39go mod download -json vcs-test.golang.org/git/issue61415.git@08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a
    40stdout '"Version": "v0.0.0-20231114180000-08a4fa6bb9c0"'
    41stdout '"Origin":'
    42stdout '"VCS": "git"'
    43stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
    44
    45[GOOS:windows] env GOPROXY=file:///$WORK/mod1/cache/download
    46[!GOOS:windows] env GOPROXY=file://$WORK/mod1/cache/download
    47env GOMODCACHE=$WORK/modcache2
    48
    49
    50# If we resolve the "latest" version query using a proxy,
    51# it is only going to have Git origin information about the one
    52# commit — not the other tags that would go into resolving
    53# the underlying version list.
    54# 'go list' should not emit the partial information,
    55# since it isn't enough to reconstruct the result.
    56
    57go list -m -json vcs-test.golang.org/git/issue61415.git@latest
    58cp stdout proxy-latest.json
    59stdout '"Version": "v0.0.0-20231114180000-08a4fa6bb9c0"'
    60! stdout '"Origin":'
    61
    62# However, if we list a specific, stable version, we should get
    63# whatever origin metadata the proxy has for the version.
    64
    65go list -m -json vcs-test.golang.org/git/issue61415.git@v0.0.0-20231114180000-08a4fa6bb9c0
    66cp stdout proxy-version.json
    67stdout '"Version": "v0.0.0-20231114180000-08a4fa6bb9c0"'
    68stdout '"Origin":'
    69stdout '"VCS": "git"'
    70stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
    71! stdout '"Ref":'
    72! stdout '"TagSum":'
    73
    74# The -reuse flag has no effect with a proxy, since the proxy can serve
    75# metadata about a given module version cheaply anyway.
    76
    77go list -reuse=proxy-version.json -m -json vcs-test.golang.org/git/issue61415.git@v0.0.0-20231114180000-08a4fa6bb9c0
    78stdout '"Version": "v0.0.0-20231114180000-08a4fa6bb9c0"'
    79stdout '"Origin":'
    80stdout '"VCS": "git"'
    81stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
    82! stdout '"Ref":'
    83! stdout '"TagSum":'
    84! stdout '"Reuse":'
    85
    86
    87# With GOPROXY=direct, the -reuse flag has an effect, but
    88# the Origin data from the proxy should not be sufficient
    89# for the proxy response to be reused.
    90
    91env GOPROXY=direct
    92
    93go list -reuse=proxy-latest.json -m -json vcs-test.golang.org/git/issue61415.git@latest
    94stdout '"Version": "v0.0.0-20231114180001-f213069baa68"'
    95stdout '"Origin":'
    96stdout '"VCS": "git"'
    97stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    98stdout '"Ref": "HEAD"'
    99stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
   100! stdout '"Reuse":'

View as plain text