...

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

Documentation: cmd/go/testdata/script

     1# Regression test for https://golang.org/issue/34086:
     2# 'go mod tidy' produced different go.mod file from other
     3# subcommands when certain kinds of cycles were present
     4# in the build graph.
     5
     6env GO111MODULE=on
     7
     8cp go.mod go.mod.orig
     9go mod tidy
    10cmp go.mod go.mod.orig
    11
    12# If the go.mod file is already tidy, 'go mod graph' should not modify it.
    13go mod graph
    14cmp go.mod go.mod.orig
    15
    16-- go.mod --
    17module root
    18
    19go 1.13
    20
    21replace (
    22	a v0.1.0 => ./a1
    23	b v0.1.0 => ./b1
    24	b v0.2.0 => ./b2
    25	c v0.1.0 => ./c1
    26	c v0.2.0 => ./c2
    27)
    28
    29require (
    30	a v0.1.0
    31	b v0.2.0 // indirect
    32)
    33-- main.go --
    34package main
    35
    36import _ "a"
    37
    38func main() {}
    39
    40-- a1/go.mod --
    41module a
    42
    43go 1.13
    44
    45require b v0.1.0
    46-- a1/a.go --
    47package a
    48
    49import _ "c"
    50-- b1/go.mod --
    51module b
    52
    53go 1.13
    54
    55require c v0.1.0
    56-- b2/go.mod --
    57module b
    58
    59go 1.13
    60
    61require c v0.2.0
    62-- c1/go.mod --
    63module c
    64
    65go 1.13
    66-- c2/c.go --
    67package c
    68-- c2/go.mod --
    69module c
    70
    71go 1.13
    72
    73require b v0.2.0
    74-- c2/c.go --
    75package c

View as plain text