зеркало из https://github.com/mislav/hub.git
Fix go vet
This commit is contained in:
Родитель
942d996910
Коммит
c4de7b63b9
|
@ -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]
|
||||
|
|
|
@ -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) {
|
||||
|
|
2
main.go
2
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)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче