...

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

Documentation: cmd/go/testdata/script

     1[short] skip 'generates a vcstest git repo'
     2[!git] skip
     3
     4env GOPROXY=direct
     5
     6# Control case: fetching a nested module at a tag that exists should
     7# emit Origin metadata for that tag and commit, and the origin should
     8# be reusable for that tag.
     9
    10go list -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@has-nested
    11cp stdout has-nested.json
    12stdout '"Origin":'
    13stdout '"VCS": "git"'
    14stdout '"URL":'  # randomly-chosen vcweb localhost URL
    15stdout '"Subdir": "nested"'
    16stdout '"TagPrefix": "nested/"'
    17stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    18stdout '"Ref": "refs/tags/has-nested"'
    19stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
    20
    21go list -reuse=has-nested.json -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@has-nested
    22stdout '"Origin":'
    23stdout '"VCS": "git"'
    24stdout '"URL":'  # randomly-chosen vcweb localhost URL
    25stdout '"Subdir": "nested"'
    26stdout '"TagPrefix": "nested/"'
    27stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    28stdout '"Ref": "refs/tags/has-nested"'
    29stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
    30stdout '"Reuse": true'
    31
    32
    33# Experiment case: if the nested module doesn't exist at "latest",
    34# the Origin metadata should include the ref that we tried to resolve
    35# (HEAD for a repo without version tags) and the hash to which it refers,
    36# so that changing the HEAD ref will invalidate the result.
    37
    38go list -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@latest
    39cp stdout no-nested.json
    40stdout '"Err": "module vcs-test.golang.org/git/issue61415.git/nested: no matching versions for query \\"latest\\""'
    41stdout '"URL":'  # randomly-chosen vcweb localhost URL
    42stdout '"Subdir": "nested"'
    43stdout '"TagPrefix": "nested/"'
    44stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    45
    46stdout '"Ref": "HEAD"'
    47stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    48
    49# The error result should be reusable.
    50
    51go list -reuse=no-nested.json -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@latest
    52
    53stdout '"Err": "module vcs-test.golang.org/git/issue61415.git/nested: no matching versions for query \\"latest\\""'
    54stdout '"URL":'  # randomly-chosen vcweb localhost URL
    55stdout '"Subdir": "nested"'
    56stdout '"TagPrefix": "nested/"'
    57stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    58stdout '"Ref": "HEAD"'
    59stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    60stdout '"Reuse": true'
    61
    62
    63# If the hash refers to some other commit instead, the
    64# result should not be reused.
    65
    66replace f213069baa68ec26412fb373c7cf6669db1f8e69 08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a no-nested.json
    67
    68go list -reuse=no-nested.json -json -m --versions -e vcs-test.golang.org/git/issue61415.git/nested@latest
    69stdout '"Err": "module vcs-test.golang.org/git/issue61415.git/nested: no matching versions for query \\"latest\\""'
    70stdout '"URL":'  # randomly-chosen vcweb localhost URL
    71stdout '"Subdir": "nested"'
    72stdout '"TagPrefix": "nested/"'
    73stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    74stdout '"Ref": "HEAD"'
    75stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    76! stdout '"Reuse"'

View as plain text