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

     1  # Regression test for golang.org/issue/34254:
     2  # a clone of gopkg.in/[…].vN should be replaceable by
     3  # a fork hosted at corp.example.com/[…]/vN,
     4  # even if there is an explicit go.mod file containing the
     5  # gopkg.in path.
     6  
     7  [short] skip
     8  [!net] skip
     9  [!exec:git] skip
    10  
    11  env GO111MODULE=on
    12  env GOPROXY=direct
    13  env GOSUMDB=off
    14  env GOFLAGS=-mod=mod
    15  
    16  # Replacing gopkg.in/[…].vN with a repository with a root go.mod file
    17  # specifying […].vN and a compatible version should succeed, even if
    18  # the replacement path is not a gopkg.in path.
    19  cd 4-to-4
    20  go list -m gopkg.in/src-d/go-git.v4
    21  
    22  # Previous versions of the "go" command accepted v0 and v1 pseudo-versions
    23  # as replacements for gopkg.in/[…].v4.
    24  # As a special case, we continue to accept those.
    25  
    26  cd ../4-to-0
    27  go list -m gopkg.in/src-d/go-git.v4
    28  
    29  cd ../4-to-1
    30  go list -m gopkg.in/src-d/go-git.v4
    31  
    32  cd ../4-to-incompatible
    33  go list -m gopkg.in/src-d/go-git.v4
    34  
    35  # A mismatched gopkg.in path should not be able to replace a different major version.
    36  cd ../3-to-gomod-4
    37  ! go list -m gopkg.in/src-d/go-git.v3
    38  stderr '^go: gopkg\.in/src-d/go-git\.v3@v3\.2\.0 \(replaced by gopkg\.in/src-d/go-git\.v3@v3\.0\.0-20190801152248-0d1a009cbb60\): version "v3\.0\.0-20190801152248-0d1a009cbb60" invalid: go\.mod has non-\.\.\.\.v3 module path "gopkg\.in/src-d/go-git\.v4" at revision 0d1a009cbb60$'
    39  
    40  -- 4-to-4/go.mod --
    41  module golang.org/issue/34254
    42  
    43  go 1.13
    44  
    45  require gopkg.in/src-d/go-git.v4 v4.13.1
    46  
    47  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git/v4 v4.13.1
    48  -- 4-to-1/go.mod --
    49  module golang.org/issue/34254
    50  
    51  go 1.13
    52  
    53  require gopkg.in/src-d/go-git.v4 v4.13.1
    54  
    55  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v1.0.1-0.20190801152248-0d1a009cbb60
    56  -- 4-to-0/go.mod --
    57  module golang.org/issue/34254
    58  
    59  go 1.13
    60  
    61  require gopkg.in/src-d/go-git.v4 v4.13.1
    62  
    63  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v0.0.0-20190801152248-0d1a009cbb60
    64  -- 4-to-incompatible/go.mod --
    65  module golang.org/issue/34254
    66  
    67  go 1.13
    68  
    69  require gopkg.in/src-d/go-git.v4 v4.13.1
    70  
    71  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v4.6.0+incompatible
    72  -- 3-to-gomod-4/go.mod --
    73  module golang.org/issue/34254
    74  go 1.13
    75  
    76  require gopkg.in/src-d/go-git.v3 v3.2.0
    77  
    78  // This replacement has a go.mod file declaring its path to be
    79  // gopkg.in/src-d/go-git.v4, so it cannot be used as a replacement for v3.
    80  replace gopkg.in/src-d/go-git.v3 v3.2.0 => gopkg.in/src-d/go-git.v3 v3.0.0-20190801152248-0d1a009cbb60
    81  

View as plain text