本文整理汇总了Golang中github.com/google/go-github/github.Issue.Labels方法的典型用法代码示例。如果您正苦于以下问题:Golang Issue.Labels方法的具体用法?Golang Issue.Labels怎么用?Golang Issue.Labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/google/go-github/github.Issue
的用法示例。
在下文中一共展示了Issue.Labels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: bulkEditStart
func bulkEditStart(issues []*github.Issue) (*github.Issue, []byte) {
common := new(github.Issue)
for i, issue := range issues {
if i == 0 {
common.State = issue.State
common.Assignee = issue.Assignee
common.Labels = issue.Labels
common.Milestone = issue.Milestone
continue
}
if common.State != nil && getString(common.State) != getString(issue.State) {
common.State = nil
}
if common.Assignee != nil && getUserLogin(common.Assignee) != getUserLogin(issue.Assignee) {
common.Assignee = nil
}
if common.Milestone != nil && getMilestoneTitle(common.Milestone) != getMilestoneTitle(issue.Milestone) {
common.Milestone = nil
}
common.Labels = commonLabels(common.Labels, issue.Labels)
}
var buf bytes.Buffer
fmt.Fprintf(&buf, "State: %s\n", getString(common.State))
fmt.Fprintf(&buf, "Assignee: %s\n", getUserLogin(common.Assignee))
fmt.Fprintf(&buf, "Labels: %s\n", strings.Join(getLabelNames(common.Labels), " "))
fmt.Fprintf(&buf, "Milestone: %s\n", getMilestoneTitle(common.Milestone))
fmt.Fprintf(&buf, "\n<optional comment here>\n")
fmt.Fprintf(&buf, "%s\n", bulkHeader)
for _, issue := range issues {
fmt.Fprintf(&buf, "%d\t%s\n", getInt(issue.Number), getString(issue.Title))
}
return common, buf.Bytes()
}
示例2: labelIssue
func labelIssue(label string, issue *github.Issue) *github.Issue {
l := github.Label{
Name: stringPtr(label),
}
issue.Labels = append(issue.Labels, l)
return issue
}