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

     1  env GO111MODULE=on
     2  env GOPROXY=direct
     3  env GOSUMDB=off
     4  
     5  # Testing that a pseudo-version is based on the semantically-latest
     6  # prefixed tag in any commit that is a parent of the commit supplied
     7  # to 'go get', when using a repo with go.mod in a sub directory.
     8  
     9  [!net] skip
    10  [!exec:git] skip
    11  
    12  # For this test repository go.mod resides in sub/ (only):
    13  #  master is not tagged
    14  #  tag v0.2.0 is most recent tag before master
    15  #  tag sub/v0.0.10 is most recent tag before v0.2.0
    16  #
    17  # The pseudo-version is based on sub/v0.0.10, since v0.2.0 doesn't
    18  # contain the prefix.
    19  go get vcs-test.golang.org/git/prefixtagtests.git/sub
    20  go list -m all
    21  stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.10$'
    22  
    23  go get -u vcs-test.golang.org/git/prefixtagtests.git/sub@master
    24  go list -m all
    25  stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.11-0\.'
    26  
    27  -- go.mod --
    28  module x
    29  
    30  go 1.12
    31  -- x.go --
    32  package x
    33  
    34  import _ "vcs-test.golang.org/prefixtagtests.git/sub"
    35  -- gen_prefixtagtests.sh --
    36  #!/bin/bash
    37  
    38  # This is not part of the test.
    39  # Run this to generate and update the repository on vcs-test.golang.org.
    40  
    41  set -euo pipefail
    42  cd "$(dirname "$0")"
    43  rm -rf prefixtagtests
    44  mkdir prefixtagtests
    45  cd prefixtagtests
    46  
    47  git init
    48  mkdir sub
    49  echo module vcs-test.golang.org/git/prefixtagtests.git/sub >sub/go.mod
    50  echo package sub >sub/sub.go
    51  git add sub
    52  git commit -m 'create module sub'
    53  for i in v0.1.0 sub/v0.0.9 sub/v0.0.10 v0.2.0; do
    54    echo $i >status
    55    git add status
    56    git commit -m $i
    57    git tag $i
    58  done
    59  echo 'after last tag' >status
    60  git add status
    61  git commit -m 'after last tag'
    62  
    63  zip -r ../prefixtagtests.zip .
    64  gsutil cp ../prefixtagtests.zip gs://vcs-test/git/prefixtagtests.zip
    65  

View as plain text