From 390547f35c43dcfd3fa4235527c947d98cffd2f8 Mon Sep 17 00:00:00 2001 From: guangwu Date: Fri, 21 Jul 2023 19:37:03 +0800 Subject: [PATCH] chore: use copy(to, from) instead of a loop (#114) --- reviser/file.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/reviser/file.go b/reviser/file.go index e5e285d..5312e75 100644 --- a/reviser/file.go +++ b/reviser/file.go @@ -152,9 +152,7 @@ func fixCommentGroup(commentGroup *ast.CommentGroup) *ast.CommentGroup { List: make([]*ast.Comment, len(commentGroup.List)), } - for i, comment := range commentGroup.List { - formattedDoc.List[i] = comment - } + copy(formattedDoc.List, commentGroup.List) return formattedDoc }