From 1468ca7608bd6c30d9dbffbd4d283225ca31231113955ceb34200ffadbe4213d Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 10 Apr 2025 10:15:15 +0300 Subject: [PATCH] Make slice only after the check is done --- go/schema/check.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/schema/check.go b/go/schema/check.go index 9b26691..83b79ef 100644 --- a/go/schema/check.go +++ b/go/schema/check.go @@ -273,7 +273,6 @@ func Check(schemaName string, schemas map[string][][]any, data any) error { if vs == nil { continue } - expected := make([]types.Type, 0, len(cmd)-1) if len(cmd) < 2 { return &SchemaErr{BaseErr: BaseErr{ SchemaName: schemaName, @@ -282,6 +281,7 @@ func Check(schemaName string, schemas map[string][][]any, data any) error { Msg: "wrong number of args", }} } + expected := make([]types.Type, 0, len(cmd)-1) for _, tAny := range cmd[1:] { var t string t, ok = tAny.(string) -- 2.48.1