From c4de7b63b9d91bfa74ee976948d166047accd5e9 Mon Sep 17 00:00:00 2001 From: Jingwen Owen Ou Date: Sat, 20 Jul 2013 07:41:43 -0700 Subject: [PATCH] Fix go vet --- commands/cherry_pick.go | 3 +-- github/github.go | 12 ++++++------ main.go | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/commands/cherry_pick.go b/commands/cherry_pick.go index 916cb1cc..75102fd8 100644 --- a/commands/cherry_pick.go +++ b/commands/cherry_pick.go @@ -1,7 +1,6 @@ package commands import ( - "fmt" "github.com/jingweno/gh/github" "regexp" ) @@ -64,7 +63,7 @@ func parseCherryPickProjectAndSha(ref string) (project *github.Project, sha stri } } - ownerWithShaRegexp := regexp.MustCompile(fmt.Sprintf("^(%s)@([a-f0-9]{7,40})$")) + ownerWithShaRegexp := regexp.MustCompile("^(%s)@([a-f0-9]{7,40})$") if ownerWithShaRegexp.MatchString(ref) { matches := ownerWithShaRegexp.FindStringSubmatch(ref) sha = matches[2] diff --git a/github/github.go b/github/github.go index 091275d8..65f8cfee 100644 --- a/github/github.go +++ b/github/github.go @@ -24,7 +24,7 @@ func (gh *GitHub) PullRequest(id string) (*octokat.PullRequest, error) { func (gh *GitHub) CreatePullRequest(base, head, title, body string) (string, error) { client := gh.client() - params := octokat.PullRequestParams{base, head, title, body} + params := octokat.PullRequestParams{Base: base, Head: head, Title: title, Body: body} pullRequest, err := client.CreatePullRequest(gh.repo(), params) if err != nil { return "", err @@ -36,7 +36,7 @@ func (gh *GitHub) CreatePullRequest(base, head, title, body string) (string, err func (gh *GitHub) Repository(project Project) (*octokat.Repository, error) { client := gh.client() - return client.Repository(octokat.Repo{project.Name, project.Owner}) + return client.Repository(octokat.Repo{Name: project.Name, UserName: project.Owner}) } // TODO: detach GitHub from Project @@ -59,7 +59,7 @@ func (gh *GitHub) CreateRepository(project Project, description, homepage string func (gh *GitHub) CreatePullRequestForIssue(base, head, issue string) (string, error) { client := gh.client() - params := octokat.PullRequestForIssueParams{base, head, issue} + params := octokat.PullRequestForIssueParams{Base: base, Head: head, Issue: issue} pullRequest, err := client.CreatePullRequestForIssue(gh.repo(), params) if err != nil { return "", err @@ -85,14 +85,14 @@ func (gh *GitHub) CiStatus(sha string) (*octokat.Status, error) { func (gh *GitHub) ForkRepository(name, owner string, noRemote bool) (repo *octokat.Repository, err error) { client := gh.client() config := gh.Config - repo, err = client.Repository(octokat.Repo{name, config.User}) + repo, err = client.Repository(octokat.Repo{Name: name, UserName: config.User}) if repo != nil && err == nil { msg := fmt.Sprintf("Error creating fork: %s exists on %s", repo.FullName, GitHubHost) err = errors.New(msg) return } - repo, err = client.Fork(octokat.Repo{name, owner}, nil) + repo, err = client.Fork(octokat.Repo{Name: name, UserName: owner}, nil) return } @@ -109,7 +109,7 @@ func (gh *GitHub) ExpandRemoteUrl(owner, name string, isSSH bool) (url string) { func (gh *GitHub) repo() octokat.Repo { project := gh.Project - return octokat.Repo{project.Name, project.Owner} + return octokat.Repo{Name: project.Name, UserName: project.Owner} } func findOrCreateToken(user, password string) (string, error) { diff --git a/main.go b/main.go index 5e0dea5f..4872ad08 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,7 @@ import ( ) func main() { - runner := commands.Runner{os.Args[1:]} + runner := commands.Runner{Args: os.Args[1:]} err := runner.Execute() utils.Check(err) }