Skip to content

Commit d99698f

Browse files
committed
Fix minor code issues discovered by staticcheck
`honnef.co/go/tools/cmd/staticcheck`
1 parent a5da699 commit d99698f

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

api/queries_issue.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,5 @@ func IssueList(client *Client, ghRepo Repo, state string, labels []string, assig
203203
return nil, err
204204
}
205205

206-
issues := []Issue{}
207-
for _, issue := range resp.Repository.Issues.Nodes {
208-
issues = append(issues, issue)
209-
}
210-
return issues, nil
206+
return resp.Repository.Issues.Nodes, nil
211207
}

command/pr_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func TestPRView_NoActiveBranch(t *testing.T) {
147147
})
148148
defer restoreCmd()
149149

150-
output, err := test.RunCommand(RootCmd, "pr view")
150+
_, err := test.RunCommand(RootCmd, "pr view")
151151
if err == nil || err.Error() != "the 'master' branch has no open pull requests" {
152152
t.Errorf("error running command `pr view`: %v", err)
153153
}
@@ -157,7 +157,7 @@ func TestPRView_NoActiveBranch(t *testing.T) {
157157
}
158158

159159
// Now run again but provide a PR number
160-
output, err = test.RunCommand(RootCmd, "pr view 23")
160+
output, err := test.RunCommand(RootCmd, "pr view 23")
161161
if err != nil {
162162
t.Errorf("error running command `pr view`: %v", err)
163163
}

context/config_setup.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ func setupConfigFile(filename string) (*configEntry, error) {
6666
defer config.Close()
6767

6868
yamlData, err := yaml.Marshal(data)
69+
if err != nil {
70+
return nil, err
71+
}
6972
n, err := config.Write(yamlData)
7073
if err == nil && n < len(yamlData) {
7174
err = io.ErrShortWrite

0 commit comments

Comments
 (0)