本文整理汇总了Golang中github.com/google/go-github/github.Issue类的典型用法代码示例。如果您正苦于以下问题:Golang Issue类的具体用法?Golang Issue怎么用?Golang Issue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Issue类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
}
开发者ID:petermattis,项目名称:issue,代码行数:35,代码来源:edit.go
示例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
}
开发者ID:josafat,项目名称:contrib,代码行数:7,代码来源:submit-queue_test.go
示例3: bulkWriteIssue
func bulkWriteIssue(old *github.Issue, updated []byte, status func(string)) (ids []int, err error) {
i := bytes.Index(updated, []byte(bulkHeader))
if i < 0 {
return nil, fmt.Errorf("cannot find bulk edit issue list")
}
ids = readBulkIDs(updated[i:])
if len(ids) == 0 {
return nil, fmt.Errorf("found no issues in bulk edit issue list")
}
// Make a copy of the issue to modify.
x := *old
old = &x
// Try a write to issue -1, checking for formatting only.
old.Number = new(int)
*old.Number = -1
if _, err := writeIssue(old, updated, true); err != nil {
return nil, err
}
// Apply to all issues in list.
suffix := ""
if len(ids) != 1 {
suffix = "s"
}
status(fmt.Sprintf("updating %d issue%s", len(ids), suffix))
failed := false
for index, number := range ids {
if index%10 == 0 && index > 0 {
status(fmt.Sprintf("updated %d/%d issues", index, len(ids)))
}
// Check rate limits here (in contrast to everywhere else in this program)
// to avoid needless failure halfway through the loop.
// for client.Rate.Limit > 0 && client.Rate.Remaining == 0 {
// delta := (client.Rate.Reset.Sub(time.Now())/time.Minute + 2) * time.Minute
{
delta := time.Duration(0)
if delta < 0 {
delta = 2 * time.Minute
}
status(fmt.Sprintf("updated %d/%d issues; pausing %d minutes to respect GitHub rate limit", index, len(ids), int(delta/time.Minute)))
time.Sleep(delta)
if _, _, err := client.RateLimit(); err != nil {
status(fmt.Sprintf("reading rate limit: %v", err))
}
}
*old.Number = number
if _, err := writeIssue(old, updated, true); err != nil {
status(fmt.Sprintf("writing #%d: %s", number, strings.Replace(err.Error(), "\n", "\n\t", -1)))
failed = true
}
}
if failed {
return ids, fmt.Errorf("failed to update all issues")
}
return ids, nil
}
开发者ID:petermattis,项目名称:issue,代码行数:60,代码来源:edit.go
示例4: OpenIssue
// Mark issue as open.
func OpenIssue(repo string, issue *github.Issue) (*github.Issue, error) {
temp := "open"
issue.State = &temp
closedIssue, err := EditIssue(repo, issue)
return closedIssue, err
}
开发者ID:butlerx,项目名称:AgileGit,代码行数:7,代码来源:gitissue.go
注:本文中的github.com/google/go-github/github.Issue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论