...

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

Documentation: cmd/go/testdata/script

     1go list -e -deps -json=ImportPath,Error,DepsErrors m/a
     2cmp stdout want
     3
     4-- want --
     5{
     6	"ImportPath": "m/c",
     7	"DepsErrors": [
     8		{
     9			"ImportStack": [
    10				"m/a",
    11				"m/b",
    12				"m/c",
    13				"m/a"
    14			],
    15			"Pos": "",
    16			"Err": "import cycle not allowed"
    17		}
    18	]
    19}
    20{
    21	"ImportPath": "m/b",
    22	"DepsErrors": [
    23		{
    24			"ImportStack": [
    25				"m/a",
    26				"m/b",
    27				"m/c",
    28				"m/a"
    29			],
    30			"Pos": "",
    31			"Err": "import cycle not allowed"
    32		}
    33	]
    34}
    35{
    36	"ImportPath": "m/a",
    37	"Error": {
    38		"ImportStack": [
    39			"m/a",
    40			"m/b",
    41			"m/c",
    42			"m/a"
    43		],
    44		"Pos": "",
    45		"Err": "import cycle not allowed"
    46	},
    47	"DepsErrors": [
    48		{
    49			"ImportStack": [
    50				"m/a",
    51				"m/b",
    52				"m/c",
    53				"m/a"
    54			],
    55			"Pos": "",
    56			"Err": "import cycle not allowed"
    57		}
    58	]
    59}
    60-- go.mod --
    61module m
    62
    63go 1.21
    64-- a/a.go --
    65package a
    66
    67import _ "m/b"
    68-- b/b.go --
    69package b
    70
    71import _ "m/c"
    72-- c/c.go --
    73package c
    74
    75import _ "m/a"

View as plain text