...

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

Documentation: cmd/go/testdata/script

     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
     7skip '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
    13env GO111MODULE=on
    14env GOPROXY=direct
    15env GOSUMDB=off
    16env 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.
    21cd 4-to-4
    22go 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
    28cd ../4-to-0
    29go list -m gopkg.in/src-d/go-git.v4
    30
    31cd ../4-to-1
    32go list -m gopkg.in/src-d/go-git.v4
    33
    34cd ../4-to-incompatible
    35go 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.
    38cd ../3-to-gomod-4
    39! go list -m gopkg.in/src-d/go-git.v3
    40stderr '^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 --
    43module golang.org/issue/34254
    44
    45go 1.13
    46
    47require gopkg.in/src-d/go-git.v4 v4.13.1
    48
    49replace 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 --
    51module golang.org/issue/34254
    52
    53go 1.13
    54
    55require gopkg.in/src-d/go-git.v4 v4.13.1
    56
    57replace 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 --
    59module golang.org/issue/34254
    60
    61go 1.13
    62
    63require gopkg.in/src-d/go-git.v4 v4.13.1
    64
    65replace 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 --
    67module golang.org/issue/34254
    68
    69go 1.13
    70
    71require gopkg.in/src-d/go-git.v4 v4.13.1
    72
    73replace 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 --
    75module golang.org/issue/34254
    76go 1.13
    77
    78require 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.
    82replace gopkg.in/src-d/go-git.v3 v3.2.0 => gopkg.in/src-d/go-git.v3 v3.0.0-20190801152248-0d1a009cbb60

View as plain text