Merge pull request #113 from github/staticcheck

Fix minor code issues discovered by staticcheck
This commit is contained in:
Mislav Marohnić 2019-11-26 18:31:43 +01:00 committed by GitHub
commit b21b93abe9
3 changed files with 6 additions and 7 deletions

View file

@ -203,9 +203,5 @@ func IssueList(client *Client, ghRepo Repo, state string, labels []string, assig
return nil, err
}
issues := []Issue{}
for _, issue := range resp.Repository.Issues.Nodes {
issues = append(issues, issue)
}
return issues, nil
return resp.Repository.Issues.Nodes, nil
}

View file

@ -147,7 +147,7 @@ func TestPRView_NoActiveBranch(t *testing.T) {
})
defer restoreCmd()
output, err := test.RunCommand(RootCmd, "pr view")
_, err := test.RunCommand(RootCmd, "pr view")
if err == nil || err.Error() != "the 'master' branch has no open pull requests" {
t.Errorf("error running command `pr view`: %v", err)
}
@ -157,7 +157,7 @@ func TestPRView_NoActiveBranch(t *testing.T) {
}
// Now run again but provide a PR number
output, err = test.RunCommand(RootCmd, "pr view 23")
output, err := test.RunCommand(RootCmd, "pr view 23")
if err != nil {
t.Errorf("error running command `pr view`: %v", err)
}

View file

@ -66,6 +66,9 @@ func setupConfigFile(filename string) (*configEntry, error) {
defer config.Close()
yamlData, err := yaml.Marshal(data)
if err != nil {
return nil, err
}
n, err := config.Write(yamlData)
if err == nil && n < len(yamlData) {
err = io.ErrShortWrite