diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-04-21 11:35:16 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-04-23 00:53:21 +0900 |
| commit | ceb4d260871119e73688ee99a844b79c94fa5fe6 (patch) | |
| tree | b8b409f71f6f53c1ec30e5b15097d1f7a3def4f7 /internal/pkg/ir.go | |
| parent | 852f3a9b3dfcb41ebd8f6587e232f2eb4708a44f (diff) | |
internal/pkg: record cache variant on-disk
This makes custom artifacts much less error-prone to use.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/ir.go')
| -rw-r--r-- | internal/pkg/ir.go | 6 |
1 files changed, 6 insertions, 0 deletions
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") } |
