Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
4 changes: 2 additions & 2 deletions github/actions_artifacts_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -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")
})

Expand Down
4 changes: 2 additions & 2 deletions github/actions_cache_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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"})
})
Expand DownExpand Up@@ -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")
})

Expand Down
14 changes: 7 additions & 7 deletions github/actions_runner_groups_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand All@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand All@@ -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")
})

Expand Down
4 changes: 2 additions & 2 deletions github/actions_runners_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand Down
12 changes: 6 additions & 6 deletions github/actions_secrets_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")
})

Expand DownExpand Up@@ -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")
Expand All@@ -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")
})

Expand All@@ -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")
})

Expand All@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand Down
12 changes: 6 additions & 6 deletions github/actions_variables_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")
})

Expand DownExpand Up@@ -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")
Expand All@@ -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")
})

Expand All@@ -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")
})

Expand All@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand Down
2 changes: 1 addition & 1 deletion github/actions_workflow_jobs_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
12 changes: 6 additions & 6 deletions github/actions_workflows_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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))

Expand DownExpand Up@@ -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))

Expand DownExpand Up@@ -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)
Expand DownExpand Up@@ -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)
Expand DownExpand Up@@ -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)
Expand DownExpand Up@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions github/activity_star_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand Down
4 changes: 2 additions & 2 deletions github/admin_users_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")
})

Expand DownExpand Up@@ -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")
})

Expand Down
4 changes: 2 additions & 2 deletions github/authorizations_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
Expand DownExpand Up@@ -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")
})

Expand Down
Loading