...

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

Documentation: cmd/go/testdata/script

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

View as plain text