-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: rewrite collectDeps to only depend on imports' deps
Change-Id: I0cac9f32855e49e9899709a2f4421083aa0e75cc Reviewed-on: https://go-review.googlesource.com/c/go/+/483515 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
- Loading branch information
Showing
2 changed files
with
126 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/cmd/go/testdata/script/list_import_cycle_deps_errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
go list -e -deps -json=ImportPath,Error,DepsErrors m/a | ||
cmp stdout want | ||
|
||
-- want -- | ||
{ | ||
"ImportPath": "m/c", | ||
"DepsErrors": [ | ||
{ | ||
"ImportStack": [ | ||
"m/a", | ||
"m/b", | ||
"m/c", | ||
"m/a" | ||
], | ||
"Pos": "", | ||
"Err": "import cycle not allowed" | ||
} | ||
] | ||
} | ||
{ | ||
"ImportPath": "m/b", | ||
"DepsErrors": [ | ||
{ | ||
"ImportStack": [ | ||
"m/a", | ||
"m/b", | ||
"m/c", | ||
"m/a" | ||
], | ||
"Pos": "", | ||
"Err": "import cycle not allowed" | ||
} | ||
] | ||
} | ||
{ | ||
"ImportPath": "m/a", | ||
"Error": { | ||
"ImportStack": [ | ||
"m/a", | ||
"m/b", | ||
"m/c", | ||
"m/a" | ||
], | ||
"Pos": "", | ||
"Err": "import cycle not allowed" | ||
}, | ||
"DepsErrors": [ | ||
{ | ||
"ImportStack": [ | ||
"m/a", | ||
"m/b", | ||
"m/c", | ||
"m/a" | ||
], | ||
"Pos": "", | ||
"Err": "import cycle not allowed" | ||
} | ||
] | ||
} | ||
-- go.mod -- | ||
module m | ||
|
||
go 1.21 | ||
-- a/a.go -- | ||
package a | ||
|
||
import _ "m/b" | ||
-- b/b.go -- | ||
package b | ||
|
||
import _ "m/c" | ||
-- c/c.go -- | ||
package c | ||
|
||
import _ "m/a" |