-
Notifications
You must be signed in to change notification settings - Fork 17.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: don't construct module version info if there are import errors
A precondition of modload.PackageBuildInfo is that its path and deps arguments correspond to paths that have been loaded successfully with modload.ImportPaths or one of the Load functions. load.Package.load should not call PackageBuildInfo if there were any errors resolving imports. Fixes #34393 Change-Id: I107514f1c535885330ff266c85d3981b71b31c2d Reviewed-on: https://go-review.googlesource.com/c/go/+/196520 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
- Loading branch information
Jay Conrod
committed
Sep 19, 2019
1 parent
1c50fcf
commit e2cbb7f
Showing
3 changed files
with
28 additions
and
2 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
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,22 @@ | ||
# This test verifies that line numbers are included in module import errors. | ||
# Verifies golang.org/issue/34393. | ||
|
||
go list -e -deps -f '{{with .Error}}{{.Pos}}: {{.Err}}{{end}}' ./main | ||
stdout 'bad[/\\]bad.go:3:8: malformed module path "string": missing dot in first path element' | ||
|
||
-- go.mod -- | ||
module m | ||
|
||
go 1.13 | ||
|
||
-- main/main.go -- | ||
package main | ||
|
||
import _ "m/bad" | ||
|
||
func main() {} | ||
|
||
-- bad/bad.go -- | ||
package bad | ||
|
||
import _ "string" |