invocation: split out the delegation chain control

This commit is contained in:
Michael Muré
2024-11-13 16:58:48 +01:00
parent 92065ca0d3
commit 64b989452f
5 changed files with 162 additions and 82 deletions

View File

@@ -26,17 +26,17 @@ const Tag = "ucan/dlg@1.0.0-rc.1"
var schemaBytes []byte
var (
once sync.Once
ts *schema.TypeSystem
err error
once sync.Once
ts *schema.TypeSystem
errSchema error
)
func mustLoadSchema() *schema.TypeSystem {
once.Do(func() {
ts, err = ipld.LoadSchemaBytes(schemaBytes)
ts, errSchema = ipld.LoadSchemaBytes(schemaBytes)
})
if err != nil {
panic(fmt.Errorf("failed to load IPLD schema: %s", err))
if errSchema != nil {
panic(fmt.Errorf("failed to load IPLD schema: %s", errSchema))
}
return ts
}