Skip to content

Instantly share code, notes, and snippets.

@kkdai
Created May 24, 2021 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkdai/34e778f60b40e83a080ded84aedddfdb to your computer and use it in GitHub Desktop.
Save kkdai/34e778f60b40e83a080ded84aedddfdb to your computer and use it in GitHub Desktop.
d.impData = make(map[string]Issue)
for _, c := range d.GetAllComments() {
a := articleMap[c.ArticleLink.ID]
shortLink := getShortPath(a.GetArticleLink())
if issue, exist := d.impData[shortLink]; !exist {
//not exist, insert new issue.
ii := Issue{
ArticleTitle: a.Title,
ArticleLink: a.Link,
ShortLink: shortLink,
}
ii.AppendComment(c)
d.impData[shortLink] = ii
} else {
//Exist, append new comment and update issue.
issue.AppendComment(c)
d.impData[shortLink] = issue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment