Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: panic: LoadImport called with empty package path when listing GOROOT/test/*.go [1.20 backport] #60754

Closed
gopherbot opened this issue Jun 12, 2023 · 2 comments
Assignees
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge GoCommand cmd/go
Milestone

Comments

@gopherbot
Copy link
Contributor

@matloob requested issue #60230 to be considered for backport to the next 1.20 minor release.

@gopherbot, please backport to 1.20. The change in go/parser behavior between Go 1.19 and Go 1.20 caused a regression in 1.20.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jun 12, 2023
@gopherbot gopherbot added this to the Go1.20.6 milestone Jun 12, 2023
@matloob matloob added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Jun 12, 2023
@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/502697 mentions this issue: go/build: check for invalid import paths again

@matloob matloob self-assigned this Jun 12, 2023
@gopherbot
Copy link
Contributor Author

Closed by merging f5172dc to release-branch.go1.20.

gopherbot pushed a commit that referenced this issue Jun 13, 2023
The go parser previously checked for invalid import paths, go/build,
seeing the parse error would put files with invalid import paths into
InvalidGoFiles. golang.org/cl/424855 removed that check from the
parser, which meant files with invalid import paths not have any parse
errors on them and not be put into InvalidGoFiles. Do a check for
invalid import paths in go/build soon after parsing so we can make
sure files with invalid import paths go into InvalidGoFiles.

This fixes an issue where the Go command assumed that if a file wasn't
invalid it had non empty import paths, leading to a panic.

Fixes #60754
Updates #60230
Updates #60686

Change-Id: I33c1dc9304649536834939cef7c689940236ee20
Reviewed-on: https://go-review.googlesource.com/c/go/+/502615
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
(cherry picked from commit 962753b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/502697
@dmitshur dmitshur added the GoCommand cmd/go label Jun 20, 2023
@golang golang locked and limited conversation to collaborators Jun 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge GoCommand cmd/go
Projects
None yet
Development

No branches or pull requests

3 participants