...

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

Documentation: cmd/go/testdata/script

     1# Regression test for https://go.dev/issue/60313: 'go mod tidy' did not preserve
     2# dependencies needed to prevent 'ambiguous import' errors in external test
     3# dependencies.
     4
     5cp go.mod go.mod.orig
     6go mod tidy
     7cmp go.mod go.mod.orig
     8
     9-- go.mod --
    10module example
    11
    12go 1.21
    13
    14require (
    15	example.net/a v0.1.0
    16	example.net/b v0.1.0
    17)
    18
    19require example.net/outer/inner v0.1.0 // indirect
    20
    21replace (
    22	example.net/a v0.1.0 => ./a
    23	example.net/b v0.1.0 => ./b
    24	example.net/outer v0.1.0 => ./outer
    25	example.net/outer/inner v0.1.0 => ./inner
    26)
    27-- example.go --
    28package example
    29
    30import (
    31	_ "example.net/a"
    32	_ "example.net/b"
    33)
    34-- a/go.mod --
    35module example.net/a
    36
    37go 1.21
    38
    39require example.net/outer/inner v0.1.0
    40-- a/a.go --
    41package a
    42-- a/a_test.go --
    43package a_test
    44
    45import _ "example.net/outer/inner"
    46-- b/go.mod --
    47module example.net/b
    48
    49go 1.21
    50
    51require example.net/outer v0.1.0
    52-- b/b.go --
    53package b
    54-- b/b_test.go --
    55package b_test
    56
    57import _ "example.net/outer/inner"
    58-- inner/go.mod --
    59module example.net/outer/inner
    60
    61go 1.21
    62-- inner/inner.go --
    63package inner
    64-- outer/go.mod --
    65module example.net/outer
    66
    67go 1.21
    68-- outer/inner/inner.go --
    69package inner

View as plain text