From 43cce678a1932ffe0f15982da862f7e775426889 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 6 Jun 2022 11:22:29 -0400 Subject: [PATCH] go/analysis: document need for deterministic Fact encoding Change-Id: I5a1b537f5ba14405fa1e9916b6d63e4fc7e5db45 Reviewed-on: https://go-review.googlesource.com/c/tools/+/410364 Reviewed-by: Hyang-Ah Hana Kim --- go/analysis/doc.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/go/analysis/doc.go b/go/analysis/doc.go index 7679bda435..03c31525e3 100644 --- a/go/analysis/doc.go +++ b/go/analysis/doc.go @@ -241,6 +241,9 @@ Consequently, Facts must be serializable. The API requires that drivers use the gob encoding, an efficient, robust, self-describing binary protocol. A fact type may implement the GobEncoder/GobDecoder interfaces if the default encoding is unsuitable. Facts should be stateless. +Because serialized facts may appear within build outputs, the gob encoding +of a fact must be deterministic, to avoid spurious cache misses in +build systems that use content-addressable caches. The Pass type has functions to import and export facts, associated either with an object or with a package: