]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.20] go/build: check for invalid import paths again
authorMichael Matloob <matloob@golang.org>
Mon, 12 Jun 2023 16:33:30 +0000 (12:33 -0400)
committerMichael Pratt <mpratt@google.com>
Tue, 13 Jun 2023 19:34:05 +0000 (19:34 +0000)
commitf5172dcd38f42829d145afd47c293afab934ccbc
tree3c4fc9563cfa93255449608ae988420adbb1a8e2
parent8b3acefcbec3b861b8be9a37229a3d1329a9df1d
[release-branch.go1.20] go/build: check for invalid import paths again

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 962753b015407c69dd334578fd32a80aa7905c24)
Reviewed-on: https://go-review.googlesource.com/c/go/+/502697
src/cmd/go/testdata/script/list_empty_import.txt [new file with mode: 0644]
src/go/build/read.go