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

     1  env GO111MODULE=on
     2  
     3  # 'go list all' should fail with a reasonable error message
     4  ! go list all
     5  stderr '^package m\n\timports m/a from m.go\n\timports m/b from a.go\n\timports m/a from b.go: import cycle not allowed'
     6  
     7  # 'go list -e' should not print to stderr, but should mark all three
     8  # packages (m, m/a, and m/b) as Incomplete.
     9  go list -e -json all
    10  ! stderr .
    11  stdout -count=3 '"Incomplete": true,'
    12  
    13  -- go.mod --
    14  module m
    15  
    16  require (
    17  	m/a v0.0.0
    18  	m/b v0.0.0
    19  )
    20  
    21  replace (
    22  	m/a => ./a
    23  	m/b => ./b
    24  )
    25  -- m.go --
    26  package m
    27  import (
    28  	_ "m/a"
    29  	_ "m/b"
    30  )
    31  -- a/go.mod --
    32  module m/a
    33  -- a/a.go --
    34  package a
    35  import _ "m/b"
    36  -- b/go.mod --
    37  module m/b
    38  -- b/b.go --
    39  package b
    40  import _ "m/a"
    41  

View as plain text