From 36f4958879cfd78e4a86d641a2431d856ef0841c Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 27 Nov 2023 09:12:06 +0800 Subject: [PATCH] chore: slice loop replace --- queue.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/queue.go b/queue.go index 9a8d043..b23aeae 100644 --- a/queue.go +++ b/queue.go @@ -32,9 +32,7 @@ func (q *StreamQ) Add(line string) { func (q *StreamQ) Flush() []string { q.lock.Lock() defer q.lock.Unlock() - for _, l := range q.lines { - q.unAckd = append(q.unAckd, l) - } + q.unAckd = append(q.unAckd, q.lines...) q.lines = []string{} return q.unAckd }