From 72cd390b556613764c310ea7f4bccd00a75c3261 Mon Sep 17 00:00:00 2001 From: "ye.sijun" Date: Wed, 22 Dec 2021 05:42:42 +0000 Subject: [PATCH] x/tools: improving the error message for check fact type Fixes golang/go#50235 Change-Id: Ic9f61cb61fbf1e2cd198cc5d20bcba794c3181dc GitHub-Last-Rev: 32d212d858102507ab6d6e510264feca9b78787e GitHub-Pull-Request: golang/tools#356 Reviewed-on: https://go-review.googlesource.com/c/tools/+/374016 Reviewed-by: Alan Donovan Run-TryBot: Tim King gopls-CI: kokoro TryBot-Result: Gopher Robot Reviewed-by: Tim King Trust: Keith Randall --- go/analysis/internal/checker/checker.go | 2 +- internal/lsp/cache/analysis.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go/analysis/internal/checker/checker.go b/go/analysis/internal/checker/checker.go index 34f5b47d4c..88613930d9 100644 --- a/go/analysis/internal/checker/checker.go +++ b/go/analysis/internal/checker/checker.go @@ -890,7 +890,7 @@ func (act *action) exportPackageFact(fact analysis.Fact) { func factType(fact analysis.Fact) reflect.Type { t := reflect.TypeOf(fact) if t.Kind() != reflect.Ptr { - log.Fatalf("invalid Fact type: got %T, want pointer", t) + log.Fatalf("invalid Fact type: got %T, want pointer", fact) } return t } diff --git a/internal/lsp/cache/analysis.go b/internal/lsp/cache/analysis.go index c4b74407ab..d66a3ed37c 100644 --- a/internal/lsp/cache/analysis.go +++ b/internal/lsp/cache/analysis.go @@ -390,7 +390,7 @@ func exportedFrom(obj types.Object, pkg *types.Package) bool { func factType(fact analysis.Fact) reflect.Type { t := reflect.TypeOf(fact) if t.Kind() != reflect.Ptr { - panic(fmt.Sprintf("invalid Fact type: got %T, want pointer", t)) + panic(fmt.Sprintf("invalid Fact type: got %T, want pointer", fact)) } return t }