Commit eb86abaa authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: better error for malformed packages

Fixes #14270.

Change-Id: Iaf2496a24b1aba443391b90951cef472add73f13
Reviewed-on: https://go-review.googlesource.com/45950
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 6ce50671
......@@ -964,7 +964,8 @@ func importfile(f *Val) *types.Pkg {
// check object header
p, err := imp.ReadString('\n')
if err != nil {
log.Fatalf("reading input: %v", err)
yyerror("import %s: reading input: %v", file, err)
errorexit()
}
if len(p) > 0 {
p = p[:len(p)-1]
......@@ -979,7 +980,8 @@ func importfile(f *Val) *types.Pkg {
}
p, err = imp.ReadString('\n')
if err != nil {
log.Fatalf("reading input: %v", err)
yyerror("import %s: reading input: %v", file, err)
errorexit()
}
if len(p) > 0 {
p = p[:len(p)-1]
......@@ -1004,7 +1006,8 @@ func importfile(f *Val) *types.Pkg {
for {
p, err = imp.ReadString('\n')
if err != nil {
log.Fatalf("reading input: %v", err)
yyerror("import %s: reading input: %v", file, err)
errorexit()
}
if p == "\n" {
break // header ends with blank line
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment