From 0295afd3e4709ea48ce41e6feb74ef2cc3b9d2fd Mon Sep 17 00:00:00 2001 From: cuishuang Date: Thu, 26 Sep 2024 14:31:10 +0800 Subject: [PATCH] fix: fix slice init length Signed-off-by: cuishuang --- runtime/commits.go | 4 ++-- runtime/reference.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/commits.go b/runtime/commits.go index 70f6126..da02446 100644 --- a/runtime/commits.go +++ b/runtime/commits.go @@ -28,7 +28,7 @@ func walkCommits(n *parser.NodeProgram, visitor *RuntimeVisitor) (*TableData, er fields = builder.possibleTables[s.Tables[0]] } resultFields := fields // These are the fields in output with wildcards expanded - rows := make([]tableRow, s.Limit) + rows := make([]tableRow, 0, s.Limit) usingOrder := false if s.Order != nil && !s.Count { usingOrder = true @@ -107,7 +107,7 @@ func walkCommits(n *parser.NodeProgram, visitor *RuntimeVisitor) (*TableData, er func metadataCommit(identifier string, commit *object.Commit) string { key := "" - for key, _ = range builder.tables { + for key = range builder.tables { break } table := key diff --git a/runtime/reference.go b/runtime/reference.go index 8d99eb4..bdce6f0 100644 --- a/runtime/reference.go +++ b/runtime/reference.go @@ -25,7 +25,7 @@ func walkReferences(n *parser.NodeProgram, visitor *RuntimeVisitor) (*TableData, fields = builder.possibleTables[s.Tables[0]] } - rows := make([]tableRow, s.Limit) + rows := make([]tableRow, 0, s.Limit) usingOrder := false if s.Order != nil && !s.Count { usingOrder = true @@ -88,7 +88,7 @@ func walkReferences(n *parser.NodeProgram, visitor *RuntimeVisitor) (*TableData, func metadataReference(identifier string, ref *plumbing.Reference) string { key := "" - for key, _ = range builder.tables { + for key = range builder.tables { break } table := key