From ceb4d260871119e73688ee99a844b79c94fa5fe6 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 21 Apr 2026 11:35:16 +0900 Subject: internal/pkg: record cache variant on-disk This makes custom artifacts much less error-prone to use. Signed-off-by: Ophestra --- internal/pkg/ir.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/pkg/ir.go') diff --git a/internal/pkg/ir.go b/internal/pkg/ir.go index 41e75845..c93abc9e 100644 --- a/internal/pkg/ir.go +++ b/internal/pkg/ir.go @@ -432,6 +432,12 @@ func (e InvalidKindError) Error() string { // register is not safe for concurrent use. register must not be called after // the first instance of [Cache] has been opened. func register(k Kind, f IRReadFunc) { + openMu.Lock() + defer openMu.Unlock() + + if opened { + panic("attempting to register after open") + } if _, ok := irArtifact[k]; ok { panic("attempting to register " + strconv.Itoa(int(k)) + " twice") } -- cgit v1.3.1