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
|
// Optionally serialize/deserialize fact
|
||||||
// to verify that it works across address spaces.
|
// to verify that it works across address spaces.
|
||||||
if serialize {
|
if serialize {
|
||||||
var err error
|
encodedFact, err := codeFact(fact)
|
||||||
fact, err = codeFact(fact)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("internal error: encoding of %T fact failed in %v", fact, act)
|
log.Panicf("internal error: encoding of %T fact failed in %v", fact, act)
|
||||||
}
|
}
|
||||||
|
fact = encodedFact
|
||||||
}
|
}
|
||||||
|
|
||||||
if false {
|
if false {
|
||||||
|
@ -567,11 +567,11 @@ func inheritFacts(act, dep *action) {
|
||||||
// to verify that it works across address spaces
|
// to verify that it works across address spaces
|
||||||
// and is deterministic.
|
// and is deterministic.
|
||||||
if serialize {
|
if serialize {
|
||||||
var err error
|
encodedFact, err := codeFact(fact)
|
||||||
fact, err = codeFact(fact)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("internal error: encoding of %T fact failed in %v", fact, act)
|
log.Panicf("internal error: encoding of %T fact failed in %v", fact, act)
|
||||||
}
|
}
|
||||||
|
fact = encodedFact
|
||||||
}
|
}
|
||||||
|
|
||||||
if false {
|
if false {
|
||||||
|
|
Loading…
Reference in New Issue