소스 검색

chore: slice replace loop (#3410)

guangwu 1 년 전
부모
커밋
f1171e01f2
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 3
      tools/goctl/pkg/parser/api/ast/writer.go

+ 1 - 3
tools/goctl/pkg/parser/api/ast/writer.go

@@ -219,9 +219,7 @@ func transferTokenNode(node *TokenNode, opt ...tokenNodeOption) *TokenNode {
 		}
 	}
 	if !option.ignoreLeadingComment {
-		for _, v := range node.LeadingCommentGroup {
-			result.LeadingCommentGroup = append(result.LeadingCommentGroup, v)
-		}
+		result.LeadingCommentGroup = append(result.LeadingCommentGroup, node.LeadingCommentGroup...)
 	}
 	return result
 }