diff --git a/.gitignore b/.gitignore index 3ed546c..a99e6fb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ github-closer nohup.out !.gitkeep +/vendor diff --git a/Makefile b/Makefile index 7011ba1..c60ab79 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ setup: - go get -u github.com/google/go-github/github - go get -u github.com/jessevdk/go-flags - go get -u github.com/joho/godotenv - go get -u golang.org/x/oauth2 + go get -u github.com/golang/dep/... + dep ensure build: go build diff --git a/issue_manager.go b/issue_manager.go index 5886cd0..08fbe57 100644 --- a/issue_manager.go +++ b/issue_manager.go @@ -1,6 +1,7 @@ package main import ( + "context" "errors" "fmt" "github.com/google/go-github/github" @@ -38,7 +39,7 @@ func NewIssueManager(organization string, repository string, team string, token func (im *IssueManager) FindIssues(spec string) ([]*github.Issue, error) { queryString := im.buildQuery(spec) - searchResult, _, err := im.Client.Search.Issues(queryString, &github.SearchOptions{}) + searchResult, _, err := im.Client.Search.Issues(context.Background(), queryString, &github.SearchOptions{}) if err != nil { return nil, err } @@ -74,7 +75,7 @@ func (im *IssueManager) Close(issue *github.Issue) (*github.Issue, error) { issueRequest := &github.IssueRequest{} issueRequest.State = String("closed") - i, _, err := im.Client.Issues.Edit(im.Organization, im.Repository, *issue.Number, issueRequest) + i, _, err := im.Client.Issues.Edit(context.Background(), im.Organization, im.Repository, *issue.Number, issueRequest) return i, err } @@ -90,20 +91,20 @@ func (im *IssueManager) isUpdatedWithinDuration(issue *github.Issue) bool { func (im *IssueManager) Comment(issue *github.Issue, comment string) bool { ic := &github.IssueComment{Body: &comment} - _, _, err := im.Client.Issues.CreateComment(im.Organization, im.Repository, *issue.Number, ic) + _, _, err := im.Client.Issues.CreateComment(context.Background(), im.Organization, im.Repository, *issue.Number, ic) return err != nil } func (im *IssueManager) findUsersByTeamName(name string) ([]*github.User, error) { - teams, _, err := im.Client.Repositories.ListTeams(im.Organization, im.Repository, nil) + teams, _, err := im.Client.Repositories.ListTeams(context.Background(), im.Organization, im.Repository, nil) if err != nil { return nil, err } for _, t := range teams { if *t.Name == name { - users, _, err := im.Client.Organizations.ListTeamMembers(*t.ID, &github.OrganizationListTeamMembersOptions{}) + users, _, err := im.Client.Organizations.ListTeamMembers(context.Background(), *t.ID, &github.OrganizationListTeamMembersOptions{}) return users, err } } diff --git a/lock.json b/lock.json new file mode 100644 index 0000000..343f68b --- /dev/null +++ b/lock.json @@ -0,0 +1,76 @@ +{ + "memo": "9a281f8bd9bc5bca5f1ad41c0db67aa22119add0d9ff15a6f550a9b38c4450e0", + "projects": [ + { + "name": "github.com/golang/protobuf", + "branch": "master", + "revision": "c9c7427a2a70d2eb3bafa0ab2dc163e45f143317", + "packages": [ + "proto" + ] + }, + { + "name": "github.com/google/go-github", + "branch": "master", + "revision": "69fd0adc8ab606780549a072f2e3b3f795d75832", + "packages": [ + "github" + ] + }, + { + "name": "github.com/google/go-querystring", + "branch": "master", + "revision": "53e6ce116135b80d037921a7fdd5138cf32d7a8a", + "packages": [ + "query" + ] + }, + { + "name": "github.com/jessevdk/go-flags", + "version": "v1.2.0", + "revision": "48cf8722c3375517aba351d1f7577c40663a4407", + "packages": [ + "." + ] + }, + { + "name": "github.com/joho/godotenv", + "version": "v1.1", + "revision": "726cc8b906e3d31c70a9671c90a13716a8d3f50d", + "packages": [ + "." + ] + }, + { + "name": "golang.org/x/net", + "branch": "master", + "revision": "a6577fac2d73be281a500b310739095313165611", + "packages": [ + "context" + ] + }, + { + "name": "golang.org/x/oauth2", + "branch": "master", + "revision": "1611bb46e67abc64a71ecc5c3ae67f1cbbc2b921", + "packages": [ + ".", + "internal" + ] + }, + { + "name": "google.golang.org/appengine", + "version": "v1.0.0", + "revision": "150dc57a1b433e64154302bdc40b6bb8aefa313a", + "packages": [ + "internal", + "internal/base", + "internal/datastore", + "internal/log", + "internal/remote_api", + "internal/urlfetch", + "urlfetch" + ] + } + ] +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/manifest.json @@ -0,0 +1 @@ +{}