Skip to content

Commit 961d3ab

Browse files
runtime: fix makezero lint in appendNewlineToQueuedMessage
Replace make([]T, len)+copy with append(nil, src...) to avoid appending to a non-zero-initialized slice, which triggers the makezero linter. Assisted-By: docker-agent
1 parent 17b5d85 commit 961d3ab

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎pkg/runtime/loop.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ func appendNewlineToQueuedMessage(sm QueuedMessage) QueuedMessage {
8484
return sm
8585
}
8686
// Shallow-copy the slice so we don't mutate the original.
87-
parts := make([]chat.MessagePart, len(sm.MultiContent))
88-
copy(parts, sm.MultiContent)
87+
parts := append([]chat.MessagePart(nil), sm.MultiContent...)
8988
// Find the last text part and append \n to it.
9089
for i := len(parts) - 1; i >= 0; i-- {
9190
if parts[i].Type == chat.MessagePartTypeText {

0 commit comments

Comments
 (0)