-
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: include imports in 'go list -e' output even after parse errors
If we aren't able to load imports from one file in a package due to a parse error (scanner.ErrorList), 'go list -e' should still list imports in other files. Fixes #35973 Change-Id: I59f171877949bb7afaf252b6c8a970de22e60c7a Reviewed-on: https://go-review.googlesource.com/c/go/+/210097 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
- Loading branch information
Jay Conrod
committed
Dec 5, 2019
1 parent
e3c7ffc
commit 993ec7f
Showing
3 changed files
with
47 additions
and
36 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
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,17 @@ | ||
# 'go list' should report imports, even if some files have parse errors | ||
# before the import block. | ||
go list -e -f '{{range .Imports}}{{.}} {{end}}' | ||
stdout '^fmt ' | ||
|
||
-- go.mod -- | ||
module m | ||
|
||
go 1.13 | ||
|
||
-- a.go -- | ||
package a | ||
|
||
import "fmt" | ||
|
||
-- b.go -- | ||
// no package statement |
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