From 2c280702ad69748d3c8e2e751d30e8119b93bb8e Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Wed, 25 Jun 2025 16:39:41 +0300 Subject: [PATCH] refactor: fix revive.unused-parameter lint issues --- .golangci.yml | 1 + github/actions_artifacts_test.go | 4 +- github/actions_cache_test.go | 4 +- github/actions_runner_groups_test.go | 14 +++--- github/actions_runners_test.go | 4 +- github/actions_secrets_test.go | 12 ++--- github/actions_variables_test.go | 12 ++--- github/actions_workflow_jobs_test.go | 2 +- github/actions_workflows_test.go | 12 ++--- github/activity_star_test.go | 4 +- github/admin_users_test.go | 4 +- github/authorizations_test.go | 4 +- github/codespaces_secrets_test.go | 18 ++++---- github/codespaces_test.go | 2 +- github/dependabot_secrets_test.go | 10 ++-- .../enterprise_actions_runner_groups_test.go | 14 +++--- github/enterprise_actions_runners_test.go | 2 +- ...erprise_code_security_and_analysis_test.go | 4 +- github/enterprise_manage_ghes_config_test.go | 2 +- .../enterprise_network_configurations_test.go | 2 +- github/enterprise_properties_test.go | 2 +- github/enterprise_rules_test.go | 2 +- github/gists_comments_test.go | 2 +- github/gists_test.go | 6 +-- github/git_commits_test.go | 2 +- github/git_refs_test.go | 2 +- github/github.go | 2 +- github/github_test.go | 46 +++++++++---------- github/interactions_orgs_test.go | 2 +- github/interactions_repos_test.go | 2 +- github/issues_assignees_test.go | 2 +- github/issues_comments_test.go | 2 +- github/issues_labels_test.go | 6 +-- github/issues_milestones_test.go | 2 +- github/messages_test.go | 2 +- github/migrations.go | 2 +- github/migrations_user.go | 2 +- github/orgs_hooks_test.go | 4 +- github/orgs_issue_types_test.go | 2 +- github/orgs_members_test.go | 6 +-- github/orgs_network_configurations_test.go | 2 +- github/orgs_outside_collaborators_test.go | 4 +- github/orgs_packages_test.go | 8 ++-- github/orgs_properties_test.go | 4 +- github/orgs_rules_test.go | 2 +- github/orgs_security_managers_test.go | 4 +- github/orgs_test.go | 2 +- github/pulls_comments_test.go | 2 +- github/pulls_reviewers_test.go | 4 +- github/pulls_test.go | 4 +- github/rate_limit_test.go | 2 +- github/repos_actions_access_test.go | 2 +- github/repos_comments_test.go | 2 +- github/repos_contents_test.go | 4 +- .../repos_deployment_branch_policies_test.go | 6 +-- github/repos_environments_test.go | 2 +- github/repos_hooks_test.go | 10 ++-- github/repos_keys_test.go | 2 +- github/repos_pages_test.go | 2 +- github/repos_prereceive_hooks_test.go | 2 +- github/repos_releases.go | 2 +- github/repos_releases_test.go | 4 +- github/repos_rules_test.go | 2 +- github/repos_test.go | 10 ++-- github/scim.go | 2 +- github/teams_discussion_comments_test.go | 2 +- github/teams_discussions_test.go | 4 +- github/teams_test.go | 4 +- github/users_emails_test.go | 2 +- github/users_followers_test.go | 4 +- github/users_gpg_keys_test.go | 2 +- github/users_keys_test.go | 2 +- github/users_packages_test.go | 16 +++---- github/users_ssh_signing_keys_test.go | 2 +- scrape/apps.go | 2 +- scrape/apps_test.go | 8 ++-- scrape/forms_test.go | 4 +- scrape/payment.go | 2 +- tools/sliceofpointers/sliceofpointers.go | 2 +- 79 files changed, 188 insertions(+), 187 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index baef17feda4..bf47cb3b643 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -98,6 +98,7 @@ linters: - name: unexported-naming - name: unexported-return - name: unreachable-code + - name: unused-parameter - name: use-any - name: var-declaration - name: var-naming diff --git a/github/actions_artifacts_test.go b/github/actions_artifacts_test.go index 6becfcf79d5..efb84011f5d 100644 --- a/github/actions_artifacts_test.go +++ b/github/actions_artifacts_test.go @@ -320,7 +320,7 @@ func TestActionsService_DownloadArtifact(t *testing.T) { }) // Add custom round tripper - client.client.Transport = roundTripperFunc(func(r *http.Request) (*http.Response, error) { + client.client.Transport = roundTripperFunc(func(*http.Request) (*http.Response, error) { return nil, errors.New("failed to download artifact") }) // propagate custom round tripper to client without CheckRedirect @@ -529,7 +529,7 @@ func TestActionsService_DeleteArtifact(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/artifacts/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/artifacts/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/actions_cache_test.go b/github/actions_cache_test.go index 4831b612c4a..7cad1445425 100644 --- a/github/actions_cache_test.go +++ b/github/actions_cache_test.go @@ -100,7 +100,7 @@ func TestActionsService_DeleteCachesByKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/caches", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/caches", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testFormValues(t, r, values{"key": "1", "ref": "main"}) }) @@ -162,7 +162,7 @@ func TestActionsService_DeleteCachesByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/caches/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/caches/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/actions_runner_groups_test.go b/github/actions_runner_groups_test.go index c7154b74e0a..c16836e7442 100644 --- a/github/actions_runner_groups_test.go +++ b/github/actions_runner_groups_test.go @@ -153,7 +153,7 @@ func TestActionsService_DeleteOrganizationRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runner-groups/2", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -328,7 +328,7 @@ func TestActionsService_SetRepositoryAccessRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runner-groups/2/repositories", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runner-groups/2/repositories", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -360,7 +360,7 @@ func TestActionsService_AddRepositoryAccessRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runner-groups/2/repositories/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runner-groups/2/repositories/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -385,7 +385,7 @@ func TestActionsService_RemoveRepositoryAccessRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runner-groups/2/repositories/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runner-groups/2/repositories/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -453,7 +453,7 @@ func TestActionsService_SetRunnerGroupRunners(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runner-groups/2/runners", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runner-groups/2/runners", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -485,7 +485,7 @@ func TestActionsService_AddRunnerGroupRunners(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runner-groups/2/runners/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runner-groups/2/runners/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -510,7 +510,7 @@ func TestActionsService_RemoveRunnerGroupRunners(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runner-groups/2/runners/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runner-groups/2/runners/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index 4c174d3c878..48c3cdfff03 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -306,7 +306,7 @@ func TestActionsService_RemoveRunner(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/runners/21", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/runners/21", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -529,7 +529,7 @@ func TestActionsService_RemoveOrganizationRunner(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/runners/21", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/runners/21", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/actions_secrets_test.go b/github/actions_secrets_test.go index ec23f3b52c3..64437260c3d 100644 --- a/github/actions_secrets_test.go +++ b/github/actions_secrets_test.go @@ -325,7 +325,7 @@ func TestActionsService_DeleteRepoSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/secrets/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -546,7 +546,7 @@ func TestActionsService_SetSelectedReposForOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/secrets/NAME/repositories", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/secrets/NAME/repositories", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testHeader(t, r, "Content-Type", "application/json") testBody(t, r, `{"selected_repository_ids":[64780797]}`+"\n") @@ -573,7 +573,7 @@ func TestActionsService_AddSelectedRepoToOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -599,7 +599,7 @@ func TestActionsService_RemoveSelectedRepoFromOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -625,7 +625,7 @@ func TestActionsService_DeleteOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/secrets/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -835,7 +835,7 @@ func TestActionsService_DeleteEnvSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repositories/1/environments/e/secrets/secret", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repositories/1/environments/e/secrets/secret", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/actions_variables_test.go b/github/actions_variables_test.go index 5a1813ab73d..83c1b8cce64 100644 --- a/github/actions_variables_test.go +++ b/github/actions_variables_test.go @@ -209,7 +209,7 @@ func TestActionsService_DeleteRepoVariable(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/variables/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/variables/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -429,7 +429,7 @@ func TestActionsService_SetSelectedReposForOrgSVariable(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/variables/NAME/repositories", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/variables/NAME/repositories", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testHeader(t, r, "Content-Type", "application/json") testBody(t, r, `{"selected_repository_ids":[64780797]}`+"\n") @@ -456,7 +456,7 @@ func TestActionsService_AddSelectedRepoToOrgVariable(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/variables/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/variables/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -482,7 +482,7 @@ func TestActionsService_RemoveSelectedRepoFromOrgVariable(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/variables/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/variables/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -508,7 +508,7 @@ func TestActionsService_DeleteOrgVariable(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/actions/variables/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/actions/variables/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -680,7 +680,7 @@ func TestActionsService_DeleteEnvVariable(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/usr/1/environments/e/variables/variable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/usr/1/environments/e/variables/variable", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index ccc8ae8bf91..85aaa2b6bbe 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -230,7 +230,7 @@ func TestActionsService_GetWorkflowJobLogs(t *testing.T) { }) // Add custom round tripper - client.client.Transport = roundTripperFunc(func(r *http.Request) (*http.Response, error) { + client.client.Transport = roundTripperFunc(func(*http.Request) (*http.Response, error) { return nil, errors.New("failed to get workflow logs") }) // propagate custom round tripper to client without CheckRedirect diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index 46e904b3747..fddf6b70c5f 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -241,7 +241,7 @@ func TestActionsService_CreateWorkflowDispatchEventByID(t *testing.T) { "key": "value", }, } - mux.HandleFunc("/repos/o/r/actions/workflows/72844/dispatches", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/72844/dispatches", func(_ http.ResponseWriter, r *http.Request) { var v CreateWorkflowDispatchEventRequest assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) @@ -285,7 +285,7 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName(t *testing.T) { "key": "value", }, } - mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/dispatches", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/dispatches", func(_ http.ResponseWriter, r *http.Request) { var v CreateWorkflowDispatchEventRequest assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) @@ -323,7 +323,7 @@ func TestActionsService_EnableWorkflowByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/workflows/72844/enable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/72844/enable", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") if r.Body != http.NoBody { t.Errorf("Request body = %+v, want %+v", r.Body, http.NoBody) @@ -358,7 +358,7 @@ func TestActionsService_EnableWorkflowByFilename(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/enable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/enable", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") if r.Body != http.NoBody { t.Errorf("Request body = %+v, want %+v", r.Body, http.NoBody) @@ -393,7 +393,7 @@ func TestActionsService_DisableWorkflowByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/workflows/72844/disable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/72844/disable", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") if r.Body != http.NoBody { t.Errorf("Request body = %+v, want %+v", r.Body, http.NoBody) @@ -428,7 +428,7 @@ func TestActionsService_DisableWorkflowByFileName(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/disable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/disable", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") if r.Body != http.NoBody { t.Errorf("Request body = %+v, want %+v", r.Body, http.NoBody) diff --git a/github/activity_star_test.go b/github/activity_star_test.go index 57b3ef6521e..6a3d90ef5ea 100644 --- a/github/activity_star_test.go +++ b/github/activity_star_test.go @@ -222,7 +222,7 @@ func TestActivityService_Star(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/starred/o/r", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/starred/o/r", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -256,7 +256,7 @@ func TestActivityService_Unstar(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/starred/o/r", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/starred/o/r", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/admin_users_test.go b/github/admin_users_test.go index 4806c53461e..4140f0f8594 100644 --- a/github/admin_users_test.go +++ b/github/admin_users_test.go @@ -66,7 +66,7 @@ func TestAdminUsers_Delete(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/admin/users/github", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/admin/users/github", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -163,7 +163,7 @@ func TestUserImpersonation_Delete(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/admin/users/github/authorizations", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/admin/users/github/authorizations", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/authorizations_test.go b/github/authorizations_test.go index 1a0612a5080..5c9322a71db 100644 --- a/github/authorizations_test.go +++ b/github/authorizations_test.go @@ -120,7 +120,7 @@ func TestDeleteGrant(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/applications/id/grant", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/applications/id/grant", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testBody(t, r, `{"access_token":"a"}`+"\n") testHeader(t, r, "Accept", mediaTypeOAuthAppPreview) @@ -183,7 +183,7 @@ func TestAuthorizationsService_DeleteImpersonation(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/admin/users/u/authorizations", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/admin/users/u/authorizations", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/codespaces_secrets_test.go b/github/codespaces_secrets_test.go index 2c8ae931b00..551cb1f6699 100644 --- a/github/codespaces_secrets_test.go +++ b/github/codespaces_secrets_test.go @@ -319,7 +319,7 @@ func TestCodespacesService_DeleteSecret(t *testing.T) { { name: "User", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/user/codespaces/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/codespaces/secrets/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) }, @@ -331,7 +331,7 @@ func TestCodespacesService_DeleteSecret(t *testing.T) { { name: "Org", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/orgs/o/codespaces/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/codespaces/secrets/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) }, @@ -346,7 +346,7 @@ func TestCodespacesService_DeleteSecret(t *testing.T) { { name: "Repo", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/repos/o/r/codespaces/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/codespaces/secrets/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) }, @@ -579,7 +579,7 @@ func TestCodespacesService_SetSelectedReposForSecret(t *testing.T) { { name: "User", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/user/codespaces/secrets/NAME/repositories", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/codespaces/secrets/NAME/repositories", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testHeader(t, r, "Content-Type", "application/json") testBody(t, r, `{"selected_repository_ids":[64780797]}`+"\n") @@ -593,7 +593,7 @@ func TestCodespacesService_SetSelectedReposForSecret(t *testing.T) { { name: "Org", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/orgs/o/codespaces/secrets/NAME/repositories", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/codespaces/secrets/NAME/repositories", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testHeader(t, r, "Content-Type", "application/json") testBody(t, r, `{"selected_repository_ids":[64780797]}`+"\n") @@ -650,7 +650,7 @@ func TestCodespacesService_AddSelectedReposForSecret(t *testing.T) { { name: "User", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/user/codespaces/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/codespaces/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) }, @@ -662,7 +662,7 @@ func TestCodespacesService_AddSelectedReposForSecret(t *testing.T) { { name: "Org", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/orgs/o/codespaces/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/codespaces/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) }, @@ -717,7 +717,7 @@ func TestCodespacesService_RemoveSelectedReposFromSecret(t *testing.T) { { name: "User", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/user/codespaces/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/codespaces/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) }, @@ -729,7 +729,7 @@ func TestCodespacesService_RemoveSelectedReposFromSecret(t *testing.T) { { name: "Org", handleFunc: func(mux *http.ServeMux) { - mux.HandleFunc("/orgs/o/codespaces/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/codespaces/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) }, diff --git a/github/codespaces_test.go b/github/codespaces_test.go index 64146ec848c..1b9e61da168 100644 --- a/github/codespaces_test.go +++ b/github/codespaces_test.go @@ -272,7 +272,7 @@ func TestCodespacesService_Delete(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/codespaces/codespace_1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/codespaces/codespace_1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/dependabot_secrets_test.go b/github/dependabot_secrets_test.go index 21f72ca22a7..7b0055dc298 100644 --- a/github/dependabot_secrets_test.go +++ b/github/dependabot_secrets_test.go @@ -204,7 +204,7 @@ func TestDependabotService_DeleteRepoSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/dependabot/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/dependabot/secrets/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -425,7 +425,7 @@ func TestDependabotService_SetSelectedReposForOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/dependabot/secrets/NAME/repositories", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/dependabot/secrets/NAME/repositories", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testHeader(t, r, "Content-Type", "application/json") testBody(t, r, `{"selected_repository_ids":[64780797]}`+"\n") @@ -452,7 +452,7 @@ func TestDependabotService_AddSelectedRepoToOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/dependabot/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/dependabot/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -478,7 +478,7 @@ func TestDependabotService_RemoveSelectedRepoFromOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/dependabot/secrets/NAME/repositories/1234", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/dependabot/secrets/NAME/repositories/1234", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -504,7 +504,7 @@ func TestDependabotService_DeleteOrgSecret(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/dependabot/secrets/NAME", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/dependabot/secrets/NAME", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/enterprise_actions_runner_groups_test.go b/github/enterprise_actions_runner_groups_test.go index e4d2bfffc2f..29623f66c5b 100644 --- a/github/enterprise_actions_runner_groups_test.go +++ b/github/enterprise_actions_runner_groups_test.go @@ -153,7 +153,7 @@ func TestEnterpriseService_DeleteRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runner-groups/2", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -328,7 +328,7 @@ func TestEnterpriseService_SetOrganizationAccessRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -360,7 +360,7 @@ func TestEnterpriseService_AddOrganizationAccessRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -385,7 +385,7 @@ func TestEnterpriseService_RemoveOrganizationAccessRunnerGroup(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -453,7 +453,7 @@ func TestEnterpriseService_SetEnterpriseRunnerGroupRunners(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -485,7 +485,7 @@ func TestEnterpriseService_AddEnterpriseRunnerGroupRunners(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -510,7 +510,7 @@ func TestEnterpriseService_RemoveEnterpriseRunnerGroupRunners(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/enterprise_actions_runners_test.go b/github/enterprise_actions_runners_test.go index b3a5770b6ad..e89a27697dc 100644 --- a/github/enterprise_actions_runners_test.go +++ b/github/enterprise_actions_runners_test.go @@ -189,7 +189,7 @@ func TestEnterpriseService_RemoveRunner(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/o/actions/runners/21", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/o/actions/runners/21", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/enterprise_code_security_and_analysis_test.go b/github/enterprise_code_security_and_analysis_test.go index 6080299b723..57f3e65c9d3 100644 --- a/github/enterprise_code_security_and_analysis_test.go +++ b/github/enterprise_code_security_and_analysis_test.go @@ -78,7 +78,7 @@ func TestEnterpriseService_UpdateCodeSecurityAndAnalysis(t *testing.T) { SecretScanningValidityChecksEnabled: Ptr(true), } - mux.HandleFunc("/enterprises/e/code_security_and_analysis", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/e/code_security_and_analysis", func(_ http.ResponseWriter, r *http.Request) { v := new(EnterpriseSecurityAnalysisSettings) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) @@ -111,7 +111,7 @@ func TestEnterpriseService_EnableAdvancedSecurity(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/e/advanced_security/enable_all", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/e/advanced_security/enable_all", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) diff --git a/github/enterprise_manage_ghes_config_test.go b/github/enterprise_manage_ghes_config_test.go index 6fb0f526a25..4b662b4a0a0 100644 --- a/github/enterprise_manage_ghes_config_test.go +++ b/github/enterprise_manage_ghes_config_test.go @@ -603,7 +603,7 @@ func TestEnterpriseService_InitialConfig(t *testing.T) { Password: "password", } - mux.HandleFunc("/manage/v1/config/init", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/manage/v1/config/init", func(_ http.ResponseWriter, r *http.Request) { v := new(InitialConfigOptions) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) diff --git a/github/enterprise_network_configurations_test.go b/github/enterprise_network_configurations_test.go index 74555997427..1c520aaff0f 100644 --- a/github/enterprise_network_configurations_test.go +++ b/github/enterprise_network_configurations_test.go @@ -336,7 +336,7 @@ func TestEnterpriseService_DeleteEnterpriseNetworkConfiguration(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/e/network-configurations/123456789ABCDEF", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/e/network-configurations/123456789ABCDEF", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/enterprise_properties_test.go b/github/enterprise_properties_test.go index 4f44d60f217..3155f9669bc 100644 --- a/github/enterprise_properties_test.go +++ b/github/enterprise_properties_test.go @@ -260,7 +260,7 @@ func TestEnterpriseService_RemoveCustomProperty(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/e/properties/schema/name", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/e/properties/schema/name", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/enterprise_rules_test.go b/github/enterprise_rules_test.go index 6e54948a908..d3e83a2af20 100644 --- a/github/enterprise_rules_test.go +++ b/github/enterprise_rules_test.go @@ -1840,7 +1840,7 @@ func TestEnterpriseService_DeleteRepositoryRuleset(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/enterprises/e/rulesets/84", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/enterprises/e/rulesets/84", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/gists_comments_test.go b/github/gists_comments_test.go index 94c07a8c5fe..c3b89c863c6 100644 --- a/github/gists_comments_test.go +++ b/github/gists_comments_test.go @@ -272,7 +272,7 @@ func TestGistsService_DeleteComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/gists/1/comments/2", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/gists/1/comments/2", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/gists_test.go b/github/gists_test.go index c6ee6d0f661..c7b1b88e98e 100644 --- a/github/gists_test.go +++ b/github/gists_test.go @@ -724,7 +724,7 @@ func TestGistsService_Delete(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/gists/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/gists/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -758,7 +758,7 @@ func TestGistsService_Star(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/gists/1/star", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -792,7 +792,7 @@ func TestGistsService_Unstar(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/gists/1/star", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/git_commits_test.go b/github/git_commits_test.go index f0ad44b6a64..9fd7309a3ff 100644 --- a/github/git_commits_test.go +++ b/github/git_commits_test.go @@ -32,7 +32,7 @@ func mockSigner(t *testing.T, signature string, emitErr error, wantMessage strin } func uncalledSigner(t *testing.T) MessageSignerFunc { - return func(w io.Writer, r io.Reader) error { + return func(io.Writer, io.Reader) error { t.Error("MessageSignerFunc should not be called") return nil } diff --git a/github/git_refs_test.go b/github/git_refs_test.go index 389b23c0c29..0dc62b09fe7 100644 --- a/github/git_refs_test.go +++ b/github/git_refs_test.go @@ -556,7 +556,7 @@ func TestGitService_DeleteRef(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/git/refs/heads/b", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/git/refs/heads/b", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/github.go b/github/github.go index 8f3f3e431ae..89c6ea4ef73 100644 --- a/github/github.go +++ b/github/github.go @@ -409,7 +409,7 @@ func (c *Client) initialize() { c.clientIgnoreRedirects.Transport = c.client.Transport c.clientIgnoreRedirects.Timeout = c.client.Timeout c.clientIgnoreRedirects.Jar = c.client.Jar - c.clientIgnoreRedirects.CheckRedirect = func(req *http.Request, via []*http.Request) error { + c.clientIgnoreRedirects.CheckRedirect = func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse } if c.BaseURL == nil { diff --git a/github/github_test.go b/github/github_test.go index 08a6eaaf6fc..95c7fb2a3c4 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -357,7 +357,7 @@ func TestWithAuthToken(t *testing.T) { } gotReq := false headerVal := "" - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + srv := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) { gotReq = true headerVal = r.Header.Get("Authorization") })) @@ -1086,7 +1086,7 @@ func TestDo_httpError(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { http.Error(w, "Bad Request", 400) }) @@ -1129,7 +1129,7 @@ func TestDo_preservesResponseInHTTPError(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusNotFound) fmt.Fprintf(w, `{ @@ -1198,7 +1198,7 @@ func TestDo_rateLimit(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set(headerRateLimit, "60") w.Header().Set(headerRateRemaining, "59") w.Header().Set(headerRateUsed, "1") @@ -1312,7 +1312,7 @@ func TestDo_rateLimit_errorResponse(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set(headerRateLimit, "60") w.Header().Set(headerRateRemaining, "59") w.Header().Set(headerRateUsed, "1") @@ -1353,7 +1353,7 @@ func TestDo_rateLimit_rateLimitError(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set(headerRateLimit, "60") w.Header().Set(headerRateRemaining, "0") w.Header().Set(headerRateUsed, "60") @@ -1403,7 +1403,7 @@ func TestDo_rateLimit_noNetworkCall(t *testing.T) { reset := time.Now().UTC().Add(time.Minute).Round(time.Second) // Rate reset is a minute from now, with 1 second precision. - mux.HandleFunc("/first", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/first", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set(headerRateLimit, "60") w.Header().Set(headerRateRemaining, "0") w.Header().Set(headerRateUsed, "60") @@ -1418,7 +1418,7 @@ func TestDo_rateLimit_noNetworkCall(t *testing.T) { }) madeNetworkCall := false - mux.HandleFunc("/second", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/second", func(http.ResponseWriter, *http.Request) { madeNetworkCall = true }) @@ -1470,7 +1470,7 @@ func TestDo_rateLimit_ignoredFromCache(t *testing.T) { reset := time.Now().UTC().Add(time.Minute).Round(time.Second) // Rate reset is a minute from now, with 1 second precision. // By adding the X-From-Cache header we pretend this is served from a cache. - mux.HandleFunc("/first", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/first", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("X-From-Cache", "1") w.Header().Set(headerRateLimit, "60") w.Header().Set(headerRateRemaining, "0") @@ -1486,7 +1486,7 @@ func TestDo_rateLimit_ignoredFromCache(t *testing.T) { }) madeNetworkCall := false - mux.HandleFunc("/second", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/second", func(http.ResponseWriter, *http.Request) { madeNetworkCall = true }) @@ -1518,7 +1518,7 @@ func TestDo_rateLimit_sleepUntilResponseResetLimit(t *testing.T) { reset := time.Now().UTC().Add(time.Second) var firstRequest = true - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { if firstRequest { firstRequest = false w.Header().Set(headerRateLimit, "60") @@ -1563,7 +1563,7 @@ func TestDo_rateLimit_sleepUntilResponseResetLimitRetryOnce(t *testing.T) { reset := time.Now().UTC().Add(time.Second) requestCount := 0 - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { requestCount++ w.Header().Set(headerRateLimit, "60") w.Header().Set(headerRateRemaining, "0") @@ -1597,7 +1597,7 @@ func TestDo_rateLimit_sleepUntilClientResetLimit(t *testing.T) { reset := time.Now().UTC().Add(time.Second) client.rateLimits[CoreCategory] = Rate{Limit: 5000, Remaining: 0, Reset: Timestamp{reset}} requestCount := 0 - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { requestCount++ w.Header().Set(headerRateLimit, "5000") w.Header().Set(headerRateRemaining, "5000") @@ -1630,7 +1630,7 @@ func TestDo_rateLimit_abortSleepContextCancelled(t *testing.T) { // We use a 1 minute reset time to ensure the sleep is not completed. reset := time.Now().UTC().Add(time.Minute) requestCount := 0 - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { requestCount++ w.Header().Set(headerRateLimit, "60") w.Header().Set(headerRateRemaining, "0") @@ -1665,7 +1665,7 @@ func TestDo_rateLimit_abortSleepContextCancelledClientLimit(t *testing.T) { reset := time.Now().UTC().Add(time.Minute) client.rateLimits[CoreCategory] = Rate{Limit: 5000, Remaining: 0, Reset: Timestamp{reset}} requestCount := 0 - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { requestCount++ w.Header().Set(headerRateLimit, "5000") w.Header().Set(headerRateRemaining, "5000") @@ -1698,7 +1698,7 @@ func TestDo_rateLimit_abuseRateLimitError(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(http.StatusForbidden) // When the abuse rate limit error is of the "temporarily blocked from content creation" type, @@ -1731,7 +1731,7 @@ func TestDo_rateLimit_abuseRateLimitErrorEnterprise(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(http.StatusForbidden) // When the abuse rate limit error is of the "temporarily blocked from content creation" type, @@ -1765,7 +1765,7 @@ func TestDo_rateLimit_abuseRateLimitError_retryAfter(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set(headerRetryAfter, "123") // Retry after value of 123 seconds. w.WriteHeader(http.StatusForbidden) @@ -1821,7 +1821,7 @@ func TestDo_rateLimit_abuseRateLimitError_xRateLimitReset(t *testing.T) { // x-ratelimit-reset value of 123 seconds into the future. blockUntil := time.Now().Add(time.Duration(123) * time.Second).Unix() - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set(headerRateReset, strconv.Itoa(int(blockUntil))) w.Header().Set(headerRateRemaining, "1") // set remaining to a value > 0 to distinct from a primary rate limit @@ -1881,7 +1881,7 @@ func TestDo_rateLimit_abuseRateLimitError_maxDuration(t *testing.T) { // x-ratelimit-reset value of 1h into the future, to make sure we are way over the max wait time duration. blockUntil := time.Now().Add(1 * time.Hour).Unix() - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set(headerRateReset, strconv.Itoa(int(blockUntil))) w.Header().Set(headerRateRemaining, "1") // set remaining to a value > 0 to distinct from a primary rate limit @@ -1916,7 +1916,7 @@ func TestDo_noContent(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNoContent) }) @@ -2634,7 +2634,7 @@ func TestUnauthenticatedRateLimitedTransport(t *testing.T) { client, mux, _ := setup(t) clientID, clientSecret := "id", "secret" - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(_ http.ResponseWriter, r *http.Request) { id, secret, ok := r.BasicAuth() if !ok { t.Errorf("request does not contain basic auth credentials") @@ -2708,7 +2708,7 @@ func TestBasicAuthTransport(t *testing.T) { username, password, otp := "u", "p", "123456" - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(_ http.ResponseWriter, r *http.Request) { u, p, ok := r.BasicAuth() if !ok { t.Errorf("request does not contain basic auth credentials") diff --git a/github/interactions_orgs_test.go b/github/interactions_orgs_test.go index d482cb6cea9..e24d37024dd 100644 --- a/github/interactions_orgs_test.go +++ b/github/interactions_orgs_test.go @@ -99,7 +99,7 @@ func TestInteractionsService_RemoveRestrictionsFromOrg(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/interaction-limits", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) }) diff --git a/github/interactions_repos_test.go b/github/interactions_repos_test.go index 6107986b93a..2d5142cedb7 100644 --- a/github/interactions_repos_test.go +++ b/github/interactions_repos_test.go @@ -99,7 +99,7 @@ func TestInteractionsService_RemoveRestrictionsFromRepo(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/interaction-limits", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) }) diff --git a/github/issues_assignees_test.go b/github/issues_assignees_test.go index 88f0e0e42b3..06c91a07966 100644 --- a/github/issues_assignees_test.go +++ b/github/issues_assignees_test.go @@ -65,7 +65,7 @@ func TestIssuesService_IsAssignee_true(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/assignees/u", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/assignees/u", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") }) diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go index aa9ed2b1146..056c70642b0 100644 --- a/github/issues_comments_test.go +++ b/github/issues_comments_test.go @@ -265,7 +265,7 @@ func TestIssuesService_DeleteComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/issues/comments/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/issues/comments/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/issues_labels_test.go b/github/issues_labels_test.go index fd14153b6ab..a607bf4fb19 100644 --- a/github/issues_labels_test.go +++ b/github/issues_labels_test.go @@ -215,7 +215,7 @@ func TestIssuesService_DeleteLabel(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/labels/n", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/labels/n", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -351,7 +351,7 @@ func TestIssuesService_RemoveLabelForIssue(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/issues/1/labels/l", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/issues/1/labels/l", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -438,7 +438,7 @@ func TestIssuesService_RemoveLabelsForIssue(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/issues/1/labels", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/issues/1/labels", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/issues_milestones_test.go b/github/issues_milestones_test.go index 8b6e17e4ea7..22fa49ec10c 100644 --- a/github/issues_milestones_test.go +++ b/github/issues_milestones_test.go @@ -220,7 +220,7 @@ func TestIssuesService_DeleteMilestone(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/milestones/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/milestones/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/messages_test.go b/github/messages_test.go index 3c8cedfeab8..b414a9e6a93 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -199,7 +199,7 @@ func TestValidatePayload_NoSecretKey(t *testing.T) { // badReader satisfies io.Reader but always returns an error. type badReader struct{} -func (b *badReader) Read(p []byte) (int, error) { +func (b *badReader) Read([]byte) (int, error) { return 0, errors.New("bad reader") } diff --git a/github/migrations.go b/github/migrations.go index 766c4c38e1c..2bc7af8da00 100644 --- a/github/migrations.go +++ b/github/migrations.go @@ -181,7 +181,7 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, // Disable the redirect mechanism because AWS fails if the GitHub auth token is provided. var loc string saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + s.client.client.CheckRedirect = func(req *http.Request, _ []*http.Request) error { loc = req.URL.String() return errors.New("disable redirect") } diff --git a/github/migrations_user.go b/github/migrations_user.go index a7bd79499a2..58e780ea7bb 100644 --- a/github/migrations_user.go +++ b/github/migrations_user.go @@ -172,7 +172,7 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64 var loc string originalRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + s.client.client.CheckRedirect = func(req *http.Request, _ []*http.Request) error { loc = req.URL.String() return http.ErrUseLastResponse } diff --git a/github/orgs_hooks_test.go b/github/orgs_hooks_test.go index 3b3b8bff91c..aec8dda8e59 100644 --- a/github/orgs_hooks_test.go +++ b/github/orgs_hooks_test.go @@ -208,7 +208,7 @@ func TestOrganizationsService_PingHook(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/hooks/1/pings", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/hooks/1/pings", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) @@ -233,7 +233,7 @@ func TestOrganizationsService_DeleteHook(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/hooks/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/hooks/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/orgs_issue_types_test.go b/github/orgs_issue_types_test.go index 7775b4f5ef2..57c731a35d2 100644 --- a/github/orgs_issue_types_test.go +++ b/github/orgs_issue_types_test.go @@ -216,7 +216,7 @@ func TestOrganizationsService_DeleteIssueType(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/issue-types/410", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/issue-types/410", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/orgs_members_test.go b/github/orgs_members_test.go index 71c7fbef3a7..dbdb0f284a1 100644 --- a/github/orgs_members_test.go +++ b/github/orgs_members_test.go @@ -263,7 +263,7 @@ func TestOrganizationsService_RemoveMember(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/members/u", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/members/u", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -323,7 +323,7 @@ func TestOrganizationsService_PublicizeMembership(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/public_members/u", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/public_members/u", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -348,7 +348,7 @@ func TestOrganizationsService_ConcealMembership(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/public_members/u", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/public_members/u", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/orgs_network_configurations_test.go b/github/orgs_network_configurations_test.go index 51fec33f30b..9a095066990 100644 --- a/github/orgs_network_configurations_test.go +++ b/github/orgs_network_configurations_test.go @@ -417,7 +417,7 @@ func TestOrganizationsService_DeleteOrgsNetworkConfiguration(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/settings/network-configurations/789ABDCEF123456", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/settings/network-configurations/789ABDCEF123456", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/orgs_outside_collaborators_test.go b/github/orgs_outside_collaborators_test.go index 42b4b770192..7120449c02f 100644 --- a/github/orgs_outside_collaborators_test.go +++ b/github/orgs_outside_collaborators_test.go @@ -70,7 +70,7 @@ func TestOrganizationsService_RemoveOutsideCollaborator(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - handler := func(w http.ResponseWriter, r *http.Request) { + handler := func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") } mux.HandleFunc("/orgs/o/outside_collaborators/u", handler) @@ -134,7 +134,7 @@ func TestOrganizationsService_ConvertMemberToOutsideCollaborator(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - handler := func(w http.ResponseWriter, r *http.Request) { + handler := func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") } mux.HandleFunc("/orgs/o/outside_collaborators/u", handler) diff --git a/github/orgs_packages_test.go b/github/orgs_packages_test.go index 1bc72bc7cdf..329052ba675 100644 --- a/github/orgs_packages_test.go +++ b/github/orgs_packages_test.go @@ -178,7 +178,7 @@ func TestOrganizationsService_DeletePackage(t *testing.T) { client, mux, _ := setup(t) // don't url escape the package name here since mux will convert it to a slash automatically - mux.HandleFunc("/orgs/o/packages/container/hello%2fhello_docker", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/packages/container/hello%2fhello_docker", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -208,7 +208,7 @@ func TestOrganizationsService_RestorePackage(t *testing.T) { client, mux, _ := setup(t) // don't url escape the package name here since mux will convert it to a slash automatically - mux.HandleFunc("/orgs/o/packages/container/hello%2Fhello_docker/restore", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/packages/container/hello%2Fhello_docker/restore", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) @@ -372,7 +372,7 @@ func TestOrganizationsService_PackageDeleteVersion(t *testing.T) { client, mux, _ := setup(t) // don't url escape the package name here since mux will convert it to a slash automatically - mux.HandleFunc("/orgs/o/packages/container/hello%2Fhello_docker/versions/45763", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/packages/container/hello%2Fhello_docker/versions/45763", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -398,7 +398,7 @@ func TestOrganizationsService_PackageRestoreVersion(t *testing.T) { client, mux, _ := setup(t) // don't url escape the package name here since mux will convert it to a slash automatically - mux.HandleFunc("/orgs/o/packages/container/hello%2Fhello_docker/versions/45763/restore", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/packages/container/hello%2Fhello_docker/versions/45763/restore", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) diff --git a/github/orgs_properties_test.go b/github/orgs_properties_test.go index ceab4525171..e8bf5fe6502 100644 --- a/github/orgs_properties_test.go +++ b/github/orgs_properties_test.go @@ -260,7 +260,7 @@ func TestOrganizationsService_RemoveCustomProperty(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/properties/schema/name", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/properties/schema/name", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -449,7 +449,7 @@ func TestOrganizationsService_CreateOrUpdateRepoCustomPropertyValues(t *testing. t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/properties/values", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/properties/values", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testBody(t, r, `{"repository_names":["repo"],"properties":[{"property_name":"service","value":"string"}]}`+"\n") }) diff --git a/github/orgs_rules_test.go b/github/orgs_rules_test.go index b21ff93b151..d9727fff89a 100644 --- a/github/orgs_rules_test.go +++ b/github/orgs_rules_test.go @@ -1634,7 +1634,7 @@ func TestOrganizationsService_DeleteRepositoryRuleset(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/rulesets/21", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/rulesets/21", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/orgs_security_managers_test.go b/github/orgs_security_managers_test.go index 3ce67d24c03..4886ac74b8d 100644 --- a/github/orgs_security_managers_test.go +++ b/github/orgs_security_managers_test.go @@ -62,7 +62,7 @@ func TestOrganizationsService_AddSecurityManagerTeam(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/security-managers/teams/t", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/security-managers/teams/t", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -105,7 +105,7 @@ func TestOrganizationsService_RemoveSecurityManagerTeam(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/security-managers/teams/t", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/security-managers/teams/t", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/orgs_test.go b/github/orgs_test.go index 3866ca78773..0e4e425eb8e 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -320,7 +320,7 @@ func TestOrganizationsService_Delete(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go index 3df530662d0..2e5f20b8dc8 100644 --- a/github/pulls_comments_test.go +++ b/github/pulls_comments_test.go @@ -418,7 +418,7 @@ func TestPullRequestsService_DeleteComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/pulls/comments/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/pulls/comments/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/pulls_reviewers_test.go b/github/pulls_reviewers_test.go index cfc415ef82f..1642e0f7df1 100644 --- a/github/pulls_reviewers_test.go +++ b/github/pulls_reviewers_test.go @@ -155,7 +155,7 @@ func TestRemoveReviewers(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/pulls/1/requested_reviewers", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/pulls/1/requested_reviewers", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testBody(t, r, `{"reviewers":["octocat","googlebot"],"team_reviewers":["justice-league"]}`+"\n") }) @@ -176,7 +176,7 @@ func TestRemoveReviewers_teamsOnly(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/pulls/1/requested_reviewers", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/pulls/1/requested_reviewers", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testBody(t, r, `{"reviewers":[],"team_reviewers":["justice-league"]}`+"\n") }) diff --git a/github/pulls_test.go b/github/pulls_test.go index 4a48bdb08ae..b321b485451 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -796,7 +796,7 @@ func TestPullRequestsService_Merge_options(t *testing.T) { for i, test := range tests { madeRequest := false - mux.HandleFunc(fmt.Sprintf("/repos/o/r/pulls/%d/merge", i), func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc(fmt.Sprintf("/repos/o/r/pulls/%d/merge", i), func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testBody(t, r, test.wantBody+"\n") madeRequest = true @@ -815,7 +815,7 @@ func TestPullRequestsService_Merge_Blank_Message(t *testing.T) { madeRequest := false expectedBody := "" - mux.HandleFunc("/repos/o/r/pulls/1/merge", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/pulls/1/merge", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testBody(t, r, expectedBody+"\n") madeRequest = true diff --git a/github/rate_limit_test.go b/github/rate_limit_test.go index 8e7f2c83563..bd2414d57f6 100644 --- a/github/rate_limit_test.go +++ b/github/rate_limit_test.go @@ -214,7 +214,7 @@ func TestRateLimits_overQuota(t *testing.T) { Used: 1, Reset: Timestamp{time.Now().Add(time.Hour).Local()}, } - mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, `{"resources":{ "core": {"limit":2,"remaining":1,"used":1,"reset":1372700873}, "search": {"limit":3,"remaining":2,"used":1,"reset":1372700874}, diff --git a/github/repos_actions_access_test.go b/github/repos_actions_access_test.go index c7550dd28ba..f732bd35cb5 100644 --- a/github/repos_actions_access_test.go +++ b/github/repos_actions_access_test.go @@ -55,7 +55,7 @@ func TestRepositoriesService_EditActionsAccessLevel(t *testing.T) { input := &RepositoryActionsAccessLevel{AccessLevel: Ptr("organization")} - mux.HandleFunc("/repos/o/r/actions/permissions/access", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/actions/permissions/access", func(_ http.ResponseWriter, r *http.Request) { v := new(RepositoryActionsAccessLevel) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go index c415b1c3202..bed314c6a0c 100644 --- a/github/repos_comments_test.go +++ b/github/repos_comments_test.go @@ -264,7 +264,7 @@ func TestRepositoriesService_DeleteComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/comments/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/comments/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index 1db41a4c1d2..e698cc8f528 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -298,7 +298,7 @@ func TestRepositoriesService_DownloadContents_NoDownloadURL(t *testing.T) { fmt.Fprint(w, `[{ "type": "file", "name": "f", - "content": "" + "content": "" }]`) }) @@ -909,7 +909,7 @@ func TestRepositoriesService_GetArchiveLink(t *testing.T) { }) // Add custom round tripper - client.client.Transport = roundTripperFunc(func(r *http.Request) (*http.Response, error) { + client.client.Transport = roundTripperFunc(func(*http.Request) (*http.Response, error) { return nil, errors.New("failed to get archive link") }) testBadOptions(t, methodName, func() (err error) { diff --git a/github/repos_deployment_branch_policies_test.go b/github/repos_deployment_branch_policies_test.go index bbf4499cf9c..4eb9eab7820 100644 --- a/github/repos_deployment_branch_policies_test.go +++ b/github/repos_deployment_branch_policies_test.go @@ -17,7 +17,7 @@ func TestRepositoriesService_ListDeploymentBranchPolicies(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/environments/e/deployment-branch-policies", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/environments/e/deployment-branch-policies", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, `{"total_count":2, "branch_policies":[{"id":1}, {"id": 2}]}`) }) @@ -52,7 +52,7 @@ func TestRepositoriesService_GetDeploymentBranchPolicy(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/environments/e/deployment-branch-policies/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/environments/e/deployment-branch-policies/1", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, `{"id":1}`) }) @@ -141,7 +141,7 @@ func TestRepositoriesService_DeleteDeploymentBranchPolicy(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/environments/e/deployment-branch-policies/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/environments/e/deployment-branch-policies/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/repos_environments_test.go b/github/repos_environments_test.go index 715012db2f2..73c5cb736d9 100644 --- a/github/repos_environments_test.go +++ b/github/repos_environments_test.go @@ -331,7 +331,7 @@ func TestRepositoriesService_DeleteEnvironment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/environments/e", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/environments/e", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index 059d5371034..e57a9161332 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -218,7 +218,7 @@ func TestRepositoriesService_DeleteHook(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/hooks/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/hooks/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -252,7 +252,7 @@ func TestRepositoriesService_PingHook(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/hooks/1/pings", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/hooks/1/pings", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) @@ -277,7 +277,7 @@ func TestRepositoriesService_TestHook(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/hooks/1/tests", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/hooks/1/tests", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) @@ -570,7 +570,7 @@ func TestRepositoriesService_Subscribe(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/hub", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/hub", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPost) testHeader(t, r, "Content-Type", "application/x-www-form-urlencoded") testFormValues(t, r, values{ @@ -603,7 +603,7 @@ func TestRepositoriesService_Unsubscribe(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/hub", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/hub", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPost) testHeader(t, r, "Content-Type", "application/x-www-form-urlencoded") testFormValues(t, r, values{ diff --git a/github/repos_keys_test.go b/github/repos_keys_test.go index af63857116c..e1fecaca0fe 100644 --- a/github/repos_keys_test.go +++ b/github/repos_keys_test.go @@ -162,7 +162,7 @@ func TestRepositoriesService_DeleteKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/keys/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/keys/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 31a2ee1b2ee..505f6a8b6c1 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -271,7 +271,7 @@ func TestRepositoriesService_DisablePages(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/pages", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) }) diff --git a/github/repos_prereceive_hooks_test.go b/github/repos_prereceive_hooks_test.go index c424c47a9fa..fc1c3e7f606 100644 --- a/github/repos_prereceive_hooks_test.go +++ b/github/repos_prereceive_hooks_test.go @@ -165,7 +165,7 @@ func TestRepositoriesService_DeletePreReceiveHook(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/pre-receive-hooks/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/pre-receive-hooks/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/repos_releases.go b/github/repos_releases.go index 6023f632716..d4b4591bfbb 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -355,7 +355,7 @@ func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, r var loc string saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + s.client.client.CheckRedirect = func(req *http.Request, _ []*http.Request) error { loc = req.URL.String() return errors.New("disable redirect") } diff --git a/github/repos_releases_test.go b/github/repos_releases_test.go index 011e8cf67bf..4e777228ad2 100644 --- a/github/repos_releases_test.go +++ b/github/repos_releases_test.go @@ -332,7 +332,7 @@ func TestRepositoriesService_DeleteRelease(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/releases/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/releases/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -656,7 +656,7 @@ func TestRepositoriesService_DeleteReleaseAsset(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r/releases/assets/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/releases/assets/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/repos_rules_test.go b/github/repos_rules_test.go index 24beb654199..d94d5bb57f5 100644 --- a/github/repos_rules_test.go +++ b/github/repos_rules_test.go @@ -555,7 +555,7 @@ func TestRepositoriesService_DeleteRuleset(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/repo/rulesets/42", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/repo/rulesets/42", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/repos_test.go b/github/repos_test.go index a62711a1454..a7f1b85e827 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -519,7 +519,7 @@ func TestRepositoriesService_Delete(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -1067,7 +1067,7 @@ func TestRepositoriesService_GetBranch_notFound(t *testing.T) { } // Add custom round tripper - client.client.Transport = roundTripperFunc(func(r *http.Request) (*http.Response, error) { + client.client.Transport = roundTripperFunc(func(*http.Request) (*http.Response, error) { return nil, errors.New("failed to get branch") }) @@ -3545,7 +3545,7 @@ func TestRepositoriesService_ListAppRestrictions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc(test.urlPath, func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") }) @@ -3736,7 +3736,7 @@ func TestRepositoriesService_ListTeamRestrictions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc(test.urlPath, func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") }) @@ -3927,7 +3927,7 @@ func TestRepositoriesService_ListUserRestrictions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc(test.urlPath, func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") }) diff --git a/github/scim.go b/github/scim.go index 70f063caa9b..b6b0f6ddd0d 100644 --- a/github/scim.go +++ b/github/scim.go @@ -252,7 +252,7 @@ func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise // //meta:operation GET /scim/v2/enterprises/{enterprise}/Groups -func (s *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, opts *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedGroups, *Response, error) { +func (s *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, _ *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedGroups, *Response, error) { u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/teams_discussion_comments_test.go b/github/teams_discussion_comments_test.go index e8173abcd5a..e49fb9dc9d4 100644 --- a/github/teams_discussion_comments_test.go +++ b/github/teams_discussion_comments_test.go @@ -388,7 +388,7 @@ func TestTeamsService_DeleteComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - handlerFunc := func(w http.ResponseWriter, r *http.Request) { + handlerFunc := func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") } diff --git a/github/teams_discussions_test.go b/github/teams_discussions_test.go index 236382e0227..169f85736df 100644 --- a/github/teams_discussions_test.go +++ b/github/teams_discussions_test.go @@ -496,7 +496,7 @@ func TestTeamsService_DeleteDiscussionByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/organizations/1/team/2/discussions/3", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/organizations/1/team/2/discussions/3", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -521,7 +521,7 @@ func TestTeamsService_DeleteDiscussionBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/teams/s/discussions/3", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/teams/s/discussions/3", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/teams_test.go b/github/teams_test.go index 1e3d3da2980..0c230c121c6 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -411,7 +411,7 @@ func TestTeamsService_DeleteTeamByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/organizations/1/team/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -436,7 +436,7 @@ func TestTeamsService_DeleteTeamBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/orgs/o/teams/s", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/users_emails_test.go b/github/users_emails_test.go index 6c1c73f3ef9..a3bfeddf72f 100644 --- a/github/users_emails_test.go +++ b/github/users_emails_test.go @@ -99,7 +99,7 @@ func TestUsersService_DeleteEmails(t *testing.T) { input := []string{"user@example.com"} - mux.HandleFunc("/user/emails", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/emails", func(_ http.ResponseWriter, r *http.Request) { var v []string assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) diff --git a/github/users_followers_test.go b/github/users_followers_test.go index 1ffe5d7c70e..5f0de89ab19 100644 --- a/github/users_followers_test.go +++ b/github/users_followers_test.go @@ -321,7 +321,7 @@ func TestUsersService_Follow(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/following/u", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/following/u", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") }) @@ -355,7 +355,7 @@ func TestUsersService_Unfollow(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/following/u", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/following/u", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/users_gpg_keys_test.go b/github/users_gpg_keys_test.go index 585ea4c6dbd..a28225c6347 100644 --- a/github/users_gpg_keys_test.go +++ b/github/users_gpg_keys_test.go @@ -169,7 +169,7 @@ func TestUsersService_DeleteGPGKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/gpg_keys/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/gpg_keys/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/users_keys_test.go b/github/users_keys_test.go index 59167a34778..07c43f77506 100644 --- a/github/users_keys_test.go +++ b/github/users_keys_test.go @@ -160,7 +160,7 @@ func TestUsersService_DeleteKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/keys/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/keys/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/github/users_packages_test.go b/github/users_packages_test.go index 9de73583615..0456254a696 100644 --- a/github/users_packages_test.go +++ b/github/users_packages_test.go @@ -244,7 +244,7 @@ func TestUsersService_Authenticated_DeletePackage(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/packages/container/hello_docker", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/packages/container/hello_docker", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -269,7 +269,7 @@ func TestUsersService_specifiedUser_DeletePackage(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/users/u/packages/container/hello_docker", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/users/u/packages/container/hello_docker", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -294,7 +294,7 @@ func TestUsersService_Authenticated_RestorePackage(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/packages/container/hello_docker/restore", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/packages/container/hello_docker/restore", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) @@ -319,7 +319,7 @@ func TestUsersService_specifiedUser_RestorePackage(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/users/u/packages/container/hello_docker/restore", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/users/u/packages/container/hello_docker/restore", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) @@ -602,7 +602,7 @@ func TestUsersService_Authenticated_PackageDeleteVersion(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/packages/container/hello_docker/versions/45763", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/packages/container/hello_docker/versions/45763", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -627,7 +627,7 @@ func TestUsersService_specifiedUser_PackageDeleteVersion(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/users/u/packages/container/hello_docker/versions/45763", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/users/u/packages/container/hello_docker/versions/45763", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) @@ -652,7 +652,7 @@ func TestUsersService_Authenticated_PackageRestoreVersion(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/packages/container/hello_docker/versions/45763/restore", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/packages/container/hello_docker/versions/45763/restore", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) @@ -677,7 +677,7 @@ func TestUsersService_specifiedUser_PackageRestoreVersion(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/users/u/packages/container/hello_docker/versions/45763/restore", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/users/u/packages/container/hello_docker/versions/45763/restore", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) diff --git a/github/users_ssh_signing_keys_test.go b/github/users_ssh_signing_keys_test.go index 56c082fdb8a..35189c75f89 100644 --- a/github/users_ssh_signing_keys_test.go +++ b/github/users_ssh_signing_keys_test.go @@ -160,7 +160,7 @@ func TestUsersService_DeleteSSHSigningKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - mux.HandleFunc("/user/ssh_signing_keys/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/user/ssh_signing_keys/1", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) diff --git a/scrape/apps.go b/scrape/apps.go index 291a194efa4..2563e17356f 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -53,7 +53,7 @@ func (c *Client) ListOAuthApps(org string) ([]*OAuthApp, error) { } var apps []*OAuthApp - doc.Find(".oauth-application-allowlist ul > li").Each(func(i int, s *goquery.Selection) { + doc.Find(".oauth-application-allowlist ul > li").Each(func(_ int, s *goquery.Selection) { var app OAuthApp app.Name = s.Find(".request-info strong").First().Text() app.Description = s.Find(".request-info .application-description").Text() diff --git a/scrape/apps_test.go b/scrape/apps_test.go index e7f6da6dcd8..06ab9e1394a 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -38,7 +38,7 @@ func Test_AppRestrictionsEnabled(t *testing.T) { t.Parallel() client, mux := setup(t) - mux.HandleFunc("/organizations/o/settings/oauth_application_policy", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/organizations/o/settings/oauth_application_policy", func(w http.ResponseWriter, _ *http.Request) { copyTestFile(t, w, tt.testFile) }) @@ -57,7 +57,7 @@ func Test_ListOAuthApps(t *testing.T) { t.Parallel() client, mux := setup(t) - mux.HandleFunc("/organizations/e/settings/oauth_application_policy", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/organizations/e/settings/oauth_application_policy", func(w http.ResponseWriter, _ *http.Request) { copyTestFile(t, w, "access-restrictions-enabled.html") }) @@ -94,7 +94,7 @@ func Test_CreateApp(t *testing.T) { t.Parallel() client, mux := setup(t) - mux.HandleFunc("/apps/settings/new", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/apps/settings/new", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusCreated) }) @@ -112,7 +112,7 @@ func Test_CreateAppWithOrg(t *testing.T) { t.Parallel() client, mux := setup(t) - mux.HandleFunc("/organizations/example/apps/settings/new", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/organizations/example/apps/settings/new", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusCreated) }) diff --git a/scrape/forms_test.go b/scrape/forms_test.go index 3a7f1b37a2d..52d4d5edbbf 100644 --- a/scrape/forms_test.go +++ b/scrape/forms_test.go @@ -94,13 +94,13 @@ func Test_FetchAndSumbitForm(t *testing.T) { client, mux := setup(t) var submitted bool - mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, `
`) }) - mux.HandleFunc("/submit", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/submit", func(_ http.ResponseWriter, r *http.Request) { err := r.ParseForm() if err != nil { t.Fatalf("error parsing form: %v", err) diff --git a/scrape/payment.go b/scrape/payment.go index fff9a7531fd..d00eaa9e728 100644 --- a/scrape/payment.go +++ b/scrape/payment.go @@ -23,7 +23,7 @@ func (c *Client) OrgPaymentInformation(org string) (PaymentInformation, error) { return info, err } - doc.Find("main h4.mb-1").Each(func(i int, s *goquery.Selection) { + doc.Find("main h4.mb-1").Each(func(_ int, s *goquery.Selection) { name := strings.TrimSpace(strings.ToLower(s.Text())) value := strings.Join(strings.Fields(strings.TrimSpace(s.NextFiltered("p").Text())), " ") diff --git a/tools/sliceofpointers/sliceofpointers.go b/tools/sliceofpointers/sliceofpointers.go index 75639b68b0b..75519996a7c 100644 --- a/tools/sliceofpointers/sliceofpointers.go +++ b/tools/sliceofpointers/sliceofpointers.go @@ -24,7 +24,7 @@ func init() { type SliceOfPointersPlugin struct{} // New returns an analysis.Analyzer to use with golangci-lint. -func New(settings any) (register.LinterPlugin, error) { +func New(_ any) (register.LinterPlugin, error) { return &SliceOfPointersPlugin{}, nil }