From 49967f3d450d52934ec21c631cc9842446853bed Mon Sep 17 00:00:00 2001 From: Ioannis Pinakoulakis Date: Fri, 15 Aug 2025 15:16:41 +0300 Subject: [PATCH] Use fixed-length array when possible (#4488) --- src/result.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/result.go b/src/result.go index 0ad0994e..36f56fb7 100644 --- a/src/result.go +++ b/src/result.go @@ -128,9 +128,9 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t // No ANSI codes if len(itemColors) == 0 && len(nthOffsets) == 0 { - var offsets []colorOffset - for _, off := range matchOffsets { - offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true}) + offsets := make([]colorOffset, len(matchOffsets)) + for i, off := range matchOffsets { + offsets[i] = colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true} } return offsets }