Skip to content

Commit

Permalink
Follow github changes after updating
Browse files Browse the repository at this point in the history
`go vet` fails due to github library changes::

k8s.io/test-infra/ghclient
 ghclient/core.go:60:14: cannot use client.Repositories
   (type *github.RepositoriesService) as type repositoryService
   in field value:
 *github.RepositoriesService does not implement repositoryService
   (wrong type for ListCollaborators method)
   have ListCollaborators(context.Context, string, string, *github.ListCollaboratorsOptions)
      ([]*github.User *github.Response, error)
   want ListCollaborators(context.Context, string, string, *github.ListOptions)
      ([]*github.User, *github.Response error)

This patch makes ghclient follow these changes.
  • Loading branch information
Ken'ichi Ohmichi committed Dec 16, 2017
1 parent bb55455 commit ff51904
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ghclient/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type pullRequestService interface {
type repositoryService interface {
CreateStatus(ctx context.Context, org, repo, ref string, status *github.RepoStatus) (*github.RepoStatus, *github.Response, error)
GetCombinedStatus(ctx context.Context, org, repo, ref string, opt *github.ListOptions) (*github.CombinedStatus, *github.Response, error)
ListCollaborators(ctx context.Context, owner, repo string, opt *github.ListOptions) ([]*github.User, *github.Response, error)
ListCollaborators(ctx context.Context, owner, repo string, opt *github.ListCollaboratorsOptions) ([]*github.User, *github.Response, error)
}

type usersService interface {
Expand Down Expand Up @@ -144,11 +144,12 @@ func (c *Client) ForEachPR(owner, repo string, opts *github.PullRequestListOptio
// GetCollaborators returns all github users who are members or outside collaborators of the repo.
func (c *Client) GetCollaborators(org, repo string) ([]*github.User, error) {
opts := &github.ListOptions{}
copts := &github.ListCollaboratorsOptions{}
collaborators, err := c.depaginate(
fmt.Sprintf("getting collaborators for '%s/%s'", org, repo),
opts,
func() ([]interface{}, *github.Response, error) {
page, resp, err := c.repoService.ListCollaborators(context.Background(), org, repo, opts)
page, resp, err := c.repoService.ListCollaborators(context.Background(), org, repo, copts)

var interfaceList []interface{}
if err == nil {
Expand Down

0 comments on commit ff51904

Please sign in to comment.