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

     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  
     6  env GO111MODULE=on
     7  
     8  cp go.mod go.mod.orig
     9  go mod tidy
    10  cmp go.mod go.mod.orig
    11  
    12  # If the go.mod file is already tidy, 'go mod graph' should not modify it.
    13  go mod graph
    14  cmp go.mod go.mod.orig
    15  
    16  -- go.mod --
    17  module root
    18  
    19  go 1.13
    20  
    21  replace (
    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  
    29  require (
    30  	a v0.1.0
    31  	b v0.2.0 // indirect
    32  )
    33  -- main.go --
    34  package main
    35  
    36  import _ "a"
    37  
    38  func main() {}
    39  
    40  -- a1/go.mod --
    41  module a
    42  
    43  go 1.13
    44  
    45  require b v0.1.0
    46  -- a1/a.go --
    47  package a
    48  
    49  import _ "c"
    50  -- b1/go.mod --
    51  module b
    52  
    53  go 1.13
    54  
    55  require c v0.1.0
    56  -- b2/go.mod --
    57  module b
    58  
    59  go 1.13
    60  
    61  require c v0.2.0
    62  -- c1/go.mod --
    63  module c
    64  
    65  go 1.13
    66  -- c2/c.go --
    67  package c
    68  -- c2/go.mod --
    69  module c
    70  
    71  go 1.13
    72  
    73  require b v0.2.0
    74  -- c2/c.go --
    75  package c
    76  

View as plain text