mirror of
https://github.com/golang/go
synced 2024-11-19 01:34:40 -07:00
go/analysis/internal/checker: don't clobber fact when codeFact fails
`codeFact` returns `nil, err` on errors, which results in error messages like: panic: internal error: encoding of nil fact failed in [analyzer] Though that and the stacktrace are often enough to identify the cause, the nil hides the actual source of the problem. Change-Id: Iddcdee386a5c64c6567d2727ebe7a77fe21927e9 GitHub-Last-Rev: 92163c2a5a631817319c992f7445f86d95130514 GitHub-Pull-Request: golang/tools#78 Reviewed-on: https://go-review.googlesource.com/c/tools/+/167997 Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
43e94f7338
commit
a94d7df2cb
@ -545,11 +545,11 @@ func inheritFacts(act, dep *action) {
|
||||
// Optionally serialize/deserialize fact
|
||||
// to verify that it works across address spaces.
|
||||
if serialize {
|
||||
var err error
|
||||
fact, err = codeFact(fact)
|
||||
encodedFact, err := codeFact(fact)
|
||||
if err != nil {
|
||||
log.Panicf("internal error: encoding of %T fact failed in %v", fact, act)
|
||||
}
|
||||
fact = encodedFact
|
||||
}
|
||||
|
||||
if false {
|
||||
@ -567,11 +567,11 @@ func inheritFacts(act, dep *action) {
|
||||
// to verify that it works across address spaces
|
||||
// and is deterministic.
|
||||
if serialize {
|
||||
var err error
|
||||
fact, err = codeFact(fact)
|
||||
encodedFact, err := codeFact(fact)
|
||||
if err != nil {
|
||||
log.Panicf("internal error: encoding of %T fact failed in %v", fact, act)
|
||||
}
|
||||
fact = encodedFact
|
||||
}
|
||||
|
||||
if false {
|
||||
|
Loading…
Reference in New Issue
Block a user