]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: graceful handle error in noder LoadPackage
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 19 Feb 2021 05:42:57 +0000 (12:42 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 4 Mar 2021 06:35:44 +0000 (06:35 +0000)
commitb7f4307761c61d2d3f563c37b0c9ad0e64899d9f
tree8ba9723632af9daf88cc31443b94a4cae3918c3c
parent4532467c1854fa16378063bd99defadc4a1e5fb1
cmd/compile: graceful handle error in noder LoadPackage

When syntax.Parse returns error, noder.file will be nil. Currently, we
continue accessing it regardlessly and depend on gc.hidePanic to hide
the panic from user.

Instead, we should gracefully handle the error in LoadPackage, then exit
earlier if any error occurred.

Updates #43311

Change-Id: I0a108ef360bd4f0cc9f481071b8967355e1513af
Reviewed-on: https://go-review.googlesource.com/c/go/+/294030
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/noder/noder.go
test/fixedbugs/bug050.go