Skip to content

Commit 292556e

Browse files
committed
refactor: Fix gocritic.paramTypeCombine lint issues
1 parent ac631dc commit 292556e

19 files changed

+69
-68
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ linters:
2929
enabled-checks:
3030
- commentedOutCode
3131
- commentFormatting
32+
- paramTypeCombine
3233
goheader:
3334
values:
3435
regexp:

example/codespaces/newreposecretwithxcrypto/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func getSecretValue(secretName string) (string, error) {
122122
//
123123
// Finally, the github.EncodedSecret is passed into the GitHub client.Codespaces.CreateOrUpdateRepoSecret method to
124124
// populate the secret in the GitHub repo.
125-
func addRepoSecret(ctx context.Context, client *github.Client, owner string, repo, secretName string, secretValue string) error {
125+
func addRepoSecret(ctx context.Context, client *github.Client, owner, repo, secretName, secretValue string) error {
126126
publicKey, _, err := client.Codespaces.GetRepoPublicKey(ctx, owner, repo)
127127
if err != nil {
128128
return err
@@ -140,7 +140,7 @@ func addRepoSecret(ctx context.Context, client *github.Client, owner string, rep
140140
return nil
141141
}
142142

143-
func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName string, secretValue string) (*github.EncryptedSecret, error) {
143+
func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretValue string) (*github.EncryptedSecret, error) {
144144
decodedPublicKey, err := base64.StdEncoding.DecodeString(publicKey.GetKey())
145145
if err != nil {
146146
return nil, fmt.Errorf("unable to decode public key: %v", err)

github/actions_workflow_runs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo
259259
// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs
260260
//
261261
//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs
262-
func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber int, maxRedirects int) (*url.URL, *Response, error) {
262+
func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber, maxRedirects int) (*url.URL, *Response, error) {
263263
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/logs", owner, repo, runID, attemptNumber)
264264

265265
if s.client.RateLimitRedirectionalEndpoints {

github/git_blobs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type Blob struct {
2626
// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob
2727
//
2828
//meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha}
29-
func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) {
29+
func (s *GitService) GetBlob(ctx context.Context, owner, repo, sha string) (*Blob, *Response, error) {
3030
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
3131
req, err := s.client.NewRequest("GET", u, nil)
3232
if err != nil {
@@ -71,7 +71,7 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([
7171
// GitHub API docs: https://docs.github.com/rest/git/blobs#create-a-blob
7272
//
7373
//meta:operation POST /repos/{owner}/{repo}/git/blobs
74-
func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) {
74+
func (s *GitService) CreateBlob(ctx context.Context, owner, repo string, blob *Blob) (*Blob, *Response, error) {
7575
u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo)
7676
req, err := s.client.NewRequest("POST", u, blob)
7777
if err != nil {

github/git_commits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (c CommitAuthor) String() string {
8484
// GitHub API docs: https://docs.github.com/rest/git/commits#get-a-commit-object
8585
//
8686
//meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha}
87-
func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) {
87+
func (s *GitService) GetCommit(ctx context.Context, owner, repo, sha string) (*Commit, *Response, error) {
8888
u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha)
8989
req, err := s.client.NewRequest("GET", u, nil)
9090
if err != nil {
@@ -126,7 +126,7 @@ type CreateCommitOptions struct {
126126
// GitHub API docs: https://docs.github.com/rest/git/commits#create-a-commit
127127
//
128128
//meta:operation POST /repos/{owner}/{repo}/git/commits
129-
func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) {
129+
func (s *GitService) CreateCommit(ctx context.Context, owner, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) {
130130
if commit == nil {
131131
return nil, nil, errors.New("commit must be provided")
132132
}

github/git_refs.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type updateRefRequest struct {
5555
// GitHub API docs: https://docs.github.com/rest/git/refs#get-a-reference
5656
//
5757
//meta:operation GET /repos/{owner}/{repo}/git/ref/{ref}
58-
func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) {
58+
func (s *GitService) GetRef(ctx context.Context, owner, repo, ref string) (*Reference, *Response, error) {
5959
ref = strings.TrimPrefix(ref, "refs/")
6060
u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref))
6161
req, err := s.client.NewRequest("GET", u, nil)
@@ -127,7 +127,7 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o
127127
// GitHub API docs: https://docs.github.com/rest/git/refs#create-a-reference
128128
//
129129
//meta:operation POST /repos/{owner}/{repo}/git/refs
130-
func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) {
130+
func (s *GitService) CreateRef(ctx context.Context, owner, repo string, ref *Reference) (*Reference, *Response, error) {
131131
if ref == nil {
132132
return nil, nil, errors.New("reference must be provided")
133133
}
@@ -159,7 +159,7 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r
159159
// GitHub API docs: https://docs.github.com/rest/git/refs#update-a-reference
160160
//
161161
//meta:operation PATCH /repos/{owner}/{repo}/git/refs/{ref}
162-
func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
162+
func (s *GitService) UpdateRef(ctx context.Context, owner, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
163163
if ref == nil {
164164
return nil, nil, errors.New("reference must be provided")
165165
}
@@ -191,7 +191,7 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r
191191
// GitHub API docs: https://docs.github.com/rest/git/refs#delete-a-reference
192192
//
193193
//meta:operation DELETE /repos/{owner}/{repo}/git/refs/{ref}
194-
func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) {
194+
func (s *GitService) DeleteRef(ctx context.Context, owner, repo, ref string) (*Response, error) {
195195
ref = strings.TrimPrefix(ref, "refs/")
196196
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref))
197197
req, err := s.client.NewRequest("DELETE", u, nil)

github/git_tags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type createTagRequest struct {
3939
// GitHub API docs: https://docs.github.com/rest/git/tags#get-a-tag
4040
//
4141
//meta:operation GET /repos/{owner}/{repo}/git/tags/{tag_sha}
42-
func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) {
42+
func (s *GitService) GetTag(ctx context.Context, owner, repo, sha string) (*Tag, *Response, error) {
4343
u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha)
4444
req, err := s.client.NewRequest("GET", u, nil)
4545
if err != nil {
@@ -60,7 +60,7 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha
6060
// GitHub API docs: https://docs.github.com/rest/git/tags#create-a-tag-object
6161
//
6262
//meta:operation POST /repos/{owner}/{repo}/git/tags
63-
func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) {
63+
func (s *GitService) CreateTag(ctx context.Context, owner, repo string, tag *Tag) (*Tag, *Response, error) {
6464
if tag == nil {
6565
return nil, nil, errors.New("tag must be provided")
6666
}

github/git_trees.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) {
9696
// GitHub API docs: https://docs.github.com/rest/git/trees#get-a-tree
9797
//
9898
//meta:operation GET /repos/{owner}/{repo}/git/trees/{tree_sha}
99-
func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
99+
func (s *GitService) GetTree(ctx context.Context, owner, repo, sha string, recursive bool) (*Tree, *Response, error) {
100100
u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
101101
if recursive {
102102
u += "?recursive=1"
@@ -129,7 +129,7 @@ type createTree struct {
129129
// GitHub API docs: https://docs.github.com/rest/git/trees#create-a-tree
130130
//
131131
//meta:operation POST /repos/{owner}/{repo}/git/trees
132-
func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) {
132+
func (s *GitService) CreateTree(ctx context.Context, owner, repo, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) {
133133
u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)
134134

135135
newEntries := make([]any, 0, len(entries))

github/github_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func testFormValues(t *testing.T, r *http.Request, values values) {
132132
}
133133
}
134134

135-
func testHeader(t *testing.T, r *http.Request, header string, want string) {
135+
func testHeader(t *testing.T, r *http.Request, header, want string) {
136136
t.Helper()
137137
if got := r.Header.Get(header); got != want {
138138
t.Errorf("Header.Get(%q) returned %q, want %q", header, got, want)

github/issues.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ type IssueListByRepoOptions struct {
250250
// GitHub API docs: https://docs.github.com/rest/issues/issues#list-repository-issues
251251
//
252252
//meta:operation GET /repos/{owner}/{repo}/issues
253-
func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) {
253+
func (s *IssuesService) ListByRepo(ctx context.Context, owner, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) {
254254
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
255255
u, err := addOptions(u, opts)
256256
if err != nil {
@@ -279,7 +279,7 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
279279
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
280280
//
281281
//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}
282-
func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) {
282+
func (s *IssuesService) Get(ctx context.Context, owner, repo string, number int) (*Issue, *Response, error) {
283283
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
284284
req, err := s.client.NewRequest("GET", u, nil)
285285
if err != nil {
@@ -303,7 +303,7 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
303303
// GitHub API docs: https://docs.github.com/rest/issues/issues#create-an-issue
304304
//
305305
//meta:operation POST /repos/{owner}/{repo}/issues
306-
func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) {
306+
func (s *IssuesService) Create(ctx context.Context, owner, repo string, issue *IssueRequest) (*Issue, *Response, error) {
307307
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
308308
req, err := s.client.NewRequest("POST", u, issue)
309309
if err != nil {
@@ -324,7 +324,7 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i
324324
// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue
325325
//
326326
//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}
327-
func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) {
327+
func (s *IssuesService) Edit(ctx context.Context, owner, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) {
328328
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
329329
req, err := s.client.NewRequest("PATCH", u, issue)
330330
if err != nil {
@@ -379,7 +379,7 @@ type LockIssueOptions struct {
379379
// GitHub API docs: https://docs.github.com/rest/issues/issues#lock-an-issue
380380
//
381381
//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock
382-
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) {
382+
func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int, opts *LockIssueOptions) (*Response, error) {
383383
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
384384
req, err := s.client.NewRequest("PUT", u, opts)
385385
if err != nil {
@@ -394,7 +394,7 @@ func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, num
394394
// GitHub API docs: https://docs.github.com/rest/issues/issues#unlock-an-issue
395395
//
396396
//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock
397-
func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
397+
func (s *IssuesService) Unlock(ctx context.Context, owner, repo string, number int) (*Response, error) {
398398
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
399399
req, err := s.client.NewRequest("DELETE", u, nil)
400400
if err != nil {

0 commit comments

Comments
 (0)