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

     1  [short] skip 'generates a vcstest git repo'
     2  [!git] skip
     3  
     4  mkdir $WORK/mod1
     5  mkdir $WORK/mod2
     6  env GONOSUMDB=vcs-test.golang.org
     7  
     8  env GOPROXY=direct
     9  env 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  
    15  go list -m -json vcs-test.golang.org/git/issue61415.git@latest
    16  cp stdout git-latest.json
    17  stdout '"Version": "v0.0.0-20231114180001-f213069baa68"'
    18  stdout '"Origin":'
    19  stdout '"VCS": "git"'
    20  stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    21  stdout '"Ref": "HEAD"'
    22  stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    23  
    24  go list -reuse=git-latest.json -m -json vcs-test.golang.org/git/issue61415.git@latest
    25  stdout '"Version": "v0.0.0-20231114180001-f213069baa68"'
    26  stdout '"Origin":'
    27  stdout '"VCS": "git"'
    28  stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    29  stdout '"Ref": "HEAD"'
    30  stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
    31  stdout '"Reuse": true'
    32  
    33  
    34  # Now we construct a filesystem-based module proxy that
    35  # contains only an older commit.
    36  
    37  go clean -modcache
    38  
    39  go mod download -json vcs-test.golang.org/git/issue61415.git@08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a
    40  stdout '"Version": "v0.0.0-20231114180000-08a4fa6bb9c0"'
    41  stdout '"Origin":'
    42  stdout '"VCS": "git"'
    43  stdout '"Hash": "08a4fa6bb9c04ffba03b26ae427b0d6335d90a2a"'
    44  
    45  [GOOS:windows] env GOPROXY=file:///$WORK/mod1/cache/download
    46  [!GOOS:windows] env GOPROXY=file://$WORK/mod1/cache/download
    47  env 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  
    57  go list -m -json vcs-test.golang.org/git/issue61415.git@latest
    58  cp stdout proxy-latest.json
    59  stdout '"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  
    65  go list -m -json vcs-test.golang.org/git/issue61415.git@v0.0.0-20231114180000-08a4fa6bb9c0
    66  cp stdout proxy-version.json
    67  stdout '"Version": "v0.0.0-20231114180000-08a4fa6bb9c0"'
    68  stdout '"Origin":'
    69  stdout '"VCS": "git"'
    70  stdout '"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  
    77  go list -reuse=proxy-version.json -m -json vcs-test.golang.org/git/issue61415.git@v0.0.0-20231114180000-08a4fa6bb9c0
    78  stdout '"Version": "v0.0.0-20231114180000-08a4fa6bb9c0"'
    79  stdout '"Origin":'
    80  stdout '"VCS": "git"'
    81  stdout '"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  
    91  env GOPROXY=direct
    92  
    93  go list -reuse=proxy-latest.json -m -json vcs-test.golang.org/git/issue61415.git@latest
    94  stdout '"Version": "v0.0.0-20231114180001-f213069baa68"'
    95  stdout '"Origin":'
    96  stdout '"VCS": "git"'
    97  stdout '"Hash": "f213069baa68ec26412fb373c7cf6669db1f8e69"'
    98  stdout '"Ref": "HEAD"'
    99  stdout '"TagSum": "t1:47DEQpj8HBSa\+/TImW\+5JCeuQeRkm5NMpJWZG3hSuFU="'
   100  ! stdout '"Reuse":'
   101  

View as plain text