Przeglądaj źródła

chore: slice replace loop (#3410)

guangwu 1 rok temu
rodzic
commit
f1171e01f2
1 zmienionych plików z 1 dodań i 3 usunięć
  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
 }