Skip to content

Commit 14b70d5

Browse files
Fix linters issues (#2104)
1 parent e880e71 commit 14b70d5

13 files changed

+16
-24
lines changed

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ linters:
1111
# - gosec
1212
- misspell
1313
- nakedret
14-
# - stylecheck
14+
- stylecheck
1515
# - unconvert
1616
# - unparam
17-
# - whitespace
17+
- whitespace
1818
disable:
1919
- errcheck
2020
- gosimple

example/commitpr/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ func getRef() (ref *github.Reference, err error) {
6767
// We consider that an error means the branch has not been found and needs to
6868
// be created.
6969
if *commitBranch == *baseBranch {
70-
return nil, errors.New("The commit branch does not exist but `-base-branch` is the same as `-commit-branch`")
70+
return nil, errors.New("the commit branch does not exist but `-base-branch` is the same as `-commit-branch`")
7171
}
7272

7373
if *baseBranch == "" {
74-
return nil, errors.New("The `-base-branch` should not be set to an empty string when the branch specified by `-commit-branch` does not exists")
74+
return nil, errors.New("the `-base-branch` should not be set to an empty string when the branch specified by `-commit-branch` does not exists")
7575
}
7676

7777
var baseRef *github.Reference

github/actions_workflow_jobs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,4 @@ func (s *ActionsService) getWorkflowLogsFromURL(ctx context.Context, u string, f
147147
resp, err = s.getWorkflowLogsFromURL(ctx, u, false)
148148
}
149149
return resp, err
150-
151150
}

github/actions_workflow_runs_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ func TestActionService_ListRepositoryWorkflowRuns(t *testing.T) {
295295
"workflow_runs":[
296296
{"id":298499444,"run_number":301,"created_at":"2020-04-11T11:14:54Z","updated_at":"2020-04-11T11:14:54Z"},
297297
{"id":298499445,"run_number":302,"created_at":"2020-04-11T11:14:54Z","updated_at":"2020-04-11T11:14:54Z"}]}`)
298-
299298
})
300299

301300
opts := &ListWorkflowRunsOptions{ListOptions: ListOptions{Page: 2, PerPage: 2}}

github/enterprise_audit_log_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,4 @@ func TestEnterpriseService_GetAuditLog(t *testing.T) {
9696
}
9797
return resp, err
9898
})
99-
10099
}

github/github.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,10 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rat
708708
return nil
709709
}
710710

711-
// compareHttpResponse returns whether two http.Response objects are equal or not.
711+
// compareHTTPResponse returns whether two http.Response objects are equal or not.
712712
// Currently, only StatusCode is checked. This function is used when implementing the
713713
// Is(error) bool interface for the custom error types in this package.
714-
func compareHttpResponse(r1, r2 *http.Response) bool {
714+
func compareHTTPResponse(r1, r2 *http.Response) bool {
715715
if r1 == nil && r2 == nil {
716716
return true
717717
}
@@ -761,7 +761,7 @@ func (r *ErrorResponse) Is(target error) bool {
761761
}
762762

763763
if r.Message != v.Message || (r.DocumentationURL != v.DocumentationURL) ||
764-
!compareHttpResponse(r.Response, v.Response) {
764+
!compareHTTPResponse(r.Response, v.Response) {
765765
return false
766766
}
767767

@@ -827,7 +827,7 @@ func (r *RateLimitError) Is(target error) bool {
827827

828828
return r.Rate == v.Rate &&
829829
r.Message == v.Message &&
830-
compareHttpResponse(r.Response, v.Response)
830+
compareHTTPResponse(r.Response, v.Response)
831831
}
832832

833833
// AcceptedError occurs when GitHub returns 202 Accepted response with an
@@ -881,7 +881,7 @@ func (r *AbuseRateLimitError) Is(target error) bool {
881881

882882
return r.Message == v.Message &&
883883
r.RetryAfter == v.RetryAfter &&
884-
compareHttpResponse(r.Response, v.Response)
884+
compareHTTPResponse(r.Response, v.Response)
885885
}
886886

887887
// sanitizeURL redacts the client_secret parameter from the URL which may be

github/github_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ func TestCompareHttpResponse(t *testing.T) {
12291229

12301230
for name, tc := range testcases {
12311231
t.Run(name, func(t *testing.T) {
1232-
v := compareHttpResponse(tc.h1, tc.h2)
1232+
v := compareHTTPResponse(tc.h1, tc.h2)
12331233
if tc.expected != v {
12341234
t.Errorf("Expected %t, got %t for (%#v, %#v)", tc.expected, v, tc.h1, tc.h2)
12351235
}
@@ -2028,7 +2028,6 @@ func TestAddOptions_QueryValues(t *testing.T) {
20282028
}
20292029

20302030
func TestBareDo_returnsOpenBody(t *testing.T) {
2031-
20322031
client, mux, _, teardown := setup()
20332032
defer teardown()
20342033

github/messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func ValidatePayloadFromBody(contentType string, readable io.Reader, signature s
192192
payload = []byte(form.Get(payloadFormParam))
193193

194194
default:
195-
return nil, fmt.Errorf("Webhook request has unsupported Content-Type %q", contentType)
195+
return nil, fmt.Errorf("webhook request has unsupported Content-Type %q", contentType)
196196
}
197197

198198
// Only validate the signature if a secret token exists. This is intended for

github/orgs_audit_log_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ func TestOrganizationService_GetAuditLog(t *testing.T) {
110110
}
111111
return resp, err
112112
})
113-
114113
}
115114

116115
func TestGetAuditLogOptions_Marshal(t *testing.T) {

github/orgs_members_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,6 @@ func TestOrganizationsService_CreateOrgInvitation(t *testing.T) {
655655
}
656656

657657
fmt.Fprintln(w, `{"email": "octocat@github.com"}`)
658-
659658
})
660659

661660
ctx := context.Background()

0 commit comments

Comments
 (0)