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  skip 'skipping test that depends on an unreliable third-party server; see https://go.dev/issue/54503'
     8  	# TODO(#54043): Make this test hermetic and re-enable it.
     9  
    10  [!net:gopkg.in] skip
    11  [!git] skip
    12  
    13  env GO111MODULE=on
    14  env GOPROXY=direct
    15  env GOSUMDB=off
    16  env GOFLAGS=-mod=mod
    17  
    18  # Replacing gopkg.in/[…].vN with a repository with a root go.mod file
    19  # specifying […].vN and a compatible version should succeed, even if
    20  # the replacement path is not a gopkg.in path.
    21  cd 4-to-4
    22  go list -m gopkg.in/src-d/go-git.v4
    23  
    24  # Previous versions of the "go" command accepted v0 and v1 pseudo-versions
    25  # as replacements for gopkg.in/[…].v4.
    26  # As a special case, we continue to accept those.
    27  
    28  cd ../4-to-0
    29  go list -m gopkg.in/src-d/go-git.v4
    30  
    31  cd ../4-to-1
    32  go list -m gopkg.in/src-d/go-git.v4
    33  
    34  cd ../4-to-incompatible
    35  go list -m gopkg.in/src-d/go-git.v4
    36  
    37  # A mismatched gopkg.in path should not be able to replace a different major version.
    38  cd ../3-to-gomod-4
    39  ! go list -m gopkg.in/src-d/go-git.v3
    40  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$'
    41  
    42  -- 4-to-4/go.mod --
    43  module golang.org/issue/34254
    44  
    45  go 1.13
    46  
    47  require gopkg.in/src-d/go-git.v4 v4.13.1
    48  
    49  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git/v4 v4.13.1
    50  -- 4-to-1/go.mod --
    51  module golang.org/issue/34254
    52  
    53  go 1.13
    54  
    55  require gopkg.in/src-d/go-git.v4 v4.13.1
    56  
    57  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v1.0.1-0.20190801152248-0d1a009cbb60
    58  -- 4-to-0/go.mod --
    59  module golang.org/issue/34254
    60  
    61  go 1.13
    62  
    63  require gopkg.in/src-d/go-git.v4 v4.13.1
    64  
    65  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v0.0.0-20190801152248-0d1a009cbb60
    66  -- 4-to-incompatible/go.mod --
    67  module golang.org/issue/34254
    68  
    69  go 1.13
    70  
    71  require gopkg.in/src-d/go-git.v4 v4.13.1
    72  
    73  replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v4.6.0+incompatible
    74  -- 3-to-gomod-4/go.mod --
    75  module golang.org/issue/34254
    76  go 1.13
    77  
    78  require gopkg.in/src-d/go-git.v3 v3.2.0
    79  
    80  // This replacement has a go.mod file declaring its path to be
    81  // gopkg.in/src-d/go-git.v4, so it cannot be used as a replacement for v3.
    82  replace gopkg.in/src-d/go-git.v3 v3.2.0 => gopkg.in/src-d/go-git.v3 v3.0.0-20190801152248-0d1a009cbb60
    83  

View as plain text