Browse Source

Make the code more idiomatic

Vadim Markovtsev 6 years ago
parent
commit
9ac4a95d89
1 changed files with 2 additions and 2 deletions
  1. 2 2
      leaves/comment_sentiment.go

+ 2 - 2
leaves/comment_sentiment.go

@@ -180,7 +180,7 @@ func (sent *CommentSentimentAnalysis) Finalize() interface{} {
 		days = append(days, day)
 		days = append(days, day)
 	}
 	}
 	sort.Ints(days)
 	sort.Ints(days)
-	texts := []string{}
+	var texts []string
 	for _, key := range days {
 	for _, key := range days {
 		texts = append(texts, sent.commentsByDay[key]...)
 		texts = append(texts, sent.commentsByDay[key]...)
 	}
 	}
@@ -290,7 +290,7 @@ func (sent *CommentSentimentAnalysis) serializeBinary(
 }
 }
 
 
 func (sent *CommentSentimentAnalysis) mergeComments(nodes []*uast.Node) []string {
 func (sent *CommentSentimentAnalysis) mergeComments(nodes []*uast.Node) []string {
-	mergedComments := []string{}
+	var mergedComments []string
 	lines := map[int][]*uast.Node{}
 	lines := map[int][]*uast.Node{}
 	for _, node := range nodes {
 	for _, node := range nodes {
 		if node.StartPosition == nil {
 		if node.StartPosition == nil {