本文整理匯總了Golang中github.com/google/go-github/github.IssueListByRepoOptions.ListOptions方法的典型用法代碼示例。如果您正苦於以下問題:Golang IssueListByRepoOptions.ListOptions方法的具體用法?Golang IssueListByRepoOptions.ListOptions怎麽用?Golang IssueListByRepoOptions.ListOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/go-github/github.IssueListByRepoOptions
的用法示例。
在下文中一共展示了IssueListByRepoOptions.ListOptions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ListAllIssues
// ListAllIssues grabs all issues matching the options, so you don't have to
// worry about paging. Enforces some constraints, like min/max PR number and
// having a valid user.
func (config *Config) ListAllIssues(listOpts *github.IssueListByRepoOptions) ([]*github.Issue, error) {
allIssues := []*github.Issue{}
page := 1
for {
glog.V(4).Infof("Fetching page %d of issues", page)
listOpts.ListOptions = github.ListOptions{PerPage: 100, Page: page}
issues, response, err := config.client.Issues.ListByRepo(config.Org, config.Project, listOpts)
config.analytics.ListIssues.Call(config, response)
if err != nil {
return nil, err
}
for i := range issues {
issue := &issues[i]
if issue.Number == nil {
glog.Infof("Skipping issue with no number, very strange")
continue
}
if issue.User == nil || issue.User.Login == nil {
glog.V(2).Infof("Skipping PR %d with no user info %#v.", *issue.Number, issue.User)
continue
}
if *issue.Number < config.MinPRNumber {
glog.V(6).Infof("Dropping %d < %d", *issue.Number, config.MinPRNumber)
continue
}
if *issue.Number > config.MaxPRNumber {
glog.V(6).Infof("Dropping %d > %d", *issue.Number, config.MaxPRNumber)
continue
}
allIssues = append(allIssues, issue)
}
if response.LastPage == 0 || response.LastPage <= page {
break
}
page++
}
return allIssues, nil
}