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

     1  # This test makes checks against a regression of a bug in the Go command
     2  # where the module loader hung forever because all main module dependencies
     3  # kept workspace pruning instead of adopting the pruning in their go.mod
     4  # files, and the loader kept adding dependencies on the queue until they
     5  # were either pruned or unpruned, never breaking a module dependency cycle.
     6  #
     7  # This is the module graph in the test:
     8  #
     9  #                               /-------------------------\
    10  #                              |                          |
    11  #                              V                          |
    12  #  example.com/a -> example.com/b v1.0.0 -> example.com/c v1.1.0
    13  
    14  go list -m -f '{{.Version}}' example.com/c
    15  
    16  -- go.work --
    17  go 1.16
    18  
    19  use (
    20  	./a
    21  )
    22  -- a/go.mod --
    23  module example.com/a
    24  
    25  go 1.18
    26  
    27  require example.com/b v1.0.0
    28  
    29  replace example.com/b v1.0.0 => ../b
    30  replace example.com/c v1.0.0 => ../c
    31  -- a/foo.go --
    32  package main
    33  
    34  import "example.com/b"
    35  
    36  func main() {
    37  	b.B()
    38  }
    39  -- b/go.mod --
    40  module example.com/b
    41  
    42  go 1.18
    43  
    44  require example.com/c v1.0.0
    45  -- b/b.go --
    46  package b
    47  
    48  func B() {
    49  }
    50  -- b/cmd/main.go --
    51  package main
    52  
    53  import "example.com/c"
    54  
    55  func main() {
    56  	c.C()
    57  }
    58  -- c/go.mod --
    59  module example.com/c
    60  
    61  go 1.18
    62  
    63  require example.com/b v1.0.0
    64  -- c/c.go --
    65  package c
    66  
    67  import "example.com/b"
    68  
    69  func C() {
    70  	b.B()
    71  }

View as plain text