本文整理匯總了Golang中k8s/io/contrib/mungegithub/github.Config.GetObject方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.GetObject方法的具體用法?Golang Config.GetObject怎麽用?Golang Config.GetObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/contrib/mungegithub/github.Config
的用法示例。
在下文中一共展示了Config.GetObject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: getCherrypickParentPRs
func getCherrypickParentPRs(obj *github.MungeObject, config *github.Config) []*github.MungeObject {
out := []*github.MungeObject{}
if obj.Issue.Body == nil {
glog.Errorf("Found a nil body in %d", *obj.Issue.Number)
return nil
}
body := *obj.Issue.Body
// foundOne tracks if we found any valid lines. PR without any valid lines
// shouldn't get autolabeled.
lines := strings.Split(body, "\n")
for _, line := range lines {
matches := cpRe.FindStringSubmatch(line)
if len(matches) != 3 {
glog.V(6).Infof("%d: line:%v len(matches)=%d", *obj.Issue.Number, line, len(matches))
continue
}
parentPRNum, err := strconv.Atoi(matches[1])
if err != nil {
glog.Errorf("%d: Unable to convert %q to parent PR number", *obj.Issue.Number, matches[1])
return nil
}
parentPR, err := config.GetObject(parentPRNum)
if err != nil {
glog.Errorf("Unable to get object for %d", parentPRNum)
return nil
}
out = append(out, parentPR)
}
return out
}