inline: make it possible to gob encode/decode inlineMeFacts
Before this change gob encoding of these facts was failing with:
`gob: type analyzer.inlineMeFact has no exported fields`
gob encoding is required for all facts as analyzer drivers use it to
share facts between the analysis of different packages as stated in
the docs:
A Fact type must be a pointer. Facts are encoded and decoded using
encoding/gob. A Fact may implement the GobEncoder/GobDecoder
interfaces to customize its encoding. Fact encoding should not fail.
Change-Id: Ifb0eb57b0f582ec228a21a0d17e3bbd33c560d3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/574435
Auto-Submit: Lasse Folger <lassefolger@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/internal/refactor/inline/analyzer/analyzer.go b/internal/refactor/inline/analyzer/analyzer.go
index bb7d9d0..704ef6f 100644
--- a/internal/refactor/inline/analyzer/analyzer.go
+++ b/internal/refactor/inline/analyzer/analyzer.go
@@ -104,7 +104,7 @@
if !ok {
var fact inlineMeFact
if pass.ImportObjectFact(fn, &fact) {
- callee = fact.callee
+ callee = fact.Callee
inlinable[fn] = callee
}
}
@@ -157,9 +157,9 @@
return nil, nil
}
-type inlineMeFact struct{ callee *inline.Callee }
+type inlineMeFact struct{ Callee *inline.Callee }
-func (f *inlineMeFact) String() string { return "inlineme " + f.callee.String() }
+func (f *inlineMeFact) String() string { return "inlineme " + f.Callee.String() }
func (*inlineMeFact) AFact() {}
func discard(string, ...any) {}