From cd953b0515b5949ae462908707da2acb50f87bff Mon Sep 17 00:00:00 2001 From: ajayk Date: Sat, 22 Aug 2026 19:50:47 -0700 Subject: [PATCH 1/3] feat: Require Go 1.26 and use new(expr) for pointer literals Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests. --- github/actions_artifacts_test.go | 16 +- github/actions_cache_test.go | 14 +- github/actions_hosted_runners_test.go | 132 ++-- github/actions_oidc_test.go | 10 +- github/actions_permissions_enterprise_test.go | 44 +- github/actions_permissions_orgs_test.go | 64 +- github/actions_runner_groups_test.go | 142 ++--- github/actions_runners_test.go | 56 +- github/actions_secrets.go | 2 +- github/actions_secrets_test.go | 24 +- github/actions_variables_test.go | 26 +- github/actions_workflow_jobs_test.go | 28 +- github/actions_workflow_runs_test.go | 96 +-- github/actions_workflows_test.go | 38 +- github/activity_events_test.go | 24 +- github/activity_notifications_test.go | 12 +- github/activity_star_test.go | 6 +- github/activity_test.go | 40 +- github/activity_watching_test.go | 12 +- github/admin_orgs_test.go | 14 +- github/admin_stats_test.go | 68 +-- github/admin_test.go | 62 +- github/admin_users_test.go | 20 +- github/agent_tasks_test.go | 60 +- github/apps_hooks_deliveries_test.go | 6 +- github/apps_hooks_test.go | 24 +- github/apps_installation_test.go | 6 +- github/apps_manifest_test.go | 10 +- github/apps_marketplace_test.go | 16 +- github/apps_test.go | 126 ++-- github/authorizations_test.go | 6 +- github/billing_test.go | 92 +-- github/checks_test.go | 160 ++--- github/classroom_test.go | 348 +++++------ github/code_quality_test.go | 38 +- github/code_scanning_test.go | 564 +++++++++--------- github/codesofconduct_test.go | 14 +- github/codespaces_machines_test.go | 34 +- github/codespaces_orgs_test.go | 8 +- github/codespaces_secrets_test.go | 10 +- github/codespaces_test.go | 150 ++--- github/copilot_test.go | 482 +++++++-------- github/dependabot_alerts_test.go | 30 +- github/dependabot_secrets_test.go | 10 +- github/dependency_graph_snapshots_test.go | 42 +- github/dependency_graph_test.go | 6 +- .../enterprise_actions_hosted_runners_test.go | 132 ++-- .../enterprise_actions_runner_groups_test.go | 94 +-- github/enterprise_actions_runners_test.go | 26 +- github/enterprise_app_installation_test.go | 8 +- github/enterprise_audit_log_test.go | 14 +- .../enterprise_billing_cost_centers_test.go | 38 +- github/enterprise_billing_test.go | 22 +- github/enterprise_budgets_test.go | 48 +- ...erprise_code_security_and_analysis_test.go | 20 +- ...rprise_codesecurity_configurations_test.go | 26 +- github/enterprise_licenses_test.go | 14 +- github/enterprise_manage_ghes_config_test.go | 218 +++---- ...enterprise_manage_ghes_maintenance_test.go | 24 +- github/enterprise_manage_ghes_ssh_test.go | 8 +- github/enterprise_manage_ghes_test.go | 36 +- .../enterprise_network_configurations_test.go | 66 +- ...enterprise_organization_properties_test.go | 18 +- github/enterprise_properties_test.go | 48 +- github/enterprise_rules_test.go | 268 ++++----- github/enterprise_scim_test.go | 144 ++--- github/enterprise_team_test.go | 62 +- github/event_test.go | 4 +- github/examples_test.go | 12 +- github/gists_comments_test.go | 8 +- github/gists_test.go | 58 +- github/git_blobs_test.go | 12 +- github/git_commits_test.go | 70 +-- github/git_refs_test.go | 94 +-- github/git_tags_test.go | 4 +- github/git_trees_test.go | 100 ++-- github/github.go | 16 +- github/github_test.go | 44 +- github/gitignore_test.go | 2 +- github/interactions_orgs_test.go | 6 +- github/interactions_repos_test.go | 6 +- github/issue_import_test.go | 22 +- github/issues_assignees_test.go | 6 +- github/issues_comments_test.go | 14 +- github/issues_dependencies_test.go | 8 +- github/issues_events_test.go | 6 +- github/issues_labels_test.go | 4 +- github/issues_milestones_test.go | 10 +- github/issues_test.go | 26 +- github/issues_timeline_test.go | 34 +- github/licenses_test.go | 14 +- github/markdown_test.go | 6 +- github/meta_test.go | 2 +- github/migrations_source_import_test.go | 38 +- github/migrations_test.go | 24 +- github/migrations_user_test.go | 24 +- github/orgs_actions_allowed_test.go | 6 +- github/orgs_actions_permissions_test.go | 6 +- github/orgs_artifacts_test.go | 36 +- github/orgs_audit_log.go | 2 +- github/orgs_audit_log_test.go | 66 +- .../orgs_codesecurity_configurations_test.go | 52 +- github/orgs_credential_authorizations_test.go | 8 +- github/orgs_custom_repository_roles_test.go | 64 +- github/orgs_hooks_configuration_test.go | 16 +- github/orgs_hooks_deliveries_test.go | 6 +- github/orgs_hooks_test.go | 8 +- github/orgs_immutable_releases_test.go | 12 +- github/orgs_issue_types_test.go | 44 +- github/orgs_members_test.go | 140 ++--- github/orgs_network_configurations_test.go | 84 +-- github/orgs_organization_properties_test.go | 4 +- github/orgs_organization_roles_test.go | 62 +- github/orgs_outside_collaborators_test.go | 2 +- github/orgs_packages_test.go | 86 +-- github/orgs_personal_access_tokens_test.go | 82 +-- github/orgs_properties_test.go | 62 +- github/orgs_rules_test.go | 256 ++++---- github/orgs_security_managers_test.go | 2 +- github/orgs_test.go | 18 +- github/orgs_users_blocking_test.go | 2 +- github/packages_test.go | 6 +- github/private_registries_test.go | 88 +-- github/projects_test.go | 178 +++--- github/pulls_comments_test.go | 18 +- github/pulls_reviewers_test.go | 10 +- github/pulls_reviews_test.go | 36 +- github/pulls_test.go | 132 ++-- github/reactions_test.go | 28 +- github/repos_actions_access_test.go | 4 +- github/repos_actions_allowed_test.go | 6 +- github/repos_actions_permissions_test.go | 30 +- github/repos_autolinks_test.go | 14 +- github/repos_codeowners_test.go | 4 +- github/repos_collaborators_test.go | 28 +- github/repos_comments_test.go | 14 +- github/repos_commits_test.go | 90 +-- github/repos_community_health_test.go | 44 +- github/repos_contents_test.go | 56 +- .../repos_deployment_branch_policies_test.go | 14 +- .../repos_deployment_protection_rules_test.go | 42 +- github/repos_deployments_test.go | 16 +- github/repos_environments.go | 4 +- github/repos_environments_test.go | 40 +- github/repos_forks_test.go | 6 +- github/repos_hooks_configuration_test.go | 16 +- github/repos_hooks_deliveries_test.go | 10 +- github/repos_hooks_test.go | 8 +- github/repos_immutable_releases_test.go | 2 +- github/repos_invitations_test.go | 4 +- github/repos_keys_test.go | 8 +- github/repos_merging_test.go | 6 +- github/repos_pages_test.go | 60 +- github/repos_prereceive_hooks_test.go | 8 +- github/repos_releases_test.go | 30 +- github/repos_rules.go | 2 +- github/repos_rules_test.go | 30 +- github/repos_stats.go | 10 +- github/repos_stats_test.go | 24 +- github/repos_statuses_test.go | 8 +- github/repos_tags_test.go | 4 +- github/repos_test.go | 400 ++++++------- github/repos_traffic_test.go | 30 +- github/rules.go | 2 +- github/rules_test.go | 112 ++-- github/scim_test.go | 52 +- github/search_test.go | 92 +-- .../secret_scanning_custom_patterns_test.go | 36 +- .../secret_scanning_pattern_configs_test.go | 104 ++-- github/secret_scanning_test.go | 120 ++-- github/security_advisories_test.go | 562 ++++++++--------- github/strings_benchmark_test.go | 2 +- github/strings_test.go | 90 +-- github/sub_issue_test.go | 12 +- github/teams_discussion_comments_test.go | 60 +- github/teams_discussions_test.go | 140 ++--- github/teams_members_test.go | 16 +- github/teams_test.go | 160 ++--- github/users_administration_test.go | 2 +- github/users_blocking_test.go | 2 +- github/users_emails_test.go | 10 +- github/users_followers_test.go | 8 +- github/users_gpg_keys_test.go | 8 +- github/users_keys_test.go | 10 +- github/users_packages_test.go | 100 ++-- github/users_social_accounts_test.go | 6 +- github/users_ssh_signing_keys_test.go | 10 +- github/users_test.go | 16 +- go.mod | 2 +- 189 files changed, 4815 insertions(+), 4813 deletions(-) diff --git a/github/actions_artifacts_test.go b/github/actions_artifacts_test.go index 4ae31c47ff6..1be74b6222e 100644 --- a/github/actions_artifacts_test.go +++ b/github/actions_artifacts_test.go @@ -32,7 +32,7 @@ func TestActionsService_ListArtifacts(t *testing.T) { }) opts := &ListArtifactsOptions{ - Name: Ptr("TheArtifact"), + Name: new("TheArtifact"), ListOptions: ListOptions{Page: 2}, } ctx := t.Context() @@ -41,7 +41,7 @@ func TestActionsService_ListArtifacts(t *testing.T) { t.Errorf("Actions.ListArtifacts returned error: %v", err) } - want := &ArtifactList{TotalCount: Ptr(int64(1)), Artifacts: []*Artifact{{ID: Ptr(int64(1))}}} + want := &ArtifactList{TotalCount: new(int64(1)), Artifacts: []*Artifact{{ID: new(int64(1))}}} if !cmp.Equal(artifacts, want) { t.Errorf("Actions.ListArtifacts returned %+v, want %+v", artifacts, want) } @@ -123,7 +123,7 @@ func TestActionsService_ListWorkflowRunArtifacts(t *testing.T) { t.Errorf("Actions.ListWorkflowRunArtifacts returned error: %v", err) } - want := &ArtifactList{TotalCount: Ptr(int64(1)), Artifacts: []*Artifact{{ID: Ptr(int64(1))}}} + want := &ArtifactList{TotalCount: new(int64(1)), Artifacts: []*Artifact{{ID: new(int64(1))}}} if !cmp.Equal(artifacts, want) { t.Errorf("Actions.ListWorkflowRunArtifacts returned %+v, want %+v", artifacts, want) } @@ -205,11 +205,11 @@ func TestActionsService_GetArtifact(t *testing.T) { } want := &Artifact{ - ID: Ptr(int64(1)), - NodeID: Ptr("xyz"), - Name: Ptr("a"), - SizeInBytes: Ptr(int64(5)), - ArchiveDownloadURL: Ptr("u"), + ID: new(int64(1)), + NodeID: new("xyz"), + Name: new("a"), + SizeInBytes: new(int64(5)), + ArchiveDownloadURL: new("u"), } if !cmp.Equal(artifact, want) { t.Errorf("Actions.GetArtifact returned %+v, want %+v", artifact, want) diff --git a/github/actions_cache_test.go b/github/actions_cache_test.go index 14a8ad194d6..f94c71c2f4c 100644 --- a/github/actions_cache_test.go +++ b/github/actions_cache_test.go @@ -35,7 +35,7 @@ func TestActionsService_ListCaches(t *testing.T) { t.Errorf("Actions.ListCaches returned error: %v", err) } - want := &ActionsCacheList{TotalCount: 1, ActionsCaches: []*ActionsCache{{ID: Ptr(int64(1))}}} + want := &ActionsCacheList{TotalCount: 1, ActionsCaches: []*ActionsCache{{ID: new(int64(1))}}} if !cmp.Equal(cacheList, want) { t.Errorf("Actions.ListCaches returned %+v, want %+v", cacheList, want) } @@ -105,19 +105,19 @@ func TestActionsService_DeleteCachesByKey(t *testing.T) { }) ctx := t.Context() - _, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main")) + _, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", new("main")) if err != nil { t.Errorf("Actions.DeleteCachesByKey return error: %v", err) } const methodName = "DeleteCachesByKey" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.DeleteCachesByKey(ctx, "\n", "\n", "\n", Ptr("\n")) + _, err = client.Actions.DeleteCachesByKey(ctx, "\n", "\n", "\n", new("\n")) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main")) + return client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", new("main")) }) } @@ -126,7 +126,7 @@ func TestActionsService_DeleteCachesByKey_invalidOwner(t *testing.T) { client, _, _ := setup(t) ctx := t.Context() - _, err := client.Actions.DeleteCachesByKey(ctx, "%", "r", "1", Ptr("main")) + _, err := client.Actions.DeleteCachesByKey(ctx, "%", "r", "1", new("main")) testURLParseError(t, err) } @@ -135,7 +135,7 @@ func TestActionsService_DeleteCachesByKey_invalidRepo(t *testing.T) { client, _, _ := setup(t) ctx := t.Context() - _, err := client.Actions.DeleteCachesByKey(ctx, "o", "%", "1", Ptr("main")) + _, err := client.Actions.DeleteCachesByKey(ctx, "o", "%", "1", new("main")) testURLParseError(t, err) } @@ -149,7 +149,7 @@ func TestActionsService_DeleteCachesByKey_notFound(t *testing.T) { }) ctx := t.Context() - resp, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main")) + resp, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", new("main")) if err == nil { t.Error("Expected HTTP 404 response") } diff --git a/github/actions_hosted_runners_test.go b/github/actions_hosted_runners_test.go index b4cc96a61ba..6f0fd9380cf 100644 --- a/github/actions_hosted_runners_test.go +++ b/github/actions_hosted_runners_test.go @@ -84,13 +84,13 @@ func TestActionsService_ListHostedRunners(t *testing.T) { TotalCount: 2, Runners: []*HostedRunner{ { - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -98,9 +98,9 @@ func TestActionsService_ListHostedRunners(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -111,13 +111,13 @@ func TestActionsService_ListHostedRunners(t *testing.T) { LastActiveOn: &referenceTimestamp, }, { - ID: Ptr(int64(7)), - Name: Ptr("My hosted Windows runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("win-x64"), + ID: new(int64(7)), + Name: new("My hosted Windows runner"), + RunnerGroupID: new(int64(2)), + Platform: new("win-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("windows-latest"), - SizeGB: Ptr(int64(256)), + ID: new("windows-latest"), + SizeGB: new(int64(256)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "8-core", @@ -125,9 +125,9 @@ func TestActionsService_ListHostedRunners(t *testing.T) { MemoryGB: 32, StorageGB: 300, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(20)), - PublicIPEnabled: Ptr(false), + Status: new("Ready"), + MaximumRunners: new(int64(20)), + PublicIPEnabled: new(false), PublicIPs: []*HostedRunnerPublicIP{}, LastActiveOn: &referenceTimestamp, }, @@ -194,13 +194,13 @@ func TestActionsService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, RunnerGroupID: 1, Size: "4-core", - MaximumRunners: Ptr(int64(50)), - EnableStaticIP: Ptr(false), - ImageGen: Ptr(true), + MaximumRunners: new(int64(50)), + EnableStaticIP: new(false), + ImageGen: new(true), } hostedRunner, _, err := client.Actions.CreateHostedRunner(ctx, "o", validReq) if err != nil { @@ -208,13 +208,13 @@ func TestActionsService_CreateHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -222,9 +222,9 @@ func TestActionsService_CreateHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -252,7 +252,7 @@ func TestActionsService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, RunnerGroupID: 1, }, @@ -273,7 +273,7 @@ func TestActionsService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, RunnerGroupID: 1, Size: "4-core", @@ -287,7 +287,7 @@ func TestActionsService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, Size: "4-core", }, @@ -623,13 +623,13 @@ func TestActionsService_GetHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -637,9 +637,9 @@ func TestActionsService_GetHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -706,11 +706,11 @@ func TestActionsService_UpdateHostedRunner(t *testing.T) { ctx := t.Context() validReq := UpdateHostedRunnerRequest{ - Name: Ptr("My larger runner"), - RunnerGroupID: Ptr(int64(1)), - MaximumRunners: Ptr(int64(50)), - EnableStaticIP: Ptr(false), - ImageVersion: Ptr("1.0.0"), + Name: new("My larger runner"), + RunnerGroupID: new(int64(1)), + MaximumRunners: new(int64(50)), + EnableStaticIP: new(false), + ImageVersion: new("1.0.0"), } hostedRunner, _, err := client.Actions.UpdateHostedRunner(ctx, "o", 23, validReq) if err != nil { @@ -718,13 +718,13 @@ func TestActionsService_UpdateHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -732,9 +732,9 @@ func TestActionsService_UpdateHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -806,13 +806,13 @@ func TestActionsService_DeleteHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -820,9 +820,9 @@ func TestActionsService_DeleteHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, diff --git a/github/actions_oidc_test.go b/github/actions_oidc_test.go index 710012bf469..9f6c23afd43 100644 --- a/github/actions_oidc_test.go +++ b/github/actions_oidc_test.go @@ -28,7 +28,7 @@ func TestActionsService_GetOrgOIDCSubjectClaimCustomTemplate(t *testing.T) { t.Errorf("Actions.GetOrgOIDCSubjectClaimCustomTemplate returned error: %v", err) } - want := &OIDCSubjectClaimCustomTemplate{IncludeClaimKeys: []string{"repo", "context"}, UseImmutableSubject: Ptr(true)} + want := &OIDCSubjectClaimCustomTemplate{IncludeClaimKeys: []string{"repo", "context"}, UseImmutableSubject: new(true)} if !cmp.Equal(template, want) { t.Errorf("Actions.GetOrgOIDCSubjectClaimCustomTemplate returned %+v, want %+v", template, want) } @@ -63,7 +63,7 @@ func TestActionsService_GetRepoOIDCSubjectClaimCustomTemplate(t *testing.T) { t.Errorf("Actions.GetRepoOIDCSubjectClaimCustomTemplate returned error: %v", err) } - want := &OIDCSubjectClaimCustomTemplate{UseDefault: Ptr(false), IncludeClaimKeys: []string{"repo", "context"}, UseImmutableSubject: Ptr(true), SubClaimPrefix: Ptr("repo:o/r")} + want := &OIDCSubjectClaimCustomTemplate{UseDefault: new(false), IncludeClaimKeys: []string{"repo", "context"}, UseImmutableSubject: new(true), SubClaimPrefix: new("repo:o/r")} if !cmp.Equal(template, want) { t.Errorf("Actions.GetRepoOIDCSubjectClaimCustomTemplate returned %+v, want %+v", template, want) } @@ -89,7 +89,7 @@ func TestActionsService_SetOrgOIDCSubjectClaimCustomTemplate(t *testing.T) { input := OIDCSubjectClaimCustomTemplate{ IncludeClaimKeys: []string{"repo", "context"}, - UseImmutableSubject: Ptr(true), + UseImmutableSubject: new(true), } mux.HandleFunc("/orgs/o/actions/oidc/customization/sub", func(w http.ResponseWriter, r *http.Request) { @@ -122,7 +122,7 @@ func TestActionsService_SetRepoOIDCSubjectClaimCustomTemplate(t *testing.T) { client, mux, _ := setup(t) input := OIDCSubjectClaimCustomTemplate{ - UseDefault: Ptr(false), + UseDefault: new(false), IncludeClaimKeys: []string{"repo", "context"}, } @@ -156,7 +156,7 @@ func TestActionsService_SetRepoOIDCSubjectClaimCustomTemplateToDefault(t *testin client, mux, _ := setup(t) input := OIDCSubjectClaimCustomTemplate{ - UseDefault: Ptr(true), + UseDefault: new(true), } mux.HandleFunc("/repos/o/r/actions/oidc/customization/sub", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index e56d6b11960..c1a98baf3c7 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -27,7 +27,7 @@ func TestActionsService_GetActionsPermissionsInEnterprise(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsPermissionsInEnterprise returned error: %v", err) } - want := &ActionsPermissionsEnterprise{EnabledOrganizations: Ptr("all"), AllowedActions: Ptr("all")} + want := &ActionsPermissionsEnterprise{EnabledOrganizations: new("all"), AllowedActions: new("all")} if !cmp.Equal(ent, want) { t.Errorf("Actions.GetActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) } @@ -51,7 +51,7 @@ func TestActionsService_UpdateActionsPermissionsInEnterprise(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissionsEnterprise{EnabledOrganizations: Ptr("all"), AllowedActions: Ptr("selected")} + input := &ActionsPermissionsEnterprise{EnabledOrganizations: new("all"), AllowedActions: new("selected")} mux.HandleFunc("/enterprises/e/actions/permissions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -65,7 +65,7 @@ func TestActionsService_UpdateActionsPermissionsInEnterprise(t *testing.T) { t.Errorf("Actions.UpdateActionsPermissionsInEnterprise returned error: %v", err) } - want := &ActionsPermissionsEnterprise{EnabledOrganizations: Ptr("all"), AllowedActions: Ptr("selected")} + want := &ActionsPermissionsEnterprise{EnabledOrganizations: new("all"), AllowedActions: new("selected")} if !cmp.Equal(ent, want) { t.Errorf("Actions.UpdateActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) } @@ -107,8 +107,8 @@ func TestActionsService_ListEnabledOrgsInEnterprise(t *testing.T) { } want := &ActionsEnabledOnEnterpriseRepos{TotalCount: int(2), Organizations: []*Organization{ - {ID: Ptr(int64(2))}, - {ID: Ptr(int64(3))}, + {ID: new(int64(2))}, + {ID: new(int64(3))}, }} if !cmp.Equal(got, want) { t.Errorf("Actions.ListEnabledOrgsInEnterprise returned %+v, want %+v", got, want) @@ -232,7 +232,7 @@ func TestActionsService_GetActionsAllowedInEnterprise(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsAllowedInEnterprise returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(ent, want) { t.Errorf("Actions.GetActionsAllowedInEnterprise returned %+v, want %+v", ent, want) } @@ -256,7 +256,7 @@ func TestActionsService_UpdateActionsAllowedInEnterprise(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/enterprises/e/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -270,7 +270,7 @@ func TestActionsService_UpdateActionsAllowedInEnterprise(t *testing.T) { t.Errorf("Actions.UpdateActionsAllowedInEnterprise returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(ent, want) { t.Errorf("Actions.UpdateActionsAllowedInEnterprise returned %+v, want %+v", ent, want) } @@ -304,7 +304,7 @@ func TestActionsService_GetDefaultWorkflowPermissionsInEnterprise(t *testing.T) if err != nil { t.Errorf("Actions.GetDefaultWorkflowPermissionsInEnterprise returned error: %v", err) } - want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} if !cmp.Equal(ent, want) { t.Errorf("Actions.GetDefaultWorkflowPermissionsInEnterprise returned %+v, want %+v", ent, want) } @@ -328,7 +328,7 @@ func TestActionsService_UpdateDefaultWorkflowPermissionsInEnterprise(t *testing. t.Parallel() client, mux, _ := setup(t) - input := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + input := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} mux.HandleFunc("/enterprises/e/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -342,7 +342,7 @@ func TestActionsService_UpdateDefaultWorkflowPermissionsInEnterprise(t *testing. t.Errorf("Actions.UpdateDefaultWorkflowPermissionsInEnterprise returned error: %v", err) } - want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} if !cmp.Equal(ent, want) { t.Errorf("Actions.UpdateDefaultWorkflowPermissionsInEnterprise returned %+v, want %+v", ent, want) } @@ -378,8 +378,8 @@ func TestActionsService_GetArtifactAndLogRetentionPeriodInEnterprise(t *testing. } want := &ArtifactPeriod{ - Days: Ptr(90), - MaximumAllowedDays: Ptr(365), + Days: new(90), + MaximumAllowedDays: new(365), } if !cmp.Equal(period, want) { t.Errorf("Actions.GetArtifactAndLogRetentionPeriodInEnterprise = %+v, want %+v", period, want) @@ -404,7 +404,7 @@ func TestActionsService_UpdateArtifactAndLogRetentionPeriodInEnterprise(t *testi t.Parallel() client, mux, _ := setup(t) - input := &ArtifactPeriodOpt{Days: Ptr(90)} + input := &ArtifactPeriodOpt{Days: new(90)} mux.HandleFunc("/enterprises/e/actions/permissions/artifact-and-log-retention", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -447,7 +447,7 @@ func TestActionsService_GetSelfHostedRunnerPermissionsInEnterprise(t *testing.T) if err != nil { t.Errorf("Actions.GetSelfHostedRunnerPermissionsInEnterprise returned error: %v", err) } - want := &SelfHostRunnerPermissionsEnterprise{DisableSelfHostedRunnersForAllOrgs: Ptr(true)} + want := &SelfHostRunnerPermissionsEnterprise{DisableSelfHostedRunnersForAllOrgs: new(true)} if !cmp.Equal(permissions, want) { t.Errorf("Actions.GetSelfHostedRunnerPermissionsInEnterprise returned %+v, want %+v", permissions, want) } @@ -471,7 +471,7 @@ func TestActionsService_UpdateSelfHostedRunnerPermissionsInEnterprise(t *testing t.Parallel() client, mux, _ := setup(t) - input := &SelfHostRunnerPermissionsEnterprise{DisableSelfHostedRunnersForAllOrgs: Ptr(false)} + input := &SelfHostRunnerPermissionsEnterprise{DisableSelfHostedRunnersForAllOrgs: new(false)} mux.HandleFunc("/enterprises/e/actions/permissions/self-hosted-runners", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -515,10 +515,10 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInEnterprise(t *test t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise returned error: %v", err) } want := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: Ptr(true), - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPRWorkflows: Ptr(false), + RunWorkflowsFromForkPullRequests: new(true), + SendWriteTokensToWorkflows: new(false), + SendSecretsAndVariables: new(true), + RequireApprovalForForkPRWorkflows: new(false), } if !cmp.Equal(permissions, want) { t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInEnterprise returned %+v, want %+v", permissions, want) @@ -545,8 +545,8 @@ func TestActionsService_UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(t *t input := &WorkflowsPermissionsOpt{ RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), + SendWriteTokensToWorkflows: new(false), + SendSecretsAndVariables: new(true), } mux.HandleFunc("/enterprises/e/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index b8dddddba72..121c774ecac 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -27,7 +27,7 @@ func TestActionsService_GetActionsPermissions(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("all"), SHAPinningRequired: Ptr(true)} + want := &ActionsPermissions{EnabledRepositories: new("all"), AllowedActions: new("all"), SHAPinningRequired: new(true)} if !cmp.Equal(org, want) { t.Errorf("Actions.GetActionsPermissions returned %+v, want %+v", org, want) } @@ -51,7 +51,7 @@ func TestActionsService_UpdateActionsPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected"), SHAPinningRequired: Ptr(true)} + input := &ActionsPermissions{EnabledRepositories: new("all"), AllowedActions: new("selected"), SHAPinningRequired: new(true)} mux.HandleFunc("/orgs/o/actions/permissions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -65,7 +65,7 @@ func TestActionsService_UpdateActionsPermissions(t *testing.T) { t.Errorf("Actions.UpdateActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected"), SHAPinningRequired: Ptr(true)} + want := &ActionsPermissions{EnabledRepositories: new("all"), AllowedActions: new("selected"), SHAPinningRequired: new(true)} if !cmp.Equal(org, want) { t.Errorf("Actions.UpdateActionsPermissions returned %+v, want %+v", org, want) } @@ -107,8 +107,8 @@ func TestActionsService_ListEnabledReposInOrg(t *testing.T) { } want := &ActionsEnabledOnOrgRepos{TotalCount: int(2), Repositories: []*Repository{ - {ID: Ptr(int64(2))}, - {ID: Ptr(int64(3))}, + {ID: new(int64(2))}, + {ID: new(int64(3))}, }} if !cmp.Equal(got, want) { t.Errorf("Actions.ListEnabledReposInOrg returned %+v, want %+v", got, want) @@ -232,7 +232,7 @@ func TestActionsService_GetActionsAllowed(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Actions.GetActionsAllowed returned %+v, want %+v", org, want) } @@ -266,7 +266,7 @@ func TestActionsService_GetActionsAllowed_emptyPatterns(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{}} if !cmp.Equal(org, want) { t.Errorf("Actions.GetActionsAllowed returned %+v, want %+v", org, want) } @@ -290,7 +290,7 @@ func TestActionsService_UpdateActionsAllowed(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -304,7 +304,7 @@ func TestActionsService_UpdateActionsAllowed(t *testing.T) { t.Errorf("Actions.UpdateActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Actions.UpdateActionsAllowed returned %+v, want %+v", org, want) } @@ -328,7 +328,7 @@ func TestActionsService_UpdateActionsAllowed_emptyPatterns(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{}} + input := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{}} mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -342,7 +342,7 @@ func TestActionsService_UpdateActionsAllowed_emptyPatterns(t *testing.T) { t.Errorf("Actions.UpdateActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{}} if !cmp.Equal(org, want) { t.Errorf("Actions.UpdateActionsAllowed returned %+v, want %+v", org, want) } @@ -352,7 +352,7 @@ func TestActionsService_UpdateActionsAllowed_nilPatterns(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: nil} + input := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: nil} mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -366,7 +366,7 @@ func TestActionsService_UpdateActionsAllowed_nilPatterns(t *testing.T) { t.Errorf("Actions.UpdateActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Actions.UpdateActionsAllowed returned %+v, want %+v", org, want) } @@ -376,7 +376,7 @@ func TestActionsService_UpdateActionsAllowed_omittedPatterns(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false)} + input := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false)} mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -390,7 +390,7 @@ func TestActionsService_UpdateActionsAllowed_omittedPatterns(t *testing.T) { t.Errorf("Actions.UpdateActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Actions.UpdateActionsAllowed returned %+v, want %+v", org, want) } @@ -410,7 +410,7 @@ func TestActionsService_GetDefaultWorkflowPermissionsInOrganization(t *testing.T if err != nil { t.Errorf("Actions.GetDefaultWorkflowPermissionsInOrganization returned error: %v", err) } - want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} if !cmp.Equal(org, want) { t.Errorf("Actions.GetDefaultWorkflowPermissionsInOrganization returned %+v, want %+v", org, want) } @@ -434,7 +434,7 @@ func TestActionsService_UpdateDefaultWorkflowPermissionsInOrganization(t *testin t.Parallel() client, mux, _ := setup(t) - input := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + input := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} mux.HandleFunc("/orgs/o/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -448,7 +448,7 @@ func TestActionsService_UpdateDefaultWorkflowPermissionsInOrganization(t *testin t.Errorf("Actions.UpdateDefaultWorkflowPermissionsInOrganization returned error: %v", err) } - want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} if !cmp.Equal(org, want) { t.Errorf("Actions.UpdateDefaultWorkflowPermissionsInOrganization returned %+v, want %+v", org, want) } @@ -484,8 +484,8 @@ func TestActionsService_GetArtifactAndLogRetentionPeriodInOrganization(t *testin } want := &ArtifactPeriod{ - Days: Ptr(90), - MaximumAllowedDays: Ptr(365), + Days: new(90), + MaximumAllowedDays: new(365), } if !cmp.Equal(period, want) { t.Errorf("Actions.GetArtifactAndLogRetentionPeriodInOrganization = %+v, want %+v", period, want) @@ -510,7 +510,7 @@ func TestActionsService_UpdateArtifactAndLogRetentionPeriodInOrganization(t *tes t.Parallel() client, mux, _ := setup(t) - input := &ArtifactPeriodOpt{Days: Ptr(90)} + input := &ArtifactPeriodOpt{Days: new(90)} mux.HandleFunc("/orgs/o/actions/permissions/artifact-and-log-retention", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -554,8 +554,8 @@ func TestActionsService_GetSelfHostedRunnersSettingsInOrganization(t *testing.T) t.Errorf("Actions.GetSelfHostedRunnersSettingsInOrganization returned error: %v", err) } want := &SelfHostedRunnersSettingsOrganization{ - EnabledRepositories: Ptr("all"), - SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/permissions/self-hosted-runners/repositories"), + EnabledRepositories: new("all"), + SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/permissions/self-hosted-runners/repositories"), } if !cmp.Equal(settings, want) { t.Errorf("Actions.GetSelfHostedRunnersSettingsInOrganization returned %+v, want %+v", settings, want) @@ -580,7 +580,7 @@ func TestActionsService_UpdateSelfHostedRunnersSettingsInOrganization(t *testing t.Parallel() client, mux, _ := setup(t) - input := &SelfHostedRunnersSettingsOrganizationOpt{EnabledRepositories: Ptr("selected")} + input := &SelfHostedRunnersSettingsOrganizationOpt{EnabledRepositories: new("selected")} mux.HandleFunc("/orgs/o/actions/permissions/self-hosted-runners", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -631,8 +631,8 @@ func TestActionsService_ListRepositoriesSelfHostedRunnersAllowedInOrganization(t } want := &SelfHostedRunnersAllowedRepos{TotalCount: int(2), Repositories: []*Repository{ - {ID: Ptr(int64(2))}, - {ID: Ptr(int64(3))}, + {ID: new(int64(2))}, + {ID: new(int64(3))}, }} if !cmp.Equal(got, want) { t.Errorf("Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganization returned %+v, want %+v", got, want) @@ -757,10 +757,10 @@ func TestActionsService_GetPrivateRepoForkPRWorkflowSettingsInOrganization(t *te t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization returned error: %v", err) } want := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: Ptr(true), - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPRWorkflows: Ptr(false), + RunWorkflowsFromForkPullRequests: new(true), + SendWriteTokensToWorkflows: new(false), + SendSecretsAndVariables: new(true), + RequireApprovalForForkPRWorkflows: new(false), } if !cmp.Equal(permissions, want) { t.Errorf("Actions.GetPrivateRepoForkPRWorkflowSettingsInOrganization returned %+v, want %+v", permissions, want) @@ -787,8 +787,8 @@ func TestActionsService_UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(t input := &WorkflowsPermissionsOpt{ RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), + SendWriteTokensToWorkflows: new(false), + SendSecretsAndVariables: new(true), } mux.HandleFunc("/orgs/o/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_runner_groups_test.go b/github/actions_runner_groups_test.go index 51578b1ee20..820021d0bbf 100644 --- a/github/actions_runner_groups_test.go +++ b/github/actions_runner_groups_test.go @@ -33,9 +33,9 @@ func TestActionsService_ListOrganizationRunnerGroups(t *testing.T) { want := &RunnerGroups{ TotalCount: 3, RunnerGroups: []*RunnerGroup{ - {ID: Ptr(int64(1)), Name: Ptr("Default"), Visibility: Ptr("all"), Default: Ptr(true), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(true), SelectedWorkflows: []string{"a", "b"}}, - {ID: Ptr(int64(2)), Name: Ptr("octo-runner-group"), Visibility: Ptr("selected"), Default: Ptr(false), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, - {ID: Ptr(int64(3)), Name: Ptr("expensive-hardware"), Visibility: Ptr("private"), Default: Ptr(false), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, + {ID: new(int64(1)), Name: new("Default"), Visibility: new("all"), Default: new(true), RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(true), SelectedWorkflows: []string{"a", "b"}}, + {ID: new(int64(2)), Name: new("octo-runner-group"), Visibility: new("selected"), Default: new(false), SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), Inherited: new(true), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, + {ID: new(int64(3)), Name: new("expensive-hardware"), Visibility: new("private"), Default: new(false), RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, }, } if !cmp.Equal(groups, want) { @@ -77,9 +77,9 @@ func TestActionsService_ListOrganizationRunnerGroupsVisibleToRepo(t *testing.T) want := &RunnerGroups{ TotalCount: 3, RunnerGroups: []*RunnerGroup{ - {ID: Ptr(int64(1)), Name: Ptr("Default"), Visibility: Ptr("all"), Default: Ptr(true), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, - {ID: Ptr(int64(2)), Name: Ptr("octo-runner-group"), Visibility: Ptr("selected"), Default: Ptr(false), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, - {ID: Ptr(int64(3)), Name: Ptr("expensive-hardware"), Visibility: Ptr("private"), Default: Ptr(false), RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, + {ID: new(int64(1)), Name: new("Default"), Visibility: new("all"), Default: new(true), RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, + {ID: new(int64(2)), Name: new("octo-runner-group"), Visibility: new("selected"), Default: new(false), SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), Inherited: new(true), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, + {ID: new(int64(3)), Name: new("expensive-hardware"), Visibility: new("private"), Default: new(false), RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, }, } if !cmp.Equal(groups, want) { @@ -117,17 +117,17 @@ func TestActionsService_GetOrganizationRunnerGroup(t *testing.T) { } want := &RunnerGroup{ - ID: Ptr(int64(2)), - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - Default: Ptr(false), - SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), - RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), - HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), - NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), - Inherited: Ptr(false), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + ID: new(int64(2)), + Name: new("octo-runner-group"), + Visibility: new("selected"), + Default: new(false), + SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), + RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), + HostedRunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), + NetworkConfigurationID: new("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), + Inherited: new(false), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } @@ -186,12 +186,12 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) { ctx := t.Context() req := CreateRunnerGroupRequest{ - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + Name: new("octo-runner-group"), + Visibility: new("selected"), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, - NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), + NetworkConfigurationID: new("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), } group, _, err := client.Actions.CreateOrganizationRunnerGroup(ctx, "o", req) if err != nil { @@ -199,17 +199,17 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) { } want := &RunnerGroup{ - ID: Ptr(int64(2)), - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - Default: Ptr(false), - SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), - RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), - HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), - NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), - Inherited: Ptr(false), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + ID: new(int64(2)), + Name: new("octo-runner-group"), + Visibility: new("selected"), + Default: new(false), + SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), + RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), + HostedRunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), + NetworkConfigurationID: new("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), + Inherited: new(false), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } @@ -243,12 +243,12 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) { ctx := t.Context() req := UpdateRunnerGroupRequest{ - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + Name: new("octo-runner-group"), + Visibility: new("selected"), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, - NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), + NetworkConfigurationID: new("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), } group, _, err := client.Actions.UpdateOrganizationRunnerGroup(ctx, "o", 2, req) if err != nil { @@ -256,17 +256,17 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) { } want := &RunnerGroup{ - ID: Ptr(int64(2)), - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - Default: Ptr(false), - SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), - RunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), - HostedRunnersURL: Ptr("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), - NetworkConfigurationID: Ptr("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), - Inherited: Ptr(false), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + ID: new(int64(2)), + Name: new("octo-runner-group"), + Visibility: new("selected"), + Default: new(false), + SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), + RunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), + HostedRunnersURL: new("https://api.github.com/orgs/octo-org/actions/runner_groups/2/hosted-runners"), + NetworkConfigurationID: new("EC486D5D793175D7E3B29C27318D5C1AAE49A7833FC85F2E82C3D2C54AC7D3BA"), + Inherited: new(false), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } @@ -307,9 +307,9 @@ func TestActionsService_ListRepositoryAccessRunnerGroup(t *testing.T) { } want := &ListRepositories{ - TotalCount: Ptr(1), + TotalCount: new(1), Repositories: []*Repository{ - {ID: Ptr(int64(43)), NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: Ptr("Hello-World"), FullName: Ptr("octocat/Hello-World")}, + {ID: new(int64(43)), NodeID: new("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: new("Hello-World"), FullName: new("octocat/Hello-World")}, }, } if !cmp.Equal(groups, want) { @@ -486,13 +486,13 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) { TotalCount: 2, Runners: []*HostedRunner{ { - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -500,9 +500,9 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -513,13 +513,13 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) { LastActiveOn: &referenceTimestamp, }, { - ID: Ptr(int64(7)), - Name: Ptr("My hosted Windows runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("win-x64"), + ID: new(int64(7)), + Name: new("My hosted Windows runner"), + RunnerGroupID: new(int64(2)), + Platform: new("win-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("windows-latest"), - SizeGB: Ptr(int64(256)), + ID: new("windows-latest"), + SizeGB: new(int64(256)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "8-core", @@ -527,9 +527,9 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) { MemoryGB: 32, StorageGB: 300, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(20)), - PublicIPEnabled: Ptr(false), + Status: new("Ready"), + MaximumRunners: new(int64(20)), + PublicIPEnabled: new(false), PublicIPs: []*HostedRunnerPublicIP{}, LastActiveOn: &referenceTimestamp, }, @@ -574,8 +574,8 @@ func TestActionsService_ListRunnerGroupRunners(t *testing.T) { want := &Runners{ TotalCount: 2, Runners: []*Runner{ - {ID: Ptr(int64(23)), Name: Ptr("MBP"), OS: Ptr("macos"), Status: Ptr("online")}, - {ID: Ptr(int64(24)), Name: Ptr("iMac"), OS: Ptr("macos"), Status: Ptr("offline")}, + {ID: new(int64(23)), Name: new("MBP"), OS: new("macos"), Status: new("online")}, + {ID: new(int64(24)), Name: new("iMac"), OS: new("macos"), Status: new("offline")}, }, } if !cmp.Equal(runners, want) { diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index c29bab5c096..861ac612c3c 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -29,11 +29,11 @@ func TestActionsService_ListRunnerApplicationDownloads(t *testing.T) { } want := []*RunnerApplicationDownload{ - {OS: Ptr("osx"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-osx-x64-2.164.0.tar.gz")}, - {OS: Ptr("linux"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-x64-2.164.0.tar.gz")}, - {OS: Ptr("linux"), Architecture: Ptr("arm"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-arm-2.164.0.tar.gz")}, - {OS: Ptr("win"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: Ptr("actions-runner-win-x64-2.164.0.zip")}, - {OS: Ptr("linux"), Architecture: Ptr("arm64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-arm64-2.164.0.tar.gz")}, + {OS: new("osx"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: new("actions-runner-osx-x64-2.164.0.tar.gz")}, + {OS: new("linux"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: new("actions-runner-linux-x64-2.164.0.tar.gz")}, + {OS: new("linux"), Architecture: new("arm"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: new("actions-runner-linux-arm-2.164.0.tar.gz")}, + {OS: new("win"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: new("actions-runner-win-x64-2.164.0.zip")}, + {OS: new("linux"), Architecture: new("arm64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: new("actions-runner-linux-arm64-2.164.0.tar.gz")}, } if !cmp.Equal(downloads, want) { t.Errorf("Actions.ListRunnerApplicationDownloads returned %+v, want %+v", downloads, want) @@ -72,7 +72,7 @@ func TestActionsService_CreateOrgJITConfig(t *testing.T) { t.Errorf("Actions.CreateOrgJITConfig returned error: %v", err) } - want := &JITRunnerConfig{EncodedJITConfig: Ptr("foo")} + want := &JITRunnerConfig{EncodedJITConfig: new("foo")} if !cmp.Equal(jitConfig, want) { t.Errorf("Actions.CreateOrgJITConfig returned %+v, want %+v", jitConfig, want) } @@ -110,7 +110,7 @@ func TestActionsService_CreateRepoJITConfig(t *testing.T) { t.Errorf("Actions.CreateRepoJITConfig returned error: %v", err) } - want := &JITRunnerConfig{EncodedJITConfig: Ptr("foo")} + want := &JITRunnerConfig{EncodedJITConfig: new("foo")} if !cmp.Equal(jitConfig, want) { t.Errorf("Actions.CreateRepoJITConfig returned %+v, want %+v", jitConfig, want) } @@ -146,7 +146,7 @@ func TestActionsService_CreateRegistrationToken(t *testing.T) { } want := &RegistrationToken{ - Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), + Token: new("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp, } if !cmp.Equal(token, want) { @@ -179,7 +179,7 @@ func TestActionsService_ListRunners(t *testing.T) { }) opts := &ListRunnersOptions{ - Name: Ptr("MBP"), + Name: new("MBP"), ListOptions: ListOptions{Page: 2, PerPage: 2}, } ctx := t.Context() @@ -191,7 +191,7 @@ func TestActionsService_ListRunners(t *testing.T) { want := &Runners{ TotalCount: 1, Runners: []*Runner{ - {ID: Ptr(int64(23)), Name: Ptr("MBP"), OS: Ptr("macos"), Status: Ptr("online")}, + {ID: new(int64(23)), Name: new("MBP"), OS: new("macos"), Status: new("online")}, }, } if !cmp.Equal(runners, want) { @@ -229,10 +229,10 @@ func TestActionsService_GetRunner(t *testing.T) { } want := &Runner{ - ID: Ptr(int64(23)), - Name: Ptr("MBP"), - OS: Ptr("macos"), - Status: Ptr("online"), + ID: new(int64(23)), + Name: new("MBP"), + OS: new("macos"), + Status: new("online"), } if !cmp.Equal(runner, want) { t.Errorf("Actions.GetRunner returned %+v, want %+v", runner, want) @@ -268,7 +268,7 @@ func TestActionsService_CreateRemoveToken(t *testing.T) { t.Errorf("Actions.CreateRemoveToken returned error: %v", err) } - want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp} + want := &RemoveToken{Token: new("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp} if !cmp.Equal(token, want) { t.Errorf("Actions.CreateRemoveToken returned %+v, want %+v", token, want) } @@ -329,11 +329,11 @@ func TestActionsService_ListOrganizationRunnerApplicationDownloads(t *testing.T) } want := []*RunnerApplicationDownload{ - {OS: Ptr("osx"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-osx-x64-2.164.0.tar.gz")}, - {OS: Ptr("linux"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-x64-2.164.0.tar.gz")}, - {OS: Ptr("linux"), Architecture: Ptr("arm"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-arm-2.164.0.tar.gz")}, - {OS: Ptr("win"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: Ptr("actions-runner-win-x64-2.164.0.zip")}, - {OS: Ptr("linux"), Architecture: Ptr("arm64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-arm64-2.164.0.tar.gz")}, + {OS: new("osx"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: new("actions-runner-osx-x64-2.164.0.tar.gz")}, + {OS: new("linux"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: new("actions-runner-linux-x64-2.164.0.tar.gz")}, + {OS: new("linux"), Architecture: new("arm"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: new("actions-runner-linux-arm-2.164.0.tar.gz")}, + {OS: new("win"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: new("actions-runner-win-x64-2.164.0.zip")}, + {OS: new("linux"), Architecture: new("arm64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: new("actions-runner-linux-arm64-2.164.0.tar.gz")}, } if !cmp.Equal(downloads, want) { t.Errorf("Actions.ListOrganizationRunnerApplicationDownloads returned %+v, want %+v", downloads, want) @@ -370,7 +370,7 @@ func TestActionsService_CreateOrganizationRegistrationToken(t *testing.T) { } want := &RegistrationToken{ - Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), + Token: new("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp, } if !cmp.Equal(token, want) { @@ -414,8 +414,8 @@ func TestActionsService_ListOrganizationRunners(t *testing.T) { want := &Runners{ TotalCount: 2, Runners: []*Runner{ - {ID: Ptr(int64(23)), Name: Ptr("MBP"), OS: Ptr("macos"), Status: Ptr("online")}, - {ID: Ptr(int64(24)), Name: Ptr("iMac"), OS: Ptr("macos"), Status: Ptr("offline")}, + {ID: new(int64(23)), Name: new("MBP"), OS: new("macos"), Status: new("online")}, + {ID: new(int64(24)), Name: new("iMac"), OS: new("macos"), Status: new("offline")}, }, } if !cmp.Equal(runners, want) { @@ -453,10 +453,10 @@ func TestActionsService_GetOrganizationRunner(t *testing.T) { } want := &Runner{ - ID: Ptr(int64(23)), - Name: Ptr("MBP"), - OS: Ptr("macos"), - Status: Ptr("online"), + ID: new(int64(23)), + Name: new("MBP"), + OS: new("macos"), + Status: new("online"), } if !cmp.Equal(runner, want) { t.Errorf("Actions.GetOrganizationRunner returned %+v, want %+v", runner, want) @@ -492,7 +492,7 @@ func TestActionsService_CreateOrganizationRemoveToken(t *testing.T) { t.Errorf("Actions.CreateOrganizationRemoveToken returned error: %v", err) } - want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp} + want := &RemoveToken{Token: new("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp} if !cmp.Equal(token, want) { t.Errorf("Actions.CreateOrganizationRemoveToken returned %+v, want %+v", token, want) } diff --git a/github/actions_secrets.go b/github/actions_secrets.go index 2426a10d98c..e3d4de0b221 100644 --- a/github/actions_secrets.go +++ b/github/actions_secrets.go @@ -39,7 +39,7 @@ func (p *PublicKey) UnmarshalJSON(data []byte) error { case string: p.KeyID = &v case float64: - p.KeyID = Ptr(strconv.FormatFloat(v, 'f', -1, 64)) + p.KeyID = new(strconv.FormatFloat(v, 'f', -1, 64)) default: return fmt.Errorf("unable to unmarshal %T as a string", v) } diff --git a/github/actions_secrets_test.go b/github/actions_secrets_test.go index e1e00c721b7..1b36d82c6a1 100644 --- a/github/actions_secrets_test.go +++ b/github/actions_secrets_test.go @@ -33,17 +33,17 @@ func TestPublicKey_UnmarshalJSON(t *testing.T) { }, "Numeric KeyID": { data: []byte(`{"key_id":1234,"key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: false, }, "String KeyID": { data: []byte(`{"key_id":"1234","key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: false, }, "Invalid KeyID": { data: []byte(`{"key_id":["1234"],"key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{KeyID: nil, Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{KeyID: nil, Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: true, }, "Invalid Key": { @@ -63,12 +63,12 @@ func TestPublicKey_UnmarshalJSON(t *testing.T) { }, "Missing Key": { data: []byte(`{"key_id":"1234"}`), - wantPublicKey: PublicKey{KeyID: Ptr("1234")}, + wantPublicKey: PublicKey{KeyID: new("1234")}, wantErr: false, }, "Missing KeyID": { data: []byte(`{"key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: false, }, } @@ -106,7 +106,7 @@ func TestActionsService_GetRepoPublicKey(t *testing.T) { t.Errorf("Actions.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -141,7 +141,7 @@ func TestActionsService_GetRepoPublicKeyNumeric(t *testing.T) { t.Errorf("Actions.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -363,7 +363,7 @@ func TestActionsService_GetOrgPublicKey(t *testing.T) { t.Errorf("Actions.GetOrgPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("012345678"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("012345678"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetOrgPublicKey returned %+v, want %+v", key, want) } @@ -526,9 +526,9 @@ func TestActionsService_ListSelectedReposForOrgSecret(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Ptr(1), + TotalCount: new(1), Repositories: []*Repository{ - {ID: Ptr(int64(1))}, + {ID: new(int64(1))}, }, } if !cmp.Equal(repos, want) { @@ -683,7 +683,7 @@ func TestActionsService_GetEnvPublicKey(t *testing.T) { t.Errorf("Actions.GetEnvPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetEnvPublicKey returned %+v, want %+v", key, want) } @@ -718,7 +718,7 @@ func TestActionsService_GetEnvPublicKeyNumeric(t *testing.T) { t.Errorf("Actions.GetEnvPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetEnvPublicKey returned %+v, want %+v", key, want) } diff --git a/github/actions_variables_test.go b/github/actions_variables_test.go index d251677e4e1..40f7b1b18d3 100644 --- a/github/actions_variables_test.go +++ b/github/actions_variables_test.go @@ -179,7 +179,7 @@ func TestActionsService_UpdateRepoVariable(t *testing.T) { name := "NAME" input := ActionsUpdateVariableRequest{ Name: &name, - Value: Ptr("VALUE"), + Value: new("VALUE"), } mux.HandleFunc("/repos/o/r/actions/variables/NAME", func(w http.ResponseWriter, r *http.Request) { @@ -251,9 +251,9 @@ func TestActionsService_ListOrgVariables(t *testing.T) { want := &ActionsVariables{ TotalCount: 3, Variables: []*ActionsVariable{ - {Name: "A", Value: "AA", CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), Visibility: Ptr("private")}, - {Name: "B", Value: "BB", CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003), Visibility: Ptr("all")}, - {Name: "C", Value: "CC", CreatedAt: refTimestamp(1136178004), UpdatedAt: refTimestamp(1136178005), Visibility: Ptr("selected"), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/variables/VAR/repositories")}, + {Name: "A", Value: "AA", CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), Visibility: new("private")}, + {Name: "B", Value: "BB", CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003), Visibility: new("all")}, + {Name: "C", Value: "CC", CreatedAt: refTimestamp(1136178004), UpdatedAt: refTimestamp(1136178005), Visibility: new("selected"), SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/variables/VAR/repositories")}, }, } if !cmp.Equal(variables, want) { @@ -295,8 +295,8 @@ func TestActionsService_GetOrgVariable(t *testing.T) { Value: "VALUE", CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Visibility: Ptr("selected"), - SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/variables/VAR/repositories"), + Visibility: new("selected"), + SelectedRepositoriesURL: new("https://api.github.com/orgs/octo-org/actions/variables/VAR/repositories"), } if !cmp.Equal(variable, want) { t.Errorf("Actions.GetOrgVariable returned %+v, want %+v", variable, want) @@ -359,8 +359,8 @@ func TestActionsService_UpdateOrgVariable(t *testing.T) { name := "NAME" input := ActionsUpdateOrgVariableRequest{ Name: &name, - Value: Ptr("VALUE"), - Visibility: Ptr("selected"), + Value: new("VALUE"), + Visibility: new("selected"), SelectedRepositoryIDs: []int64{1296269, 1269280}, } @@ -405,9 +405,9 @@ func TestActionsService_ListSelectedReposForOrgVariable(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Ptr(1), + TotalCount: new(1), Repositories: []*Repository{ - {ID: Ptr(int64(1))}, + {ID: new(int64(1))}, }, } if !cmp.Equal(repos, want) { @@ -470,7 +470,7 @@ func TestActionsService_AddSelectedRepoToOrgVariable(t *testing.T) { testMethod(t, r, "PUT") }) - repo := &Repository{ID: Ptr(int64(1234))} + repo := &Repository{ID: new(int64(1234))} ctx := t.Context() _, err := client.Actions.AddSelectedRepoToOrgVariable(ctx, "o", "NAME", repo) if err != nil { @@ -504,7 +504,7 @@ func TestActionsService_RemoveSelectedRepoFromOrgVariable(t *testing.T) { testMethod(t, r, "DELETE") }) - repo := &Repository{ID: Ptr(int64(1234))} + repo := &Repository{ID: new(int64(1234))} ctx := t.Context() _, err := client.Actions.RemoveSelectedRepoFromOrgVariable(ctx, "o", "NAME", repo) if err != nil { @@ -678,7 +678,7 @@ func TestActionsService_UpdateEnvVariable(t *testing.T) { name := "NAME" input := ActionsUpdateVariableRequest{ Name: &name, - Value: Ptr("VAR"), + Value: new("VAR"), } mux.HandleFunc("/repos/o/r/environments/e/variables/NAME", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index 519fbd4ff55..b74515fed54 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -34,10 +34,10 @@ func TestActionsService_ListWorkflowJobs(t *testing.T) { } want := &Jobs{ - TotalCount: Ptr(4), + TotalCount: new(4), Jobs: []*WorkflowJob{ - {ID: Ptr(int64(399444496)), RunID: Ptr(int64(29679449)), StartedAt: refTimestamp(1136178000), CompletedAt: refTimestamp(1136178001)}, - {ID: Ptr(int64(399444497)), RunID: Ptr(int64(29679449)), StartedAt: refTimestamp(1136178002), CompletedAt: refTimestamp(1136178003)}, + {ID: new(int64(399444496)), RunID: new(int64(29679449)), StartedAt: refTimestamp(1136178000), CompletedAt: refTimestamp(1136178001)}, + {ID: new(int64(399444497)), RunID: new(int64(29679449)), StartedAt: refTimestamp(1136178002), CompletedAt: refTimestamp(1136178003)}, }, } if !cmp.Equal(jobs, want) { @@ -77,10 +77,10 @@ func TestActionsService_ListWorkflowJobs_Filter(t *testing.T) { } want := &Jobs{ - TotalCount: Ptr(4), + TotalCount: new(4), Jobs: []*WorkflowJob{ - {ID: Ptr(int64(399444496)), RunID: Ptr(int64(29679449)), StartedAt: refTimestamp(1136178000), CompletedAt: refTimestamp(1136178001)}, - {ID: Ptr(int64(399444497)), RunID: Ptr(int64(29679449)), StartedAt: refTimestamp(1136178002), CompletedAt: refTimestamp(1136178003)}, + {ID: new(int64(399444496)), RunID: new(int64(29679449)), StartedAt: refTimestamp(1136178000), CompletedAt: refTimestamp(1136178001)}, + {ID: new(int64(399444497)), RunID: new(int64(29679449)), StartedAt: refTimestamp(1136178002), CompletedAt: refTimestamp(1136178003)}, }, } if !cmp.Equal(jobs, want) { @@ -105,21 +105,21 @@ func TestActionsService_ListWorkflowJobsAttempt(t *testing.T) { } want := &Jobs{ - TotalCount: Ptr(4), + TotalCount: new(4), Jobs: []*WorkflowJob{ { - ID: Ptr(int64(399444496)), - RunID: Ptr(int64(29679449)), + ID: new(int64(399444496)), + RunID: new(int64(29679449)), StartedAt: refTimestamp(1136178000), CompletedAt: refTimestamp(1136178001), - RunAttempt: Ptr(int64(2)), + RunAttempt: new(int64(2)), }, { - ID: Ptr(int64(399444497)), - RunID: Ptr(int64(29679449)), + ID: new(int64(399444497)), + RunID: new(int64(29679449)), StartedAt: refTimestamp(1136178002), CompletedAt: refTimestamp(1136178003), - RunAttempt: Ptr(int64(2)), + RunAttempt: new(int64(2)), }, }, } @@ -158,7 +158,7 @@ func TestActionsService_GetWorkflowJobByID(t *testing.T) { } want := &WorkflowJob{ - ID: Ptr(int64(399444496)), + ID: new(int64(399444496)), StartedAt: refTimestamp(1136178000), CompletedAt: refTimestamp(1136178001), } diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index bd53983e422..6a513e5da79 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -34,10 +34,10 @@ func TestActionsService_ListWorkflowRunsByID(t *testing.T) { } want := &WorkflowRuns{ - TotalCount: Ptr(4), + TotalCount: new(4), WorkflowRuns: []*WorkflowRun{ - {ID: Ptr(int64(399444496)), RunNumber: Ptr(296), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, - {ID: Ptr(int64(399444497)), RunNumber: Ptr(296), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, + {ID: new(int64(399444496)), RunNumber: new(296), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, + {ID: new(int64(399444497)), RunNumber: new(296), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, }, } if !cmp.Equal(runs, want) { @@ -77,10 +77,10 @@ func TestActionsService_ListWorkflowRunsFileName(t *testing.T) { } want := &WorkflowRuns{ - TotalCount: Ptr(4), + TotalCount: new(4), WorkflowRuns: []*WorkflowRun{ - {ID: Ptr(int64(399444496)), RunNumber: Ptr(296), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, - {ID: Ptr(int64(399444497)), RunNumber: Ptr(296), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, + {ID: new(int64(399444496)), RunNumber: new(296), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, + {ID: new(int64(399444497)), RunNumber: new(296), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, }, } if !cmp.Equal(runs, want) { @@ -118,8 +118,8 @@ func TestActionsService_GetWorkflowRunByID(t *testing.T) { } want := &WorkflowRun{ - ID: Ptr(int64(399444496)), - RunNumber: Ptr(296), + ID: new(int64(399444496)), + RunNumber: new(296), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), } @@ -153,7 +153,7 @@ func TestActionsService_GetWorkflowRunAttempt(t *testing.T) { fmt.Fprint(w, `{"id":399444496,"run_number":296,"run_attempt":3,"created_at":`+refTimeStr(1136178000)+`,"updated_at":`+refTimeStr(1136178001)+`}`) }) - opts := &WorkflowRunAttemptOptions{ExcludePullRequests: Ptr(true)} + opts := &WorkflowRunAttemptOptions{ExcludePullRequests: new(true)} ctx := t.Context() runs, _, err := client.Actions.GetWorkflowRunAttempt(ctx, "o", "r", 29679449, 3, opts) if err != nil { @@ -161,9 +161,9 @@ func TestActionsService_GetWorkflowRunAttempt(t *testing.T) { } want := &WorkflowRun{ - ID: Ptr(int64(399444496)), - RunNumber: Ptr(296), - RunAttempt: Ptr(3), + ID: new(int64(399444496)), + RunNumber: new(296), + RunAttempt: new(3), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), } @@ -714,10 +714,10 @@ func TestActionsService_ListRepositoryWorkflowRuns(t *testing.T) { } expected := &WorkflowRuns{ - TotalCount: Ptr(2), + TotalCount: new(2), WorkflowRuns: []*WorkflowRun{ - {ID: Ptr(int64(298499444)), RunNumber: Ptr(301), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, - {ID: Ptr(int64(298499445)), RunNumber: Ptr(302), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, + {ID: new(int64(298499444)), RunNumber: new(301), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, + {ID: new(int64(298499445)), RunNumber: new(302), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, }, } @@ -844,35 +844,35 @@ func TestActionsService_GetWorkflowRunUsageByID(t *testing.T) { want := &WorkflowRunUsage{ Billable: &WorkflowRunBillMap{ "UBUNTU": &WorkflowRunBill{ - TotalMS: Ptr(int64(180000)), - Jobs: Ptr(1), + TotalMS: new(int64(180000)), + Jobs: new(1), JobRuns: []*WorkflowRunJobRun{ { - JobID: Ptr(1), - DurationMS: Ptr(int64(60000)), + JobID: new(1), + DurationMS: new(int64(60000)), }, }, }, "MACOS": &WorkflowRunBill{ - TotalMS: Ptr(int64(240000)), - Jobs: Ptr(2), + TotalMS: new(int64(240000)), + Jobs: new(2), JobRuns: []*WorkflowRunJobRun{ { - JobID: Ptr(2), - DurationMS: Ptr(int64(30000)), + JobID: new(2), + DurationMS: new(int64(30000)), }, { - JobID: Ptr(3), - DurationMS: Ptr(int64(10000)), + JobID: new(3), + DurationMS: new(int64(10000)), }, }, }, "WINDOWS": &WorkflowRunBill{ - TotalMS: Ptr(int64(300000)), - Jobs: Ptr(2), + TotalMS: new(int64(300000)), + Jobs: new(2), }, }, - RunDurationMS: Ptr(int64(500000)), + RunDurationMS: new(int64(500000)), } if !cmp.Equal(workflowRunUsage, want) { @@ -912,7 +912,7 @@ func TestActionsService_PendingDeployments(t *testing.T) { t.Errorf("Actions.PendingDeployments returned error: %v", err) } - want := []*Deployment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Deployment{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(deployments, want) { t.Errorf("Actions.PendingDeployments returned %+v, want %+v", deployments, want) } @@ -991,40 +991,40 @@ func TestActionsService_GetPendingDeployments(t *testing.T) { want := []*PendingDeployment{ { Environment: &PendingDeploymentEnvironment{ - ID: Ptr(int64(1)), - NodeID: Ptr("nid"), - Name: Ptr("n"), - URL: Ptr("u"), - HTMLURL: Ptr("hu"), + ID: new(int64(1)), + NodeID: new("nid"), + Name: new("n"), + URL: new("u"), + HTMLURL: new("hu"), }, - WaitTimer: Ptr(int64(0)), + WaitTimer: new(int64(0)), WaitTimerStartedAt: refTimestamp(1136178000), - CurrentUserCanApprove: Ptr(false), + CurrentUserCanApprove: new(false), Reviewers: []*RequiredReviewer{}, }, { Environment: &PendingDeploymentEnvironment{ - ID: Ptr(int64(2)), - NodeID: Ptr("nid"), - Name: Ptr("n"), - URL: Ptr("u"), - HTMLURL: Ptr("hu"), + ID: new(int64(2)), + NodeID: new("nid"), + Name: new("n"), + URL: new("u"), + HTMLURL: new("hu"), }, - WaitTimer: Ptr(int64(13)), + WaitTimer: new(int64(13)), WaitTimerStartedAt: refTimestamp(1136178001), - CurrentUserCanApprove: Ptr(true), + CurrentUserCanApprove: new(true), Reviewers: []*RequiredReviewer{ { - Type: Ptr("User"), + Type: new("User"), Reviewer: &User{ - Login: Ptr("l"), + Login: new("l"), }, }, { - Type: Ptr("Team"), + Type: new("Team"), Reviewer: &Team{ - Name: Ptr("t"), - Slug: Ptr("s"), + Name: new("t"), + Slug: new("s"), }, }, }, diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index a1c9ca728b1..c708c4af455 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -31,10 +31,10 @@ func TestActionsService_ListWorkflows(t *testing.T) { } want := &Workflows{ - TotalCount: Ptr(4), + TotalCount: new(4), Workflows: []*Workflow{ - {ID: Ptr(int64(72844)), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, - {ID: Ptr(int64(72845)), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, + {ID: new(int64(72844)), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001)}, + {ID: new(int64(72845)), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003)}, }, } if !cmp.Equal(workflows, want) { @@ -72,7 +72,7 @@ func TestActionsService_GetWorkflowByID(t *testing.T) { } want := &Workflow{ - ID: Ptr(int64(72844)), + ID: new(int64(72844)), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), } @@ -111,7 +111,7 @@ func TestActionsService_GetWorkflowByFileName(t *testing.T) { } want := &Workflow{ - ID: Ptr(int64(72844)), + ID: new(int64(72844)), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), } @@ -152,13 +152,13 @@ func TestActionsService_GetWorkflowUsageByID(t *testing.T) { want := &WorkflowUsage{ Billable: &WorkflowBillMap{ "UBUNTU": &WorkflowBill{ - TotalMS: Ptr(int64(180000)), + TotalMS: new(int64(180000)), }, "MACOS": &WorkflowBill{ - TotalMS: Ptr(int64(240000)), + TotalMS: new(int64(240000)), }, "WINDOWS": &WorkflowBill{ - TotalMS: Ptr(int64(300000)), + TotalMS: new(int64(300000)), }, }, } @@ -199,13 +199,13 @@ func TestActionsService_GetWorkflowUsageByFileName(t *testing.T) { want := &WorkflowUsage{ Billable: &WorkflowBillMap{ "UBUNTU": &WorkflowBill{ - TotalMS: Ptr(int64(180000)), + TotalMS: new(int64(180000)), }, "MACOS": &WorkflowBill{ - TotalMS: Ptr(int64(240000)), + TotalMS: new(int64(240000)), }, "WINDOWS": &WorkflowBill{ - TotalMS: Ptr(int64(300000)), + TotalMS: new(int64(300000)), }, }, } @@ -234,7 +234,7 @@ func TestActionsService_CreateWorkflowDispatchEventByID(t *testing.T) { event := CreateWorkflowDispatchEventRequest{ Ref: "d4cfb6e7", - ReturnRunDetails: Ptr(true), + ReturnRunDetails: new(true), Inputs: map[string]any{ "key": "value", }, @@ -253,9 +253,9 @@ func TestActionsService_CreateWorkflowDispatchEventByID(t *testing.T) { } want := &WorkflowDispatchRunDetails{ - WorkflowRunID: Ptr(int64(1)), - RunURL: Ptr("https://api.github.com/repos/o/r/actions/runs/1"), - HTMLURL: Ptr("https://github.com/o/r/actions/runs/1"), + WorkflowRunID: new(int64(1)), + RunURL: new("https://api.github.com/repos/o/r/actions/runs/1"), + HTMLURL: new("https://github.com/o/r/actions/runs/1"), } if !cmp.Equal(dispatchResponse, want) { t.Errorf("Actions.CreateWorkflowDispatchEventByID = %+v, want %+v", dispatchResponse, want) @@ -289,7 +289,7 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName(t *testing.T) { event := CreateWorkflowDispatchEventRequest{ Ref: "d4cfb6e7", - ReturnRunDetails: Ptr(true), + ReturnRunDetails: new(true), Inputs: map[string]any{ "key": "value", }, @@ -308,9 +308,9 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName(t *testing.T) { } want := &WorkflowDispatchRunDetails{ - WorkflowRunID: Ptr(int64(1)), - RunURL: Ptr("https://api.github.com/repos/o/r/actions/runs/1"), - HTMLURL: Ptr("https://github.com/o/r/actions/runs/1"), + WorkflowRunID: new(int64(1)), + RunURL: new("https://api.github.com/repos/o/r/actions/runs/1"), + HTMLURL: new("https://github.com/o/r/actions/runs/1"), } if !cmp.Equal(dispatchResponse, want) { t.Errorf("Actions.CreateWorkflowDispatchEventByFileName = %+v, want %+v", dispatchResponse, want) diff --git a/github/activity_events_test.go b/github/activity_events_test.go index 459c8ab4f46..983b6949015 100644 --- a/github/activity_events_test.go +++ b/github/activity_events_test.go @@ -33,7 +33,7 @@ func TestActivityService_ListEvents(t *testing.T) { t.Errorf("Activities.ListEvents returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListEvents returned %+v, want %+v", events, want) } @@ -67,7 +67,7 @@ func TestActivityService_ListRepositoryEvents(t *testing.T) { t.Errorf("Activities.ListRepositoryEvents returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListRepositoryEvents returned %+v, want %+v", events, want) } @@ -115,7 +115,7 @@ func TestActivityService_ListIssueEventsForRepository(t *testing.T) { t.Errorf("Activities.ListIssueEventsForRepository returned error: %v", err) } - want := []*IssueEvent{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*IssueEvent{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListIssueEventsForRepository returned %+v, want %+v", events, want) } @@ -163,7 +163,7 @@ func TestActivityService_ListEventsForRepoNetwork(t *testing.T) { t.Errorf("Activity.ListEventsForRepoNetwork returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activity.ListEventsForRepoNetwork returned %+v, want %+v", events, want) } @@ -211,7 +211,7 @@ func TestActivityService_ListEventsForOrganization(t *testing.T) { t.Errorf("Activity.ListEventsForOrganization returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activity.ListEventsForOrganization returned %+v, want %+v", events, want) } @@ -259,7 +259,7 @@ func TestActivityService_ListEventsPerformedByUser_all(t *testing.T) { t.Errorf("Activity.ListEventsPerformedByUser returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activity.ListEventsPerformedByUser returned %+v, want %+v", events, want) } @@ -294,7 +294,7 @@ func TestActivityService_ListEventsPerformedByUser_publicOnly(t *testing.T) { t.Errorf("Activity.ListEventsPerformedByUser returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activity.ListEventsPerformedByUser returned %+v, want %+v", events, want) } @@ -328,7 +328,7 @@ func TestActivityService_ListEventsReceivedByUser_all(t *testing.T) { t.Errorf("Activity.ListEventsReceivedByUser returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activity.ListEventsReceivedByUser returned %+v, want %+v", events, want) } @@ -363,7 +363,7 @@ func TestActivityService_ListEventsReceivedByUser_publicOnly(t *testing.T) { t.Errorf("Activity.ListEventsReceivedByUser returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activity.ListEventsReceivedByUser returned %+v, want %+v", events, want) } @@ -397,7 +397,7 @@ func TestActivityService_ListUserEventsForOrganization(t *testing.T) { t.Errorf("Activity.ListUserEventsForOrganization returned error: %v", err) } - want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} + want := []*Event{{ID: new("1")}, {ID: new("2")}} if !cmp.Equal(events, want) { t.Errorf("Activity.ListUserEventsForOrganization returned %+v, want %+v", events, want) } @@ -425,7 +425,7 @@ func TestActivityService_EventParsePayload_typed(t *testing.T) { t.Fatalf("Unmarshal Event returned error: %v", err) } - want := &PushEvent{PushID: Ptr(int64(1))} + want := &PushEvent{PushID: new(int64(1))} got, err := event.ParsePayload() if err != nil { t.Fatalf("ParsePayload returned unexpected error: %v", err) @@ -464,7 +464,7 @@ func TestActivityService_EventParsePayload_installation(t *testing.T) { t.Fatalf("Unmarshal Event returned error: %v", err) } - want := &PullRequestEvent{Installation: &Installation{ID: Ptr(int64(1))}} + want := &PullRequestEvent{Installation: &Installation{ID: new(int64(1))}} got, err := event.ParsePayload() if err != nil { t.Fatalf("ParsePayload returned unexpected error: %v", err) diff --git a/github/activity_notifications_test.go b/github/activity_notifications_test.go index ef91f0b4303..bb76987ea0e 100644 --- a/github/activity_notifications_test.go +++ b/github/activity_notifications_test.go @@ -42,7 +42,7 @@ func TestActivityService_ListNotification(t *testing.T) { t.Errorf("Activity.ListNotifications returned error: %v", err) } - want := []*Notification{{ID: Ptr("1"), Subject: &NotificationSubject{Title: Ptr("t")}}} + want := []*Notification{{ID: new("1"), Subject: &NotificationSubject{Title: new("t")}}} if !cmp.Equal(notifications, want) { t.Errorf("Activity.ListNotifications returned %+v, want %+v", notifications, want) } @@ -72,7 +72,7 @@ func TestActivityService_ListRepositoryNotifications(t *testing.T) { t.Errorf("Activity.ListRepositoryNotifications returned error: %v", err) } - want := []*Notification{{ID: Ptr("1")}} + want := []*Notification{{ID: new("1")}} if !cmp.Equal(notifications, want) { t.Errorf("Activity.ListRepositoryNotifications returned %+v, want %+v", notifications, want) } @@ -209,7 +209,7 @@ func TestActivityService_GetThread(t *testing.T) { t.Errorf("Activity.GetThread returned error: %v", err) } - want := &Notification{ID: Ptr("1")} + want := &Notification{ID: new("1")} if !cmp.Equal(notification, want) { t.Errorf("Activity.GetThread returned %+v, want %+v", notification, want) } @@ -296,7 +296,7 @@ func TestActivityService_GetThreadSubscription(t *testing.T) { t.Errorf("Activity.GetThreadSubscription returned error: %v", err) } - want := &Subscription{Subscribed: Ptr(true)} + want := &Subscription{Subscribed: new(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.GetThreadSubscription returned %+v, want %+v", sub, want) } @@ -320,7 +320,7 @@ func TestActivityService_SetThreadSubscription(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Subscription{Subscribed: Ptr(true)} + input := &Subscription{Subscribed: new(true)} mux.HandleFunc("/notifications/threads/1/subscription", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -334,7 +334,7 @@ func TestActivityService_SetThreadSubscription(t *testing.T) { t.Errorf("Activity.SetThreadSubscription returned error: %v", err) } - want := &Subscription{Ignored: Ptr(true)} + want := &Subscription{Ignored: new(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.SetThreadSubscription returned %+v, want %+v", sub, want) } diff --git a/github/activity_star_test.go b/github/activity_star_test.go index 6286a166772..e3ddab7aeb6 100644 --- a/github/activity_star_test.go +++ b/github/activity_star_test.go @@ -34,7 +34,7 @@ func TestActivityService_ListStargazers(t *testing.T) { t.Errorf("Activity.ListStargazers returned error: %v", err) } - want := []*Stargazer{{StarredAt: &referenceTimestamp, User: &User{ID: Ptr(int64(1))}}} + want := []*Stargazer{{StarredAt: &referenceTimestamp, User: &User{ID: new(int64(1))}}} if !cmp.Equal(stargazers, want) { t.Errorf("Activity.ListStargazers returned %+v, want %+v", stargazers, want) } @@ -70,7 +70,7 @@ func TestActivityService_ListStarred_authenticatedUser(t *testing.T) { t.Errorf("Activity.ListStarred returned error: %v", err) } - want := []*StarredRepository{{StarredAt: &referenceTimestamp, Repository: &Repository{ID: Ptr(int64(1))}}} + want := []*StarredRepository{{StarredAt: &referenceTimestamp, Repository: &Repository{ID: new(int64(1))}}} if !cmp.Equal(repos, want) { t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want) } @@ -112,7 +112,7 @@ func TestActivityService_ListStarred_specifiedUser(t *testing.T) { t.Errorf("Activity.ListStarred returned error: %v", err) } - want := []*StarredRepository{{StarredAt: &referenceTimestamp, Repository: &Repository{ID: Ptr(int64(2))}}} + want := []*StarredRepository{{StarredAt: &referenceTimestamp, Repository: &Repository{ID: new(int64(2))}}} if !cmp.Equal(repos, want) { t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want) } diff --git a/github/activity_test.go b/github/activity_test.go index dc0090591df..f6068fbea60 100644 --- a/github/activity_test.go +++ b/github/activity_test.go @@ -87,44 +87,44 @@ var feedsJSON = []byte(`{ }`) var wantFeeds = &Feeds{ - TimelineURL: Ptr("https://github.com/timeline"), - UserURL: Ptr("https://github.com/{user}"), - CurrentUserPublicURL: Ptr("https://github.com/defunkt"), - CurrentUserURL: Ptr("https://github.com/defunkt.private?token=abc123"), - CurrentUserActorURL: Ptr("https://github.com/defunkt.private.actor?token=abc123"), - CurrentUserOrganizationURL: Ptr(""), + TimelineURL: new("https://github.com/timeline"), + UserURL: new("https://github.com/{user}"), + CurrentUserPublicURL: new("https://github.com/defunkt"), + CurrentUserURL: new("https://github.com/defunkt.private?token=abc123"), + CurrentUserActorURL: new("https://github.com/defunkt.private.actor?token=abc123"), + CurrentUserOrganizationURL: new(""), CurrentUserOrganizationURLs: []string{ "https://github.com/organizations/github/defunkt.private.atom?token=abc123", }, Links: &FeedLinks{ Timeline: &FeedLink{ - HRef: Ptr("https://github.com/timeline"), - Type: Ptr("application/atom+xml"), + HRef: new("https://github.com/timeline"), + Type: new("application/atom+xml"), }, User: &FeedLink{ - HRef: Ptr("https://github.com/{user}"), - Type: Ptr("application/atom+xml"), + HRef: new("https://github.com/{user}"), + Type: new("application/atom+xml"), }, CurrentUserPublic: &FeedLink{ - HRef: Ptr("https://github.com/defunkt"), - Type: Ptr("application/atom+xml"), + HRef: new("https://github.com/defunkt"), + Type: new("application/atom+xml"), }, CurrentUser: &FeedLink{ - HRef: Ptr("https://github.com/defunkt.private?token=abc123"), - Type: Ptr("application/atom+xml"), + HRef: new("https://github.com/defunkt.private?token=abc123"), + Type: new("application/atom+xml"), }, CurrentUserActor: &FeedLink{ - HRef: Ptr("https://github.com/defunkt.private.actor?token=abc123"), - Type: Ptr("application/atom+xml"), + HRef: new("https://github.com/defunkt.private.actor?token=abc123"), + Type: new("application/atom+xml"), }, CurrentUserOrganization: &FeedLink{ - HRef: Ptr(""), - Type: Ptr(""), + HRef: new(""), + Type: new(""), }, CurrentUserOrganizations: []*FeedLink{ { - HRef: Ptr("https://github.com/organizations/github/defunkt.private.atom?token=abc123"), - Type: Ptr("application/atom+xml"), + HRef: new("https://github.com/organizations/github/defunkt.private.atom?token=abc123"), + Type: new("application/atom+xml"), }, }, }, diff --git a/github/activity_watching_test.go b/github/activity_watching_test.go index a5f0c5979e2..ebfee64cb55 100644 --- a/github/activity_watching_test.go +++ b/github/activity_watching_test.go @@ -32,7 +32,7 @@ func TestActivityService_ListWatchers(t *testing.T) { t.Errorf("Activity.ListWatchers returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(watchers, want) { t.Errorf("Activity.ListWatchers returned %+v, want %+v", watchers, want) } @@ -70,7 +70,7 @@ func TestActivityService_ListWatched_authenticatedUser(t *testing.T) { t.Errorf("Activity.ListWatched returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(watched, want) { t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want) } @@ -108,7 +108,7 @@ func TestActivityService_ListWatched_specifiedUser(t *testing.T) { t.Errorf("Activity.ListWatched returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(watched, want) { t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want) } @@ -129,7 +129,7 @@ func TestActivityService_GetRepositorySubscription_true(t *testing.T) { t.Errorf("Activity.GetRepositorySubscription returned error: %v", err) } - want := &Subscription{Subscribed: Ptr(true)} + want := &Subscription{Subscribed: new(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.GetRepositorySubscription returned %+v, want %+v", sub, want) } @@ -190,7 +190,7 @@ func TestActivityService_SetRepositorySubscription(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Subscription{Subscribed: Ptr(true)} + input := &Subscription{Subscribed: new(true)} mux.HandleFunc("/repos/o/r/subscription", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -204,7 +204,7 @@ func TestActivityService_SetRepositorySubscription(t *testing.T) { t.Errorf("Activity.SetRepositorySubscription returned error: %v", err) } - want := &Subscription{Ignored: Ptr(true)} + want := &Subscription{Ignored: new(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.SetRepositorySubscription returned %+v, want %+v", sub, want) } diff --git a/github/admin_orgs_test.go b/github/admin_orgs_test.go index 83ef0ba963f..b8485ae4910 100644 --- a/github/admin_orgs_test.go +++ b/github/admin_orgs_test.go @@ -18,7 +18,7 @@ func TestAdminService_CreateOrg(t *testing.T) { client, mux, _ := setup(t) input := &Organization{ - Login: Ptr("github"), + Login: new("github"), } mux.HandleFunc("/admin/organizations", func(w http.ResponseWriter, r *http.Request) { @@ -33,7 +33,7 @@ func TestAdminService_CreateOrg(t *testing.T) { t.Errorf("Admin.CreateOrg returned error: %v", err) } - want := &Organization{ID: Ptr(int64(1)), Login: Ptr("github")} + want := &Organization{ID: new(int64(1)), Login: new("github")} if !cmp.Equal(org, want) { t.Errorf("Admin.CreateOrg returned %+v, want %+v", org, want) } @@ -53,12 +53,12 @@ func TestAdminService_RenameOrg(t *testing.T) { client, mux, _ := setup(t) input := &Organization{ - Login: Ptr("o"), + Login: new("o"), } mux.HandleFunc("/admin/organizations/o", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - want := &renameOrgRequest{Login: Ptr("the-new-octocats")} + want := &renameOrgRequest{Login: new("the-new-octocats")} testJSONBody(t, r, want) fmt.Fprint(w, `{"message":"Job queued to rename organization. It may take a few minutes to complete.","url":"https:///api/v3/organizations/1"}`) }) @@ -69,7 +69,7 @@ func TestAdminService_RenameOrg(t *testing.T) { t.Errorf("Admin.RenameOrgByName returned error: %v", err) } - want := &RenameOrgResponse{Message: Ptr("Job queued to rename organization. It may take a few minutes to complete."), URL: Ptr("https:///api/v3/organizations/1")} + want := &RenameOrgResponse{Message: new("Job queued to rename organization. It may take a few minutes to complete."), URL: new("https:///api/v3/organizations/1")} if !cmp.Equal(resp, want) { t.Errorf("Admin.RenameOrgByName returned %+v, want %+v", resp, want) } @@ -99,7 +99,7 @@ func TestAdminService_RenameOrgByName(t *testing.T) { mux.HandleFunc("/admin/organizations/o", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - want := &renameOrgRequest{Login: Ptr("the-new-octocats")} + want := &renameOrgRequest{Login: new("the-new-octocats")} testJSONBody(t, r, want) fmt.Fprint(w, `{"message":"Job queued to rename organization. It may take a few minutes to complete.","url":"https:///api/v3/organizations/1"}`) }) @@ -110,7 +110,7 @@ func TestAdminService_RenameOrgByName(t *testing.T) { t.Errorf("Admin.RenameOrgByName returned error: %v", err) } - want := &RenameOrgResponse{Message: Ptr("Job queued to rename organization. It may take a few minutes to complete."), URL: Ptr("https:///api/v3/organizations/1")} + want := &RenameOrgResponse{Message: new("Job queued to rename organization. It may take a few minutes to complete."), URL: new("https:///api/v3/organizations/1")} if !cmp.Equal(resp, want) { t.Errorf("Admin.RenameOrgByName returned %+v, want %+v", resp, want) } diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 96c8e744cf2..4da04a94d80 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -160,57 +160,57 @@ func TestAdminService_Stringify(t *testing.T) { var testAdminStats = &AdminStats{ Repos: &RepoStats{ - TotalRepos: Ptr(212), - RootRepos: Ptr(194), - ForkRepos: Ptr(18), - OrgRepos: Ptr(51), - TotalPushes: Ptr(3082), - TotalWikis: Ptr(15), + TotalRepos: new(212), + RootRepos: new(194), + ForkRepos: new(18), + OrgRepos: new(51), + TotalPushes: new(3082), + TotalWikis: new(15), }, Hooks: &HookStats{ - TotalHooks: Ptr(27), - ActiveHooks: Ptr(23), - InactiveHooks: Ptr(4), + TotalHooks: new(27), + ActiveHooks: new(23), + InactiveHooks: new(4), }, Pages: &PageStats{ - TotalPages: Ptr(36), + TotalPages: new(36), }, Orgs: &OrgStats{ - TotalOrgs: Ptr(33), - DisabledOrgs: Ptr(0), - TotalTeams: Ptr(60), - TotalTeamMembers: Ptr(314), + TotalOrgs: new(33), + DisabledOrgs: new(0), + TotalTeams: new(60), + TotalTeamMembers: new(314), }, Users: &UserStats{ - TotalUsers: Ptr(254), - AdminUsers: Ptr(45), - SuspendedUsers: Ptr(21), + TotalUsers: new(254), + AdminUsers: new(45), + SuspendedUsers: new(21), }, Pulls: &PullStats{ - TotalPulls: Ptr(86), - MergedPulls: Ptr(60), - MergeablePulls: Ptr(21), - UnmergeablePulls: Ptr(3), + TotalPulls: new(86), + MergedPulls: new(60), + MergeablePulls: new(21), + UnmergeablePulls: new(3), }, Issues: &IssueStats{ - TotalIssues: Ptr(179), - OpenIssues: Ptr(83), - ClosedIssues: Ptr(96), + TotalIssues: new(179), + OpenIssues: new(83), + ClosedIssues: new(96), }, Milestones: &MilestoneStats{ - TotalMilestones: Ptr(7), - OpenMilestones: Ptr(6), - ClosedMilestones: Ptr(1), + TotalMilestones: new(7), + OpenMilestones: new(6), + ClosedMilestones: new(1), }, Gists: &GistStats{ - TotalGists: Ptr(178), - PrivateGists: Ptr(151), - PublicGists: Ptr(25), + TotalGists: new(178), + PrivateGists: new(151), + PublicGists: new(25), }, Comments: &CommentStats{ - TotalCommitComments: Ptr(6), - TotalGistComments: Ptr(28), - TotalIssueComments: Ptr(366), - TotalPullRequestComments: Ptr(30), + TotalCommitComments: new(6), + TotalGistComments: new(28), + TotalIssueComments: new(366), + TotalPullRequestComments: new(30), }, } diff --git a/github/admin_test.go b/github/admin_test.go index ca4fd3e4d56..c56c1c76ce3 100644 --- a/github/admin_test.go +++ b/github/admin_test.go @@ -34,8 +34,8 @@ func TestAdminService_UpdateUserLDAPMapping(t *testing.T) { } want := &UserLDAPMapping{ - ID: Ptr(int64(1)), - LDAPDN: Ptr("uid=asdf,ou=users,dc=github,dc=com"), + ID: new(int64(1)), + LDAPDN: new("uid=asdf,ou=users,dc=github,dc=com"), } if !cmp.Equal(mapping, want) { t.Errorf("Admin.UpdateUserLDAPMapping returned %+v, want %+v", mapping, want) @@ -77,8 +77,8 @@ func TestAdminService_UpdateTeamLDAPMapping(t *testing.T) { } want := &TeamLDAPMapping{ - ID: Ptr(int64(1)), - LDAPDN: Ptr("cn=Enterprise Ops,ou=teams,dc=github,dc=com"), + ID: new(int64(1)), + LDAPDN: new("cn=Enterprise Ops,ou=teams,dc=github,dc=com"), } if !cmp.Equal(mapping, want) { t.Errorf("Admin.UpdateTeamLDAPMapping returned %+v, want %+v", mapping, want) @@ -102,16 +102,16 @@ func TestAdminService_UpdateTeamLDAPMapping(t *testing.T) { func TestAdminService_TeamLDAPMapping_String(t *testing.T) { t.Parallel() v := &TeamLDAPMapping{ - ID: Ptr(int64(1)), - LDAPDN: Ptr("a"), - URL: Ptr("b"), - Name: Ptr("c"), - Slug: Ptr("d"), - Description: Ptr("e"), - Privacy: Ptr("f"), - Permission: Ptr("g"), - MembersURL: Ptr("h"), - RepositoriesURL: Ptr("i"), + ID: new(int64(1)), + LDAPDN: new("a"), + URL: new("b"), + Name: new("c"), + Slug: new("d"), + Description: new("e"), + Privacy: new("f"), + Permission: new("g"), + MembersURL: new("h"), + RepositoriesURL: new("i"), } want := `github.TeamLDAPMapping{ID:1, LDAPDN:"a", URL:"b", Name:"c", Slug:"d", Description:"e", Privacy:"f", Permission:"g", MembersURL:"h", RepositoriesURL:"i"}` @@ -123,23 +123,23 @@ func TestAdminService_TeamLDAPMapping_String(t *testing.T) { func TestAdminService_UserLDAPMapping_String(t *testing.T) { t.Parallel() v := &UserLDAPMapping{ - ID: Ptr(int64(1)), - LDAPDN: Ptr("a"), - Login: Ptr("b"), - AvatarURL: Ptr("c"), - GravatarID: Ptr("d"), - Type: Ptr("e"), - SiteAdmin: Ptr(true), - URL: Ptr("f"), - EventsURL: Ptr("g"), - FollowingURL: Ptr("h"), - FollowersURL: Ptr("i"), - GistsURL: Ptr("j"), - OrganizationsURL: Ptr("k"), - ReceivedEventsURL: Ptr("l"), - ReposURL: Ptr("m"), - StarredURL: Ptr("n"), - SubscriptionsURL: Ptr("o"), + ID: new(int64(1)), + LDAPDN: new("a"), + Login: new("b"), + AvatarURL: new("c"), + GravatarID: new("d"), + Type: new("e"), + SiteAdmin: new(true), + URL: new("f"), + EventsURL: new("g"), + FollowingURL: new("h"), + FollowersURL: new("i"), + GistsURL: new("j"), + OrganizationsURL: new("k"), + ReceivedEventsURL: new("l"), + ReposURL: new("m"), + StarredURL: new("n"), + SubscriptionsURL: new("o"), } want := `github.UserLDAPMapping{ID:1, LDAPDN:"a", Login:"b", AvatarURL:"c", GravatarID:"d", Type:"e", SiteAdmin:true, URL:"f", EventsURL:"g", FollowingURL:"h", FollowersURL:"i", GistsURL:"j", OrganizationsURL:"k", ReceivedEventsURL:"l", ReposURL:"m", StarredURL:"n", SubscriptionsURL:"o"}` diff --git a/github/admin_users_test.go b/github/admin_users_test.go index 5a0ed0536f5..325cf4fa0ab 100644 --- a/github/admin_users_test.go +++ b/github/admin_users_test.go @@ -17,7 +17,7 @@ func TestAdminUsers_Create(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := CreateUserRequest{Login: "github", Email: Ptr("email@example.com"), Suspended: Ptr(false)} + input := CreateUserRequest{Login: "github", Email: new("email@example.com"), Suspended: new(false)} mux.HandleFunc("/admin/users", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -31,7 +31,7 @@ func TestAdminUsers_Create(t *testing.T) { t.Errorf("Admin.CreateUser returned error: %v", err) } - want := &User{ID: Ptr(int64(1)), Login: Ptr("github")} + want := &User{ID: new(int64(1)), Login: new("github")} if !cmp.Equal(org, want) { t.Errorf("Admin.CreateUser returned %+v, want %+v", org, want) } @@ -107,16 +107,16 @@ func TestUserImpersonation_Create(t *testing.T) { } want := &UserAuthorization{ - ID: Ptr(int64(1234)), - URL: Ptr("https://example.com/authorizations"), + ID: new(int64(1234)), + URL: new("https://example.com/authorizations"), App: &OAuthAPP{ - Name: Ptr("GitHub Site Administrator"), - URL: Ptr("https://docs.github.com/en/rest/enterprise/users/"), - ClientID: Ptr("1234"), + Name: new("GitHub Site Administrator"), + URL: new("https://docs.github.com/en/rest/enterprise/users/"), + ClientID: new("1234"), }, - Token: Ptr("1234"), - HashedToken: Ptr("1234"), - TokenLastEight: Ptr("1234"), + Token: new("1234"), + HashedToken: new("1234"), + TokenLastEight: new("1234"), Note: nil, NoteURL: nil, CreatedAt: refTimestamp(1136178000), diff --git a/github/agent_tasks_test.go b/github/agent_tasks_test.go index b5ecce27687..9b451c883b3 100644 --- a/github/agent_tasks_test.go +++ b/github/agent_tasks_test.go @@ -89,23 +89,23 @@ func agentTaskWithSessionsJSON() string { func agentTask() *AgentTask { return &AgentTask{ ID: "a1b2c3d4-e5f6-7890-abcd-ef1234567890", - URL: Ptr("https://api.github.com/agents/repos/octocat/hello-world/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890"), - HTMLURL: Ptr("https://github.com/octocat/hello-world/copilot/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890"), - Name: Ptr("Fix the login button on the homepage"), - Creator: &AgentTaskCreator{ID: Ptr(int64(1))}, - CreatorType: Ptr("user"), + URL: new("https://api.github.com/agents/repos/octocat/hello-world/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890"), + HTMLURL: new("https://github.com/octocat/hello-world/copilot/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890"), + Name: new("Fix the login button on the homepage"), + Creator: &AgentTaskCreator{ID: new(int64(1))}, + CreatorType: new("user"), UserCollaborators: []*User{ - {ID: Ptr(int64(3))}, + {ID: new(int64(3))}, }, - Owner: &AgentTaskOwner{ID: Ptr(int64(2))}, - Repository: &AgentTaskRepository{ID: Ptr(int64(1296269))}, + Owner: &AgentTaskOwner{ID: new(int64(2))}, + Repository: &AgentTaskRepository{ID: new(int64(1296269))}, State: "completed", - SessionCount: Ptr(1), + SessionCount: new(1), Artifacts: []*AgentTaskArtifact{ { Provider: "github", Type: "pull", - Data: &AgentTaskArtifactData{ID: Ptr(int64(42))}, + Data: &AgentTaskArtifactData{ID: new(int64(42))}, }, }, CreatedAt: Timestamp{time.Date(2025, time.March, 14, 0, 0, 0, 0, time.UTC)}, @@ -120,17 +120,17 @@ func agentTaskWithSessions() *AgentTask { task.Sessions = []*AgentTaskSession{ { ID: "s1a2b3c4-d5e6-7890-abcd-ef1234567890", - Name: Ptr("Fix the login button on the homepage"), - User: &User{ID: Ptr(int64(1))}, - Owner: &AgentTaskOwner{ID: Ptr(int64(2))}, - Repository: &AgentTaskRepository{ID: Ptr(int64(1296269))}, - TaskID: Ptr("a1b2c3d4-e5f6-7890-abcd-ef1234567890"), + Name: new("Fix the login button on the homepage"), + User: &User{ID: new(int64(1))}, + Owner: &AgentTaskOwner{ID: new(int64(2))}, + Repository: &AgentTaskRepository{ID: new(int64(1296269))}, + TaskID: new("a1b2c3d4-e5f6-7890-abcd-ef1234567890"), State: "failed", - Prompt: Ptr("Fix the login button on the homepage"), - HeadRef: Ptr("copilot/fix-1"), - BaseRef: Ptr("main"), - Model: Ptr("claude-sonnet-4.6"), - Error: &AgentTaskSessionError{Message: Ptr("agent task failed")}, + Prompt: new("Fix the login button on the homepage"), + HeadRef: new("copilot/fix-1"), + BaseRef: new("main"), + Model: new("claude-sonnet-4.6"), + Error: &AgentTaskSessionError{Message: new("agent task failed")}, CreatedAt: Timestamp{time.Date(2025, time.March, 14, 0, 0, 0, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2025, time.March, 14, 1, 0, 0, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2025, time.March, 14, 1, 0, 0, 0, time.UTC)}, @@ -166,7 +166,7 @@ func TestAgentTasksService_ListByRepo(t *testing.T) { Direction: "asc", State: "queued,completed", IsArchived: true, - Since: Ptr(time.Date(2025, time.March, 14, 0, 0, 0, 0, time.UTC)), + Since: new(time.Date(2025, time.March, 14, 0, 0, 0, 0, time.UTC)), ListOptions: ListOptions{Page: 2, PerPage: 1}, }, CreatorID: []int64{1, 2}, @@ -180,8 +180,8 @@ func TestAgentTasksService_ListByRepo(t *testing.T) { want := &AgentTaskList{ Tasks: []*AgentTask{agentTask()}, - TotalActiveCount: Ptr(5), - TotalArchivedCount: Ptr(2), + TotalActiveCount: new(5), + TotalArchivedCount: new(2), } if diff := cmp.Diff(want, tasks); diff != "" { t.Errorf("AgentTasks.ListByRepo mismatch (-want +got):\n%v", diff) @@ -211,10 +211,10 @@ func TestAgentTasksService_Create(t *testing.T) { input := CreateAgentTaskRequest{ Prompt: "Fix the login button on the homepage", - Model: Ptr("gpt-5.3-codex"), - CreatePullRequest: Ptr(true), - HeadRef: Ptr("copilot/fix-1"), - BaseRef: Ptr("main"), + Model: new("gpt-5.3-codex"), + CreatePullRequest: new(true), + HeadRef: new("copilot/fix-1"), + BaseRef: new("main"), } mux.HandleFunc("/agents/repos/o/r/tasks", func(w http.ResponseWriter, r *http.Request) { @@ -307,7 +307,7 @@ func TestAgentTasksService_List(t *testing.T) { Direction: "desc", State: "completed", IsArchived: true, - Since: Ptr(time.Date(2025, time.March, 14, 0, 0, 0, 0, time.UTC)), + Since: new(time.Date(2025, time.March, 14, 0, 0, 0, 0, time.UTC)), ListOptions: ListOptions{Page: 2, PerPage: 1}, } @@ -319,8 +319,8 @@ func TestAgentTasksService_List(t *testing.T) { want := &AgentTaskList{ Tasks: []*AgentTask{agentTask()}, - TotalActiveCount: Ptr(5), - TotalArchivedCount: Ptr(2), + TotalActiveCount: new(5), + TotalArchivedCount: new(2), } if diff := cmp.Diff(want, tasks); diff != "" { t.Errorf("AgentTasks.List mismatch (-want +got):\n%v", diff) diff --git a/github/apps_hooks_deliveries_test.go b/github/apps_hooks_deliveries_test.go index 483611544ec..ac814a6b4c7 100644 --- a/github/apps_hooks_deliveries_test.go +++ b/github/apps_hooks_deliveries_test.go @@ -32,7 +32,7 @@ func TestAppsService_ListHookDeliveries(t *testing.T) { t.Errorf("Apps.ListHookDeliveries returned error: %v", err) } - want := []*HookDelivery{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*HookDelivery{{ID: new(int64(1))}, {ID: new(int64(2))}} if d := cmp.Diff(deliveries, want); d != "" { t.Errorf("Apps.ListHooks want (-), got (+):\n%v", d) } @@ -62,7 +62,7 @@ func TestAppsService_GetHookDelivery(t *testing.T) { t.Errorf("Apps.GetHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Ptr(int64(1))} + want := &HookDelivery{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Apps.GetHookDelivery returned %+v, want %+v", hook, want) } @@ -97,7 +97,7 @@ func TestAppsService_RedeliverHookDelivery(t *testing.T) { t.Errorf("Apps.RedeliverHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Ptr(int64(1))} + want := &HookDelivery{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Apps.RedeliverHookDelivery returned %+v, want %+v", hook, want) } diff --git a/github/apps_hooks_test.go b/github/apps_hooks_test.go index 4ca7ded24d4..6d26299c744 100644 --- a/github/apps_hooks_test.go +++ b/github/apps_hooks_test.go @@ -34,10 +34,10 @@ func TestAppsService_GetHookConfig(t *testing.T) { } want := &HookConfig{ - ContentType: Ptr("json"), - InsecureSSL: Ptr("0"), - Secret: Ptr("********"), - URL: Ptr("https://example.com/webhook"), + ContentType: new("json"), + InsecureSSL: new("0"), + Secret: new("********"), + URL: new("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Apps.GetHookConfig returned %+v, want %+v", config, want) @@ -58,10 +58,10 @@ func TestAppsService_UpdateHookConfig(t *testing.T) { client, mux, _ := setup(t) input := HookConfig{ - ContentType: Ptr("json"), - InsecureSSL: Ptr("1"), - Secret: Ptr("s"), - URL: Ptr("u"), + ContentType: new("json"), + InsecureSSL: new("1"), + Secret: new("s"), + URL: new("u"), } mux.HandleFunc("/app/hook/config", func(w http.ResponseWriter, r *http.Request) { @@ -82,10 +82,10 @@ func TestAppsService_UpdateHookConfig(t *testing.T) { } want := &HookConfig{ - ContentType: Ptr("json"), - InsecureSSL: Ptr("1"), - Secret: Ptr("********"), - URL: Ptr("u"), + ContentType: new("json"), + InsecureSSL: new("1"), + Secret: new("********"), + URL: new("u"), } if !cmp.Equal(config, want) { t.Errorf("Apps.UpdateHookConfig returned %+v, want %+v", config, want) diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go index f8e833b1f23..5e63dd691c4 100644 --- a/github/apps_installation_test.go +++ b/github/apps_installation_test.go @@ -33,7 +33,7 @@ func TestAppsService_ListRepos(t *testing.T) { t.Errorf("Apps.ListRepos returned error: %v", err) } - want := &ListRepositories{TotalCount: Ptr(1), Repositories: []*Repository{{ID: Ptr(int64(1))}}} + want := &ListRepositories{TotalCount: new(1), Repositories: []*Repository{{ID: new(int64(1))}}} if !cmp.Equal(repositories, want) { t.Errorf("Apps.ListRepos returned %+v, want %+v", repositories, want) } @@ -68,7 +68,7 @@ func TestAppsService_ListUserRepos(t *testing.T) { t.Errorf("Apps.ListUserRepos returned error: %v", err) } - want := &ListRepositories{TotalCount: Ptr(1), Repositories: []*Repository{{ID: Ptr(int64(1))}}} + want := &ListRepositories{TotalCount: new(1), Repositories: []*Repository{{ID: new(int64(1))}}} if !cmp.Equal(repositories, want) { t.Errorf("Apps.ListUserRepos returned %+v, want %+v", repositories, want) } @@ -103,7 +103,7 @@ func TestAppsService_AddRepository(t *testing.T) { t.Errorf("Apps.AddRepository returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), Owner: &User{Login: Ptr("l")}, License: &License{Key: Ptr("mit")}} + want := &Repository{ID: new(int64(1)), Name: new("n"), Description: new("d"), Owner: &User{Login: new("l")}, License: &License{Key: new("mit")}} if !cmp.Equal(repo, want) { t.Errorf("AddRepository returned %+v, want %+v", repo, want) } diff --git a/github/apps_manifest_test.go b/github/apps_manifest_test.go index 799bb2eb494..8f2bd77d9a1 100644 --- a/github/apps_manifest_test.go +++ b/github/apps_manifest_test.go @@ -40,11 +40,11 @@ func TestAppsService_CompleteAppManifest(t *testing.T) { } want := &AppConfig{ - ID: Ptr(int64(1)), - ClientID: Ptr("a"), - ClientSecret: Ptr("b"), - WebhookSecret: Ptr("c"), - PEM: Ptr("key"), + ID: new(int64(1)), + ClientID: new("a"), + ClientSecret: new("b"), + WebhookSecret: new("c"), + PEM: new("key"), } if !cmp.Equal(cfg, want) { diff --git a/github/apps_marketplace_test.go b/github/apps_marketplace_test.go index 8363f725dbb..c79a636736e 100644 --- a/github/apps_marketplace_test.go +++ b/github/apps_marketplace_test.go @@ -34,7 +34,7 @@ func TestMarketplaceService_ListPlans(t *testing.T) { t.Errorf("Marketplace.ListPlans returned error: %v", err) } - want := []*MarketplacePlan{{ID: Ptr(int64(1))}} + want := []*MarketplacePlan{{ID: new(int64(1))}} if !cmp.Equal(plans, want) { t.Errorf("Marketplace.ListPlans returned %+v, want %+v", plans, want) } @@ -66,7 +66,7 @@ func TestMarketplaceService_Stubbed_ListPlans(t *testing.T) { t.Errorf("Marketplace.ListPlans (Stubbed) returned error: %v", err) } - want := []*MarketplacePlan{{ID: Ptr(int64(1))}} + want := []*MarketplacePlan{{ID: new(int64(1))}} if !cmp.Equal(plans, want) { t.Errorf("Marketplace.ListPlans (Stubbed) returned %+v, want %+v", plans, want) } @@ -89,7 +89,7 @@ func TestMarketplaceService_ListPlanAccountsForPlan(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForPlan returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Ptr(int64(1))}} + want := []*MarketplacePlanAccount{{ID: new(int64(1))}} if !cmp.Equal(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForPlan returned %+v, want %+v", accounts, want) } @@ -121,7 +121,7 @@ func TestMarketplaceService_Stubbed_ListPlanAccountsForPlan(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForPlan (Stubbed) returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Ptr(int64(1))}} + want := []*MarketplacePlanAccount{{ID: new(int64(1))}} if !cmp.Equal(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForPlan (Stubbed) returned %+v, want %+v", accounts, want) } @@ -143,7 +143,7 @@ func TestMarketplaceService_GetPlanAccountForAccount(t *testing.T) { t.Errorf("Marketplace.GetPlanAccountForAccount returned error: %v", err) } - want := &MarketplacePlanAccount{ID: Ptr(int64(1)), MarketplacePendingChange: &MarketplacePendingChange{ID: Ptr(int64(77))}} + want := &MarketplacePlanAccount{ID: new(int64(1)), MarketplacePendingChange: &MarketplacePendingChange{ID: new(int64(77))}} if !cmp.Equal(account, want) { t.Errorf("Marketplace.GetPlanAccountForAccount returned %+v, want %+v", account, want) } @@ -174,7 +174,7 @@ func TestMarketplaceService_Stubbed_GetPlanAccountForAccount(t *testing.T) { t.Errorf("Marketplace.GetPlanAccountForAccount (Stubbed) returned error: %v", err) } - want := &MarketplacePlanAccount{ID: Ptr(int64(1))} + want := &MarketplacePlanAccount{ID: new(int64(1))} if !cmp.Equal(account, want) { t.Errorf("Marketplace.GetPlanAccountForAccount (Stubbed) returned %+v, want %+v", account, want) } @@ -197,7 +197,7 @@ func TestMarketplaceService_ListMarketplacePurchasesForUser(t *testing.T) { t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned error: %v", err) } - want := []*MarketplacePurchase{{BillingCycle: Ptr("monthly")}} + want := []*MarketplacePurchase{{BillingCycle: new("monthly")}} if !cmp.Equal(purchases, want) { t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned %+v, want %+v", purchases, want) } @@ -229,7 +229,7 @@ func TestMarketplaceService_Stubbed_ListMarketplacePurchasesForUser(t *testing.T t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned error: %v", err) } - want := []*MarketplacePurchase{{BillingCycle: Ptr("monthly")}} + want := []*MarketplacePurchase{{BillingCycle: new("monthly")}} if !cmp.Equal(purchases, want) { t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned %+v, want %+v", purchases, want) } diff --git a/github/apps_test.go b/github/apps_test.go index d936a4f3aac..1c1e00b3f71 100644 --- a/github/apps_test.go +++ b/github/apps_test.go @@ -28,7 +28,7 @@ func TestAppsService_Get_authenticatedApp(t *testing.T) { t.Errorf("Apps.Get returned error: %v", err) } - want := &App{ID: Ptr(int64(1))} + want := &App{ID: new(int64(1))} if !cmp.Equal(app, want) { t.Errorf("Apps.Get returned %+v, want %+v", app, want) } @@ -63,7 +63,7 @@ func TestAppsService_Get_specifiedApp(t *testing.T) { t.Errorf("Apps.Get returned error: %v", err) } - want := &App{HTMLURL: Ptr("https://github.com/apps/a")} + want := &App{HTMLURL: new("https://github.com/apps/a")} if !cmp.Equal(app, want) { t.Errorf("Apps.Get returned %+v, want %+v", *app.HTMLURL, *want.HTMLURL) } @@ -96,9 +96,9 @@ func TestAppsService_ListInstallationRequests(t *testing.T) { } want := []*InstallationRequest{{ - ID: Ptr(int64(1)), - Account: &User{ID: Ptr(int64(2))}, - Requester: &User{ID: Ptr(int64(3))}, + ID: new(int64(1)), + Account: &User{ID: new(int64(2))}, + Requester: &User{ID: new(int64(3))}, CreatedAt: &referenceTimestamp, }} if !cmp.Equal(installationRequests, want) { @@ -187,49 +187,49 @@ func TestAppsService_ListInstallations(t *testing.T) { } want := []*Installation{{ - ID: Ptr(int64(1)), - AppID: Ptr(int64(1)), - TargetID: Ptr(int64(1)), - TargetType: Ptr("Organization"), - SingleFileName: Ptr("config.yml"), - RepositorySelection: Ptr("selected"), + ID: new(int64(1)), + AppID: new(int64(1)), + TargetID: new(int64(1)), + TargetType: new("Organization"), + SingleFileName: new("config.yml"), + RepositorySelection: new("selected"), Permissions: &InstallationPermissions{ - Actions: Ptr("read"), - Administration: Ptr("read"), - Checks: Ptr("read"), - Contents: Ptr("read"), - ContentReferences: Ptr("read"), - Deployments: Ptr("read"), - Environments: Ptr("read"), - Issues: Ptr("write"), - Metadata: Ptr("read"), - Members: Ptr("read"), - OrganizationAdministration: Ptr("write"), - OrganizationCustomRoles: Ptr("write"), - OrganizationHooks: Ptr("write"), - OrganizationPackages: Ptr("write"), - OrganizationPersonalAccessTokens: Ptr("read"), - OrganizationPersonalAccessTokenRequests: Ptr("read"), - OrganizationPlan: Ptr("read"), - OrganizationPreReceiveHooks: Ptr("write"), - OrganizationProjects: Ptr("read"), - OrganizationSecrets: Ptr("read"), - OrganizationSelfHostedRunners: Ptr("read"), - OrganizationUserBlocking: Ptr("write"), - Packages: Ptr("read"), - Pages: Ptr("read"), - PullRequests: Ptr("write"), - RepositoryHooks: Ptr("write"), - RepositoryProjects: Ptr("read"), - RepositoryPreReceiveHooks: Ptr("read"), - Secrets: Ptr("read"), - SecretScanningAlerts: Ptr("read"), - SecurityEvents: Ptr("read"), - SingleFile: Ptr("write"), - Statuses: Ptr("write"), - TeamDiscussions: Ptr("read"), - VulnerabilityAlerts: Ptr("read"), - Workflows: Ptr("write"), + Actions: new("read"), + Administration: new("read"), + Checks: new("read"), + Contents: new("read"), + ContentReferences: new("read"), + Deployments: new("read"), + Environments: new("read"), + Issues: new("write"), + Metadata: new("read"), + Members: new("read"), + OrganizationAdministration: new("write"), + OrganizationCustomRoles: new("write"), + OrganizationHooks: new("write"), + OrganizationPackages: new("write"), + OrganizationPersonalAccessTokens: new("read"), + OrganizationPersonalAccessTokenRequests: new("read"), + OrganizationPlan: new("read"), + OrganizationPreReceiveHooks: new("write"), + OrganizationProjects: new("read"), + OrganizationSecrets: new("read"), + OrganizationSelfHostedRunners: new("read"), + OrganizationUserBlocking: new("write"), + Packages: new("read"), + Pages: new("read"), + PullRequests: new("write"), + RepositoryHooks: new("write"), + RepositoryProjects: new("read"), + RepositoryPreReceiveHooks: new("read"), + Secrets: new("read"), + SecretScanningAlerts: new("read"), + SecurityEvents: new("read"), + SingleFile: new("write"), + Statuses: new("write"), + TeamDiscussions: new("read"), + VulnerabilityAlerts: new("read"), + Workflows: new("write"), }, Events: []string{"push", "pull_request"}, CreatedAt: refTimestamp(1136178000), @@ -264,7 +264,7 @@ func TestAppsService_GetInstallation(t *testing.T) { t.Errorf("Apps.GetInstallation returned error: %v", err) } - want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} + want := &Installation{ID: new(int64(1)), AppID: new(int64(1)), TargetID: new(int64(1)), TargetType: new("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.GetInstallation returned %+v, want %+v", installation, want) } @@ -304,7 +304,7 @@ func TestAppsService_ListUserInstallations(t *testing.T) { t.Errorf("Apps.ListUserInstallations returned error: %v", err) } - want := []*Installation{{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")}} + want := []*Installation{{ID: new(int64(1)), AppID: new(int64(1)), TargetID: new(int64(1)), TargetType: new("Organization")}} if !cmp.Equal(installations, want) { t.Errorf("Apps.ListUserInstallations returned %+v, want %+v", installations, want) } @@ -412,7 +412,7 @@ func TestAppsService_CreateInstallationToken(t *testing.T) { t.Errorf("Apps.CreateInstallationToken returned error: %v", err) } - want := &InstallationToken{Token: Ptr("t")} + want := &InstallationToken{Token: new("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationToken returned %+v, want %+v", token, want) } @@ -440,8 +440,8 @@ func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) { RepositoryIDs: []int64{1234}, Repositories: []string{"foo"}, Permissions: &InstallationPermissions{ - Contents: Ptr("write"), - Issues: Ptr("read"), + Contents: new("write"), + Issues: new("read"), }, } @@ -457,7 +457,7 @@ func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) { t.Errorf("Apps.CreateInstallationToken returned error: %v", err) } - want := &InstallationToken{Token: Ptr("t")} + want := &InstallationToken{Token: new("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationToken returned %+v, want %+v", token, want) } @@ -470,8 +470,8 @@ func TestAppsService_CreateInstallationTokenListReposWithOptions(t *testing.T) { installationTokenListRepoOptions := &InstallationTokenListRepoOptions{ Repositories: []string{"foo"}, Permissions: &InstallationPermissions{ - Contents: Ptr("write"), - Issues: Ptr("read"), + Contents: new("write"), + Issues: new("read"), }, } @@ -487,7 +487,7 @@ func TestAppsService_CreateInstallationTokenListReposWithOptions(t *testing.T) { t.Errorf("Apps.CreateInstallationTokenListRepos returned error: %v", err) } - want := &InstallationToken{Token: Ptr("t")} + want := &InstallationToken{Token: new("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationTokenListRepos returned %+v, want %+v", token, want) } @@ -508,7 +508,7 @@ func TestAppsService_CreateInstallationTokenListReposWithNoOptions(t *testing.T) t.Errorf("Apps.CreateInstallationTokenListRepos returned error: %v", err) } - want := &InstallationToken{Token: Ptr("t")} + want := &InstallationToken{Token: new("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationTokenListRepos returned %+v, want %+v", token, want) } @@ -546,7 +546,7 @@ func TestAppsService_CreateAttachment(t *testing.T) { t.Errorf("CreateAttachment returned error: %v", err) } - want := &Attachment{ID: Ptr(int64(1)), Title: Ptr("title1"), Body: Ptr("body1")} + want := &Attachment{ID: new(int64(1)), Title: new("title1"), Body: new("body1")} if !cmp.Equal(got, want) { t.Errorf("CreateAttachment = %+v, want %+v", got, want) } @@ -581,7 +581,7 @@ func TestAppsService_GetOrganizationInstallation(t *testing.T) { t.Errorf("Apps.GetOrganizationInstallation returned error: %v", err) } - want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} + want := &Installation{ID: new(int64(1)), AppID: new(int64(1)), TargetID: new(int64(1)), TargetType: new("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.GetOrganizationInstallation returned %+v, want %+v", installation, want) } @@ -616,7 +616,7 @@ func TestAppsService_GetEnterpriseInstallation(t *testing.T) { t.Errorf("Apps.GetEnterpriseInstallation returned error: %v", err) } - want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Enterprise")} + want := &Installation{ID: new(int64(1)), AppID: new(int64(1)), TargetID: new(int64(1)), TargetType: new("Enterprise")} if !cmp.Equal(installation, want) { t.Errorf("Apps.GetEnterpriseInstallation returned %+v, want %+v", installation, want) } @@ -651,7 +651,7 @@ func TestAppsService_GetRepositoryInstallation(t *testing.T) { t.Errorf("Apps.GetRepositoryInstallation returned error: %v", err) } - want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} + want := &Installation{ID: new(int64(1)), AppID: new(int64(1)), TargetID: new(int64(1)), TargetType: new("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.GetRepositoryInstallation returned %+v, want %+v", installation, want) } @@ -686,7 +686,7 @@ func TestAppsService_GetRepositoryInstallationByID(t *testing.T) { t.Errorf("Apps.GetRepositoryInstallationByID returned error: %v", err) } - want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} + want := &Installation{ID: new(int64(1)), AppID: new(int64(1)), TargetID: new(int64(1)), TargetType: new("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.GetRepositoryInstallationByID returned %+v, want %+v", installation, want) } @@ -721,7 +721,7 @@ func TestAppsService_GetUserInstallation(t *testing.T) { t.Errorf("Apps.GetUserInstallation returned error: %v", err) } - want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("User")} + want := &Installation{ID: new(int64(1)), AppID: new(int64(1)), TargetID: new(int64(1)), TargetType: new("User")} if !cmp.Equal(installation, want) { t.Errorf("Apps.GetUserInstallation returned %+v, want %+v", installation, want) } diff --git a/github/authorizations_test.go b/github/authorizations_test.go index d1867728655..f7dce7ea7f1 100644 --- a/github/authorizations_test.go +++ b/github/authorizations_test.go @@ -34,7 +34,7 @@ func TestAuthorizationsService_Check(t *testing.T) { t.Errorf("Authorizations.Check returned error: %v", err) } - want := &Authorization{ID: Ptr(int64(1))} + want := &Authorization{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Authorizations.Check returned auth %+v, want %+v", got, want) } @@ -75,7 +75,7 @@ func TestAuthorizationsService_Reset(t *testing.T) { t.Errorf("Authorizations.Reset returned error: %v", err) } - want := &Authorization{ID: Ptr(int64(1))} + want := &Authorization{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Authorizations.Reset returned auth %+v, want %+v", got, want) } @@ -176,7 +176,7 @@ func TestAuthorizationsService_CreateImpersonation(t *testing.T) { t.Errorf("Authorizations.CreateImpersonation returned error: %+v", err) } - want := &Authorization{ID: Ptr(int64(1))} + want := &Authorization{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Authorizations.CreateImpersonation returned %+v, want %+v", *got.ID, *want.ID) } diff --git a/github/billing_test.go b/github/billing_test.go index fc6c48fbd1c..fca1522f192 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -259,10 +259,10 @@ func TestBillingService_GetOrganizationAdvancedSecurityActiveCommitters(t *testi } want := &ActiveCommitters{ - TotalAdvancedSecurityCommitters: Ptr(2), - TotalCount: Ptr(2), - MaximumAdvancedSecurityCommitters: Ptr(3), - PurchasedAdvancedSecurityCommitters: Ptr(4), + TotalAdvancedSecurityCommitters: new(2), + TotalCount: new(2), + MaximumAdvancedSecurityCommitters: new(3), + PurchasedAdvancedSecurityCommitters: new(4), Repositories: []*RepositoryActiveCommitters{ { Name: "octocat-org/Hello-World", @@ -336,8 +336,8 @@ func TestBillingService_GetOrganizationUsageReport(t *testing.T) { ctx := t.Context() opts := &UsageReportOptions{ - Year: Ptr(2023), - Month: Ptr(8), + Year: new(2023), + Month: new(8), } report, _, err := client.Billing.GetOrganizationUsageReport(ctx, "o", opts) if err != nil { @@ -356,8 +356,8 @@ func TestBillingService_GetOrganizationUsageReport(t *testing.T) { GrossAmount: 0.8, DiscountAmount: 0.0, NetAmount: 0.8, - OrganizationName: Ptr("GitHub"), - RepositoryName: Ptr("github/example"), + OrganizationName: new("GitHub"), + RepositoryName: new("github/example"), }, }, } @@ -418,7 +418,7 @@ func TestBillingService_GetUsageReport(t *testing.T) { ctx := t.Context() opts := &UsageReportOptions{ - Day: Ptr(15), + Day: new(15), } report, _, err := client.Billing.GetUsageReport(ctx, "u", opts) if err != nil { @@ -437,7 +437,7 @@ func TestBillingService_GetUsageReport(t *testing.T) { GrossAmount: 9.0, DiscountAmount: 1.0, NetAmount: 8.0, - RepositoryName: Ptr("user/example"), + RepositoryName: new("user/example"), }, }, } @@ -507,9 +507,9 @@ func TestBillingService_GetOrganizationPremiumRequestUsageReport(t *testing.T) { }) ctx := t.Context() opts := &PremiumRequestUsageReportOptions{ - Year: Ptr(2025), - Month: Ptr(10), - User: Ptr("testuser"), + Year: new(2025), + Month: new(10), + User: new("testuser"), } report, _, err := client.Billing.GetOrganizationPremiumRequestUsageReport(ctx, "o", opts) if err != nil { @@ -518,12 +518,12 @@ func TestBillingService_GetOrganizationPremiumRequestUsageReport(t *testing.T) { want := &PremiumRequestUsageReport{ TimePeriod: PremiumRequestUsageTimePeriod{ Year: 2025, - Month: Ptr(10), + Month: new(10), }, - Organization: Ptr("GitHub"), - User: Ptr("testuser"), - Product: Ptr("Copilot"), - Model: Ptr("GPT-5"), + Organization: new("GitHub"), + User: new("testuser"), + Product: new("Copilot"), + Model: new("GPT-5"), UsageItems: []*PremiumRequestUsageItem{ { Product: "Copilot", @@ -603,8 +603,8 @@ func TestBillingService_GetPremiumRequestUsageReport(t *testing.T) { }) ctx := t.Context() opts := &PremiumRequestUsageReportOptions{ - Year: Ptr(2025), - Day: Ptr(15), + Year: new(2025), + Day: new(15), } report, _, err := client.Billing.GetPremiumRequestUsageReport(ctx, "u", opts) if err != nil { @@ -613,10 +613,10 @@ func TestBillingService_GetPremiumRequestUsageReport(t *testing.T) { want := &PremiumRequestUsageReport{ TimePeriod: PremiumRequestUsageTimePeriod{ Year: 2025, - Day: Ptr(15), + Day: new(15), }, - User: Ptr("User"), - Product: Ptr("Copilot"), + User: new("User"), + Product: new("Copilot"), UsageItems: []*PremiumRequestUsageItem{ { Product: "Copilot", @@ -697,9 +697,9 @@ func TestBillingService_PremiumRequestUsageItem_FloatQuantities(t *testing.T) { want := &PremiumRequestUsageReport{ TimePeriod: PremiumRequestUsageTimePeriod{ Year: 2026, - Month: Ptr(2), + Month: new(2), }, - Organization: Ptr("testorg"), + Organization: new("testorg"), UsageItems: []*PremiumRequestUsageItem{ { Product: "Copilot", @@ -761,9 +761,9 @@ func TestBillingService_GetOrgAICreditUsage(t *testing.T) { ctx := t.Context() opts := &PremiumRequestUsageReportOptions{ - Year: Ptr(2025), - Month: Ptr(6), - User: Ptr("testuser"), + Year: new(2025), + Month: new(6), + User: new("testuser"), } report, _, err := client.Billing.GetOrgAICreditUsage(ctx, "o", opts) if err != nil { @@ -773,12 +773,12 @@ func TestBillingService_GetOrgAICreditUsage(t *testing.T) { want := &PremiumRequestUsageReport{ TimePeriod: PremiumRequestUsageTimePeriod{ Year: 2025, - Month: Ptr(6), + Month: new(6), }, - Organization: Ptr("GitHub"), - User: Ptr("testuser"), - Product: Ptr("Copilot"), - Model: Ptr("GPT-5"), + Organization: new("GitHub"), + User: new("testuser"), + Product: new("Copilot"), + Model: new("GPT-5"), UsageItems: []*PremiumRequestUsageItem{ { Product: "Copilot", @@ -863,10 +863,10 @@ func TestBillingService_GetOrgAICreditUsage_FloatQuantities(t *testing.T) { want := &PremiumRequestUsageReport{ TimePeriod: PremiumRequestUsageTimePeriod{ Year: 2025, - Month: Ptr(6), - Day: Ptr(15), + Month: new(6), + Day: new(15), }, - Organization: Ptr("testorg"), + Organization: new("testorg"), UsageItems: []*PremiumRequestUsageItem{ { Product: "Copilot", @@ -927,9 +927,9 @@ func TestBillingService_GetUserAICreditUsage(t *testing.T) { ctx := t.Context() opts := &PremiumRequestUsageReportOptions{ - Year: Ptr(2025), - Month: Ptr(6), - User: Ptr("testuser"), + Year: new(2025), + Month: new(6), + User: new("testuser"), } report, _, err := client.Billing.GetUserAICreditUsage(ctx, "u", opts) if err != nil { @@ -939,11 +939,11 @@ func TestBillingService_GetUserAICreditUsage(t *testing.T) { want := &PremiumRequestUsageReport{ TimePeriod: PremiumRequestUsageTimePeriod{ Year: 2025, - Month: Ptr(6), + Month: new(6), }, - User: Ptr("testuser"), - Product: Ptr("Copilot"), - Model: Ptr("GPT-5"), + User: new("testuser"), + Product: new("Copilot"), + Model: new("GPT-5"), UsageItems: []*PremiumRequestUsageItem{ { Product: "Copilot", @@ -1028,10 +1028,10 @@ func TestBillingService_GetUserAICreditUsage_FloatQuantities(t *testing.T) { want := &PremiumRequestUsageReport{ TimePeriod: PremiumRequestUsageTimePeriod{ Year: 2025, - Month: Ptr(6), - Day: Ptr(15), + Month: new(6), + Day: new(15), }, - User: Ptr("testuser"), + User: new("testuser"), UsageItems: []*PremiumRequestUsageItem{ { Product: "Copilot", diff --git a/github/checks_test.go b/github/checks_test.go index c66483c6b33..2c37405a023 100644 --- a/github/checks_test.go +++ b/github/checks_test.go @@ -38,12 +38,12 @@ func TestChecksService_GetCheckRun(t *testing.T) { completeAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") want := &CheckRun{ - ID: Ptr(int64(1)), - Status: Ptr("completed"), - Conclusion: Ptr("neutral"), + ID: new(int64(1)), + Status: new("completed"), + Conclusion: new("neutral"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{completeAt}, - Name: Ptr("testCheckRun"), + Name: new("testCheckRun"), } if !cmp.Equal(checkRun, want) { t.Errorf("Checks.GetCheckRun return %+v, want %+v", checkRun, want) @@ -86,13 +86,13 @@ func TestChecksService_GetCheckSuite(t *testing.T) { t.Errorf("Checks.GetCheckSuite return error: %v", err) } want := &CheckSuite{ - ID: Ptr(int64(1)), - HeadBranch: Ptr("master"), - HeadSHA: Ptr("deadbeef"), - AfterSHA: Ptr("deadbeefa"), - BeforeSHA: Ptr("deadbeefb"), - Status: Ptr("completed"), - Conclusion: Ptr("neutral"), + ID: new(int64(1)), + HeadBranch: new("master"), + HeadSHA: new("deadbeef"), + AfterSHA: new("deadbeefa"), + BeforeSHA: new("deadbeefb"), + Status: new("completed"), + Conclusion: new("neutral"), } if !cmp.Equal(checkSuite, want) { t.Errorf("Checks.GetCheckSuite return %+v, want %+v", checkSuite, want) @@ -134,12 +134,12 @@ func TestChecksService_CreateCheckRun(t *testing.T) { checkRunOpt := CreateCheckRunOptions{ Name: "testCreateCheckRun", HeadSHA: "deadbeef", - Status: Ptr("in_progress"), + Status: new("in_progress"), StartedAt: &Timestamp{startedAt}, Output: &CheckRunOutput{ - Title: Ptr("Mighty test report"), - Summary: Ptr(""), - Text: Ptr(""), + Title: new("Mighty test report"), + Summary: new(""), + Text: new(""), }, } @@ -150,15 +150,15 @@ func TestChecksService_CreateCheckRun(t *testing.T) { } want := &CheckRun{ - ID: Ptr(int64(1)), - Status: Ptr("in_progress"), + ID: new(int64(1)), + Status: new("in_progress"), StartedAt: &Timestamp{startedAt}, - HeadSHA: Ptr("deadbeef"), - Name: Ptr("testCreateCheckRun"), + HeadSHA: new("deadbeef"), + Name: new("testCreateCheckRun"), Output: &CheckRunOutput{ - Title: Ptr("Mighty test report"), - Summary: Ptr(""), - Text: Ptr(""), + Title: new("Mighty test report"), + Summary: new(""), + Text: new(""), }, } if !cmp.Equal(checkRun, want) { @@ -210,15 +210,15 @@ func TestChecksService_ListCheckRunAnnotations(t *testing.T) { } want := []*CheckRunAnnotation{{ - Path: Ptr("README.md"), - StartLine: Ptr(2), - EndLine: Ptr(2), - StartColumn: Ptr(1), - EndColumn: Ptr(5), - AnnotationLevel: Ptr("warning"), - Message: Ptr("Check your spelling for 'banaas'."), - Title: Ptr("Spell check"), - RawDetails: Ptr("Do you mean 'bananas' or 'banana'?"), + Path: new("README.md"), + StartLine: new(2), + EndLine: new(2), + StartColumn: new(1), + EndColumn: new(5), + AnnotationLevel: new("warning"), + Message: new("Check your spelling for 'banaas'."), + Title: new("Spell check"), + RawDetails: new("Do you mean 'bananas' or 'banana'?"), }} if !cmp.Equal(checkRunAnnotations, want) { @@ -259,12 +259,12 @@ func TestChecksService_UpdateCheckRun(t *testing.T) { startedAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") updateCheckRunOpt := UpdateCheckRunOptions{ Name: "testUpdateCheckRun", - Status: Ptr("completed"), + Status: new("completed"), CompletedAt: &Timestamp{startedAt}, Output: &CheckRunOutput{ - Title: Ptr("Mighty test report"), - Summary: Ptr("There are 0 failures, 2 warnings and 1 notice"), - Text: Ptr("You may have misspelled some words."), + Title: new("Mighty test report"), + Summary: new("There are 0 failures, 2 warnings and 1 notice"), + Text: new("You may have misspelled some words."), }, } @@ -275,16 +275,16 @@ func TestChecksService_UpdateCheckRun(t *testing.T) { } want := &CheckRun{ - ID: Ptr(int64(1)), - Status: Ptr("completed"), + ID: new(int64(1)), + Status: new("completed"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{startedAt}, - Conclusion: Ptr("neutral"), - Name: Ptr("testUpdateCheckRun"), + Conclusion: new("neutral"), + Name: new("testUpdateCheckRun"), Output: &CheckRunOutput{ - Title: Ptr("Mighty test report"), - Summary: Ptr("There are 0 failures, 2 warnings and 1 notice"), - Text: Ptr("You may have misspelled some words."), + Title: new("Mighty test report"), + Summary: new("There are 0 failures, 2 warnings and 1 notice"), + Text: new("You may have misspelled some words."), }, } if !cmp.Equal(checkRun, want) { @@ -334,10 +334,10 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { }) opt := &ListCheckRunsOptions{ - CheckName: Ptr("testing"), - Status: Ptr("completed"), - Filter: Ptr("all"), - AppID: Ptr(int64(1)), + CheckName: new("testing"), + Status: new("completed"), + Filter: new("all"), + AppID: new(int64(1)), ListOptions: ListOptions{Page: 1}, } ctx := t.Context() @@ -347,15 +347,15 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { } startedAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") want := &ListCheckRunsResults{ - Total: Ptr(1), + Total: new(1), CheckRuns: []*CheckRun{{ - ID: Ptr(int64(1)), - Status: Ptr("completed"), + ID: new(int64(1)), + Status: new("completed"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{startedAt}, - Conclusion: Ptr("neutral"), - HeadSHA: Ptr("deadbeef"), - App: &App{ID: Ptr(int64(1))}, + Conclusion: new("neutral"), + HeadSHA: new("deadbeef"), + App: &App{ID: new(int64(1))}, }}, } @@ -403,9 +403,9 @@ func TestChecksService_ListCheckRunsCheckSuite(t *testing.T) { }) opt := &ListCheckRunsOptions{ - CheckName: Ptr("testing"), - Status: Ptr("completed"), - Filter: Ptr("all"), + CheckName: new("testing"), + Status: new("completed"), + Filter: new("all"), ListOptions: ListOptions{Page: 1}, } ctx := t.Context() @@ -415,14 +415,14 @@ func TestChecksService_ListCheckRunsCheckSuite(t *testing.T) { } startedAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") want := &ListCheckRunsResults{ - Total: Ptr(1), + Total: new(1), CheckRuns: []*CheckRun{{ - ID: Ptr(int64(1)), - Status: Ptr("completed"), + ID: new(int64(1)), + Status: new("completed"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{startedAt}, - Conclusion: Ptr("neutral"), - HeadSHA: Ptr("deadbeef"), + Conclusion: new("neutral"), + HeadSHA: new("deadbeef"), }}, } @@ -470,8 +470,8 @@ func TestChecksService_ListCheckSuiteForRef(t *testing.T) { }) opt := &ListCheckSuiteOptions{ - CheckName: Ptr("testing"), - AppID: Ptr(int64(2)), + CheckName: new("testing"), + AppID: new(int64(2)), ListOptions: ListOptions{Page: 1}, } ctx := t.Context() @@ -480,15 +480,15 @@ func TestChecksService_ListCheckSuiteForRef(t *testing.T) { t.Errorf("Checks.ListCheckSuitesForRef return error: %v", err) } want := &ListCheckSuiteResults{ - Total: Ptr(1), + Total: new(1), CheckSuites: []*CheckSuite{{ - ID: Ptr(int64(1)), - Status: Ptr("completed"), - Conclusion: Ptr("neutral"), - HeadSHA: Ptr("deadbeef"), - HeadBranch: Ptr("master"), - BeforeSHA: Ptr("deadbeefb"), - AfterSHA: Ptr("deadbeefa"), + ID: new(int64(1)), + Status: new("completed"), + Conclusion: new("neutral"), + HeadSHA: new("deadbeef"), + HeadBranch: new("master"), + BeforeSHA: new("deadbeefb"), + AfterSHA: new("deadbeefa"), }}, } @@ -516,8 +516,8 @@ func TestChecksService_SetCheckSuitePreferences(t *testing.T) { client, mux, _ := setup(t) a := []*AutoTriggerCheck{{ - AppID: Ptr(int64(2)), - Setting: Ptr(false), + AppID: new(int64(2)), + Setting: new(false), }} opt := CheckSuitePreferenceOptions{AutoTriggerChecks: a} @@ -579,7 +579,7 @@ func TestChecksService_CreateCheckSuite(t *testing.T) { checkSuiteOpt := CreateCheckSuiteOptions{ HeadSHA: "deadbeef", - HeadBranch: Ptr("master"), + HeadBranch: new("master"), } ctx := t.Context() @@ -589,13 +589,13 @@ func TestChecksService_CreateCheckSuite(t *testing.T) { } want := &CheckSuite{ - ID: Ptr(int64(2)), - Status: Ptr("completed"), - HeadSHA: Ptr("deadbeef"), - HeadBranch: Ptr("master"), - Conclusion: Ptr("neutral"), - BeforeSHA: Ptr("deadbeefb"), - AfterSHA: Ptr("deadbeefa"), + ID: new(int64(2)), + Status: new("completed"), + HeadSHA: new("deadbeef"), + HeadBranch: new("master"), + Conclusion: new("neutral"), + BeforeSHA: new("deadbeefb"), + AfterSHA: new("deadbeefa"), } if !cmp.Equal(checkSuite, want) { t.Errorf("Checks.CreateCheckSuite return %+v, want %+v", checkSuite, want) diff --git a/github/classroom_test.go b/github/classroom_test.go index 9cc64b98946..7edef005298 100644 --- a/github/classroom_test.go +++ b/github/classroom_test.go @@ -61,36 +61,36 @@ func TestClassroomService_GetAssignment(t *testing.T) { } want := &ClassroomAssignment{ - ID: Ptr(int64(12)), - PublicRepo: Ptr(false), - Title: Ptr("Intro to Binaries"), - Type: Ptr("individual"), - InviteLink: Ptr("https://example.com/a/Lx7jiUgx"), - InvitationsEnabled: Ptr(true), - Slug: Ptr("intro-to-binaries"), - StudentsAreRepoAdmins: Ptr(false), - FeedbackPullRequestsEnabled: Ptr(true), - MaxTeams: Ptr(0), - MaxMembers: Ptr(0), - Editor: Ptr("codespaces"), - Accepted: Ptr(100), - Submitted: Ptr(40), - Passing: Ptr(10), - Language: Ptr("ruby"), + ID: new(int64(12)), + PublicRepo: new(false), + Title: new("Intro to Binaries"), + Type: new("individual"), + InviteLink: new("https://example.com/a/Lx7jiUgx"), + InvitationsEnabled: new(true), + Slug: new("intro-to-binaries"), + StudentsAreRepoAdmins: new(false), + FeedbackPullRequestsEnabled: new(true), + MaxTeams: new(0), + MaxMembers: new(0), + Editor: new("codespaces"), + Accepted: new(100), + Submitted: new(40), + Passing: new(10), + Language: new("ruby"), Deadline: &referenceTimestamp, StarterCodeRepository: &Repository{ - ID: Ptr(int64(1296269)), - FullName: Ptr("octocat/Hello-World"), - HTMLURL: Ptr("https://example.com/octocat/Hello-World"), - NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), - Private: Ptr(false), - DefaultBranch: Ptr("main"), + ID: new(int64(1296269)), + FullName: new("octocat/Hello-World"), + HTMLURL: new("https://example.com/octocat/Hello-World"), + NodeID: new("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), + Private: new(false), + DefaultBranch: new("main"), }, Classroom: &Classroom{ - ID: Ptr(int64(1296269)), - Name: Ptr("Programming Elixir"), - Archived: Ptr(false), - URL: Ptr("https://example.com/classrooms/programming"), + ID: new(int64(1296269)), + Name: new("Programming Elixir"), + Archived: new(false), + URL: new("https://example.com/classrooms/programming"), }, } @@ -142,18 +142,18 @@ func TestClassroomService_GetClassroom(t *testing.T) { } want := &Classroom{ - ID: Ptr(int64(1296269)), - Name: Ptr("Programming Elixir"), - Archived: Ptr(false), + ID: new(int64(1296269)), + Name: new("Programming Elixir"), + Archived: new(false), Organization: &Organization{ - ID: Ptr(int64(1)), - Login: Ptr("programming-elixir"), - NodeID: Ptr("MDEyOk9yZ2FuaXphdGlvbjE="), - HTMLURL: Ptr("https://example.com/programming-elixir"), - Name: Ptr("Learn how to build fault tolerant applications"), - AvatarURL: Ptr("https://example.com/avatars/u/9919?v=4"), + ID: new(int64(1)), + Login: new("programming-elixir"), + NodeID: new("MDEyOk9yZ2FuaXphdGlvbjE="), + HTMLURL: new("https://example.com/programming-elixir"), + Name: new("Learn how to build fault tolerant applications"), + AvatarURL: new("https://example.com/avatars/u/9919?v=4"), }, - URL: Ptr("https://example.com/classrooms/programming"), + URL: new("https://example.com/classrooms/programming"), } if !cmp.Equal(classroom, want) { @@ -207,16 +207,16 @@ func TestClassroomService_ListClassrooms(t *testing.T) { want := []*Classroom{ { - ID: Ptr(int64(1296269)), - Name: Ptr("Programming Elixir"), - Archived: Ptr(false), - URL: Ptr("https://example.com/classrooms/programming"), + ID: new(int64(1296269)), + Name: new("Programming Elixir"), + Archived: new(false), + URL: new("https://example.com/classrooms/programming"), }, { - ID: Ptr(int64(1296270)), - Name: Ptr("Advanced Programming"), - Archived: Ptr(true), - URL: Ptr("https://example.com/classrooms/2-advanced-programming"), + ID: new(int64(1296270)), + Name: new("Advanced Programming"), + Archived: new(true), + URL: new("https://example.com/classrooms/2-advanced-programming"), }, } @@ -304,53 +304,53 @@ func TestClassroomService_ListClassroomAssignments(t *testing.T) { want := []*ClassroomAssignment{ { - ID: Ptr(int64(12)), - PublicRepo: Ptr(false), - Title: Ptr("Intro to Binaries"), - Type: Ptr("individual"), - InviteLink: Ptr("https://example.com/a/Lx7jiUgx"), - InvitationsEnabled: Ptr(true), - Slug: Ptr("intro-to-binaries"), - StudentsAreRepoAdmins: Ptr(false), - FeedbackPullRequestsEnabled: Ptr(true), - MaxTeams: Ptr(0), - MaxMembers: Ptr(0), - Editor: Ptr("codespaces"), - Accepted: Ptr(100), - Submitted: Ptr(40), - Passing: Ptr(10), - Language: Ptr("ruby"), + ID: new(int64(12)), + PublicRepo: new(false), + Title: new("Intro to Binaries"), + Type: new("individual"), + InviteLink: new("https://example.com/a/Lx7jiUgx"), + InvitationsEnabled: new(true), + Slug: new("intro-to-binaries"), + StudentsAreRepoAdmins: new(false), + FeedbackPullRequestsEnabled: new(true), + MaxTeams: new(0), + MaxMembers: new(0), + Editor: new("codespaces"), + Accepted: new(100), + Submitted: new(40), + Passing: new(10), + Language: new("ruby"), Deadline: &referenceTimestamp, Classroom: &Classroom{ - ID: Ptr(int64(1296269)), - Name: Ptr("Programming Elixir"), - Archived: Ptr(false), - URL: Ptr("https://example.com/classrooms/programming"), + ID: new(int64(1296269)), + Name: new("Programming Elixir"), + Archived: new(false), + URL: new("https://example.com/classrooms/programming"), }, }, { - ID: Ptr(int64(13)), - PublicRepo: Ptr(true), - Title: Ptr("Advanced Programming"), - Type: Ptr("group"), - InviteLink: Ptr("https://example.com/a/AdvancedProg"), - InvitationsEnabled: Ptr(true), - Slug: Ptr("advanced-programming"), - StudentsAreRepoAdmins: Ptr(true), - FeedbackPullRequestsEnabled: Ptr(false), - MaxTeams: Ptr(5), - MaxMembers: Ptr(3), - Editor: Ptr("vscode"), - Accepted: Ptr(50), - Submitted: Ptr(25), - Passing: Ptr(20), - Language: Ptr("python"), + ID: new(int64(13)), + PublicRepo: new(true), + Title: new("Advanced Programming"), + Type: new("group"), + InviteLink: new("https://example.com/a/AdvancedProg"), + InvitationsEnabled: new(true), + Slug: new("advanced-programming"), + StudentsAreRepoAdmins: new(true), + FeedbackPullRequestsEnabled: new(false), + MaxTeams: new(5), + MaxMembers: new(3), + Editor: new("vscode"), + Accepted: new(50), + Submitted: new(25), + Passing: new(20), + Language: new("python"), Deadline: &referenceTimestamp, Classroom: &Classroom{ - ID: Ptr(int64(1296269)), - Name: Ptr("Programming Elixir"), - Archived: Ptr(false), - URL: Ptr("https://example.com/classrooms/programming"), + ID: new(int64(1296269)), + Name: new("Programming Elixir"), + Archived: new(false), + URL: new("https://example.com/classrooms/programming"), }, }, } @@ -490,98 +490,98 @@ func TestClassroomService_ListAcceptedAssignments(t *testing.T) { want := []*AcceptedAssignment{ { - ID: Ptr(int64(42)), - Submitted: Ptr(true), - Passing: Ptr(true), - CommitCount: Ptr(5), - Grade: Ptr("10/10"), + ID: new(int64(42)), + Submitted: new(true), + Passing: new(true), + CommitCount: new(5), + Grade: new("10/10"), Students: []*ClassroomUser{ { - ID: Ptr(int64(1)), - Login: Ptr("octocat"), - AvatarURL: Ptr("https://github.com/images/error/octocat_happy.gif"), - HTMLURL: Ptr("https://github.com/octocat"), + ID: new(int64(1)), + Login: new("octocat"), + AvatarURL: new("https://github.com/images/error/octocat_happy.gif"), + HTMLURL: new("https://github.com/octocat"), }, }, Repository: &Repository{ - ID: Ptr(int64(1296269)), - FullName: Ptr("octocat/Hello-World"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World"), - NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), - Private: Ptr(false), - DefaultBranch: Ptr("main"), + ID: new(int64(1296269)), + FullName: new("octocat/Hello-World"), + HTMLURL: new("https://github.com/octocat/Hello-World"), + NodeID: new("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), + Private: new(false), + DefaultBranch: new("main"), }, Assignment: &ClassroomAssignment{ - ID: Ptr(int64(12)), - PublicRepo: Ptr(false), - Title: Ptr("Intro to Binaries"), - Type: Ptr("individual"), - InviteLink: Ptr("https://example.com/a/Lx7jiUgx"), - InvitationsEnabled: Ptr(true), - Slug: Ptr("intro-to-binaries"), - StudentsAreRepoAdmins: Ptr(false), - FeedbackPullRequestsEnabled: Ptr(true), - MaxTeams: Ptr(0), - MaxMembers: Ptr(0), - Editor: Ptr("codespaces"), - Accepted: Ptr(100), - Submitted: Ptr(40), - Passing: Ptr(10), - Language: Ptr("ruby"), + ID: new(int64(12)), + PublicRepo: new(false), + Title: new("Intro to Binaries"), + Type: new("individual"), + InviteLink: new("https://example.com/a/Lx7jiUgx"), + InvitationsEnabled: new(true), + Slug: new("intro-to-binaries"), + StudentsAreRepoAdmins: new(false), + FeedbackPullRequestsEnabled: new(true), + MaxTeams: new(0), + MaxMembers: new(0), + Editor: new("codespaces"), + Accepted: new(100), + Submitted: new(40), + Passing: new(10), + Language: new("ruby"), Deadline: &referenceTimestamp, Classroom: &Classroom{ - ID: Ptr(int64(1296269)), - Name: Ptr("Programming Elixir"), - Archived: Ptr(false), - URL: Ptr("https://example.com/classrooms/programming"), + ID: new(int64(1296269)), + Name: new("Programming Elixir"), + Archived: new(false), + URL: new("https://example.com/classrooms/programming"), }, }, }, { - ID: Ptr(int64(43)), - Submitted: Ptr(false), - Passing: Ptr(false), - CommitCount: Ptr(2), - Grade: Ptr("5/10"), + ID: new(int64(43)), + Submitted: new(false), + Passing: new(false), + CommitCount: new(2), + Grade: new("5/10"), Students: []*ClassroomUser{ { - ID: Ptr(int64(2)), - Login: Ptr("monalisa"), - AvatarURL: Ptr("https://github.com/images/error/monalisa_happy.gif"), - HTMLURL: Ptr("https://github.com/monalisa"), + ID: new(int64(2)), + Login: new("monalisa"), + AvatarURL: new("https://github.com/images/error/monalisa_happy.gif"), + HTMLURL: new("https://github.com/monalisa"), }, }, Repository: &Repository{ - ID: Ptr(int64(1296270)), - FullName: Ptr("monalisa/Hello-World"), - HTMLURL: Ptr("https://github.com/monalisa/Hello-World"), - NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjk2Mjcw"), - Private: Ptr(true), - DefaultBranch: Ptr("main"), + ID: new(int64(1296270)), + FullName: new("monalisa/Hello-World"), + HTMLURL: new("https://github.com/monalisa/Hello-World"), + NodeID: new("MDEwOlJlcG9zaXRvcnkxMjk2Mjcw"), + Private: new(true), + DefaultBranch: new("main"), }, Assignment: &ClassroomAssignment{ - ID: Ptr(int64(12)), - PublicRepo: Ptr(false), - Title: Ptr("Intro to Binaries"), - Type: Ptr("individual"), - InviteLink: Ptr("https://example.com/a/Lx7jiUgx"), - InvitationsEnabled: Ptr(true), - Slug: Ptr("intro-to-binaries"), - StudentsAreRepoAdmins: Ptr(false), - FeedbackPullRequestsEnabled: Ptr(true), - MaxTeams: Ptr(0), - MaxMembers: Ptr(0), - Editor: Ptr("codespaces"), - Accepted: Ptr(100), - Submitted: Ptr(40), - Passing: Ptr(10), - Language: Ptr("ruby"), + ID: new(int64(12)), + PublicRepo: new(false), + Title: new("Intro to Binaries"), + Type: new("individual"), + InviteLink: new("https://example.com/a/Lx7jiUgx"), + InvitationsEnabled: new(true), + Slug: new("intro-to-binaries"), + StudentsAreRepoAdmins: new(false), + FeedbackPullRequestsEnabled: new(true), + MaxTeams: new(0), + MaxMembers: new(0), + Editor: new("codespaces"), + Accepted: new(100), + Submitted: new(40), + Passing: new(10), + Language: new("ruby"), Deadline: &referenceTimestamp, Classroom: &Classroom{ - ID: Ptr(int64(1296269)), - Name: Ptr("Programming Elixir"), - Archived: Ptr(false), - URL: Ptr("https://example.com/classrooms/programming"), + ID: new(int64(1296269)), + Name: new("Programming Elixir"), + Archived: new(false), + URL: new("https://example.com/classrooms/programming"), }, }, }, @@ -650,30 +650,30 @@ func TestClassroomService_GetAssignmentGrades(t *testing.T) { want := []*AssignmentGrade{ { - AssignmentName: Ptr("Intro to Binaries"), - AssignmentURL: Ptr("https://classroom.github.com/assignments/12"), - StarterCodeURL: Ptr("https://github.com/octocat/Hello-World"), - GithubUsername: Ptr("octocat"), - RosterIdentifier: Ptr("student123"), - StudentRepositoryName: Ptr("octocat/intro-to-binaries"), - StudentRepositoryURL: Ptr("https://github.com/octocat/intro-to-binaries"), + AssignmentName: new("Intro to Binaries"), + AssignmentURL: new("https://classroom.github.com/assignments/12"), + StarterCodeURL: new("https://github.com/octocat/Hello-World"), + GithubUsername: new("octocat"), + RosterIdentifier: new("student123"), + StudentRepositoryName: new("octocat/intro-to-binaries"), + StudentRepositoryURL: new("https://github.com/octocat/intro-to-binaries"), SubmissionTimestamp: &referenceTimestamp, - PointsAwarded: Ptr(10), - PointsAvailable: Ptr(10), - GroupName: Ptr("Team Alpha"), + PointsAwarded: new(10), + PointsAvailable: new(10), + GroupName: new("Team Alpha"), }, { - AssignmentName: Ptr("Intro to Binaries"), - AssignmentURL: Ptr("https://classroom.github.com/assignments/12"), - StarterCodeURL: Ptr("https://github.com/octocat/Hello-World"), - GithubUsername: Ptr("monalisa"), - RosterIdentifier: Ptr("student456"), - StudentRepositoryName: Ptr("monalisa/intro-to-binaries"), - StudentRepositoryURL: Ptr("https://github.com/monalisa/intro-to-binaries"), + AssignmentName: new("Intro to Binaries"), + AssignmentURL: new("https://classroom.github.com/assignments/12"), + StarterCodeURL: new("https://github.com/octocat/Hello-World"), + GithubUsername: new("monalisa"), + RosterIdentifier: new("student456"), + StudentRepositoryName: new("monalisa/intro-to-binaries"), + StudentRepositoryURL: new("https://github.com/monalisa/intro-to-binaries"), SubmissionTimestamp: &referenceTimestamp, - PointsAwarded: Ptr(8), - PointsAvailable: Ptr(10), - GroupName: Ptr("Team Beta"), + PointsAwarded: new(8), + PointsAvailable: new(10), + GroupName: new("Team Beta"), }, } diff --git a/github/code_quality_test.go b/github/code_quality_test.go index 2a90bf85702..673ad2ff134 100644 --- a/github/code_quality_test.go +++ b/github/code_quality_test.go @@ -36,11 +36,11 @@ func TestCodeQualityService_GetSetup(t *testing.T) { } want := &CodeQualitySetupConfiguration{ - State: Ptr("configured"), + State: new("configured"), Languages: []string{"javascript-typescript", "python"}, - RunnerType: Ptr("standard"), + RunnerType: new("standard"), UpdatedAt: &referenceTimestamp, - Schedule: Ptr("weekly"), + Schedule: new("weekly"), } if diff := cmp.Diff(want, cfg); diff != "" { t.Errorf("CodeQuality.GetSetup mismatch (-want +got):\n%v", diff) @@ -66,7 +66,7 @@ func TestCodeQualityService_UpdateSetup(t *testing.T) { client, mux, _ := setup(t) input := &CodeQualityUpdateSetupRequest{ - State: Ptr("configured"), + State: new("configured"), Languages: []string{"javascript-typescript", "python", "ruby"}, } @@ -86,8 +86,8 @@ func TestCodeQualityService_UpdateSetup(t *testing.T) { } want := &CodeQualityUpdateSetupResponse{ - RunID: Ptr(int64(42)), - RunURL: Ptr("https://api.github.com/repos/octocat/hello-world/actions/runs/42"), + RunID: new(int64(42)), + RunURL: new("https://api.github.com/repos/octocat/hello-world/actions/runs/42"), } if diff := cmp.Diff(want, result); diff != "" { t.Errorf("CodeQuality.UpdateSetup mismatch (-want +got):\n%v", diff) @@ -113,9 +113,9 @@ func TestCodeQualityService_UpdateSetup_withRunnerLabel(t *testing.T) { client, mux, _ := setup(t) input := &CodeQualityUpdateSetupRequest{ - State: Ptr("configured"), - RunnerType: Ptr("labeled"), - RunnerLabel: Ptr("my-runner"), + State: new("configured"), + RunnerType: new("labeled"), + RunnerLabel: new("my-runner"), Languages: []string{"go", "python"}, } @@ -135,8 +135,8 @@ func TestCodeQualityService_UpdateSetup_withRunnerLabel(t *testing.T) { } want := &CodeQualityUpdateSetupResponse{ - RunID: Ptr(int64(99)), - RunURL: Ptr("https://api.github.com/repos/octocat/hello-world/actions/runs/99"), + RunID: new(int64(99)), + RunURL: new("https://api.github.com/repos/octocat/hello-world/actions/runs/99"), } if diff := cmp.Diff(want, result); diff != "" { t.Errorf("CodeQuality.UpdateSetup mismatch (-want +got):\n%v", diff) @@ -148,7 +148,7 @@ func TestCodeQualityService_UpdateSetup_notConfigured(t *testing.T) { client, mux, _ := setup(t) input := &CodeQualityUpdateSetupRequest{ - State: Ptr("not-configured"), + State: new("not-configured"), } mux.HandleFunc("/repos/o/r/code-quality/setup", func(w http.ResponseWriter, r *http.Request) { @@ -241,16 +241,16 @@ func TestCodeQualityService_ListFindings(t *testing.T) { ID: "rule-1", Title: "Example Rule", Description: "An example rule description", - Help: Ptr("How to fix it"), + Help: new("How to fix it"), Severity: "warning", Category: "maintainability", }, Location: CodeQualityFindingLocation{ Path: "src/main.go", - StartLine: Ptr(10), - EndLine: Ptr(10), - StartColumn: Ptr(1), - EndColumn: Ptr(20), + StartLine: new(10), + EndLine: new(10), + StartColumn: new(1), + EndColumn: new(20), }, Message: CodeQualityFindingMessage{ Text: "Issue found", @@ -347,8 +347,8 @@ func TestCodeQualityService_GetFinding(t *testing.T) { }, Location: CodeQualityFindingLocation{ Path: "src/main.go", - StartLine: Ptr(5), - EndLine: Ptr(5), + StartLine: new(5), + EndLine: new(5), }, Message: CodeQualityFindingMessage{ Text: "Critical issue", diff --git a/github/code_scanning_test.go b/github/code_scanning_test.go index bc1321db4e2..c4e4a70ccf7 100644 --- a/github/code_scanning_test.go +++ b/github/code_scanning_test.go @@ -26,7 +26,7 @@ func TestCodeScanningService_Alert_ID(t *testing.T) { // Test: Valid HTMLURL a = &Alert{ - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/88"), } id = a.ID() want = 88 @@ -44,7 +44,7 @@ func TestCodeScanningService_Alert_ID(t *testing.T) { // Test: ID can't be parsed as an int a = &Alert{ - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/bad88"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/bad88"), } id = a.ID() want = 0 @@ -58,11 +58,11 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { client, mux, _ := setup(t) expectedSarifID := &SarifID{ - ID: Ptr("testid"), - URL: Ptr("https://example.com/testurl"), + ID: new("testid"), + URL: new("https://example.com/testurl"), } - sarifAnalysis := SarifAnalysis{CommitSHA: "abc", Ref: "ref/head/main", Sarif: "abc", CheckoutURI: Ptr("uri"), StartedAt: &referenceTimestamp, ToolName: Ptr("codeql-cli"), Validate: Ptr(true)} + sarifAnalysis := SarifAnalysis{CommitSHA: "abc", Ref: "ref/head/main", Sarif: "abc", CheckoutURI: new("uri"), StartedAt: &referenceTimestamp, ToolName: new("codeql-cli"), Validate: new(true)} mux.HandleFunc("/repos/o/r/code-scanning/sarifs", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -112,8 +112,8 @@ func TestCodeScanningService_GetSARIF(t *testing.T) { } want := &SARIFUpload{ - ProcessingStatus: Ptr("s"), - AnalysesURL: Ptr("u"), + ProcessingStatus: new("s"), + AnalysesURL: new("u"), } if !cmp.Equal(sarifUpload, want) { t.Errorf("CodeScanning.GetSARIF returned %+v, want %+v", sarifUpload, want) @@ -242,77 +242,77 @@ func TestCodeScanningService_ListAlertsForOrg(t *testing.T) { want := []*Alert{ { Repository: &Repository{ - ID: Ptr(int64(1)), - URL: Ptr("url"), - Name: Ptr("n"), + ID: new(int64(1)), + URL: new("url"), + Name: new("n"), }, - RuleID: Ptr("js/trivial-conditional"), - RuleSeverity: Ptr("warning"), - RuleDescription: Ptr("Useless conditional"), - Tool: &Tool{Name: Ptr("CodeQL"), GUID: Ptr("guid"), Version: Ptr("1.4.0")}, + RuleID: new("js/trivial-conditional"), + RuleSeverity: new("warning"), + RuleDescription: new("Useless conditional"), + Tool: &Tool{Name: new("CodeQL"), GUID: new("guid"), Version: new("1.4.0")}, Rule: &Rule{ - ID: Ptr("js/trivial-conditional"), - Severity: Ptr("warning"), - Description: Ptr("Useless conditional"), - Name: Ptr("js/trivial-conditional"), - FullDescription: Ptr("Expression has no effect"), - Help: Ptr("Expression has no effect"), + ID: new("js/trivial-conditional"), + Severity: new("warning"), + Description: new("Useless conditional"), + Name: new("js/trivial-conditional"), + FullDescription: new("Expression has no effect"), + Help: new("Expression has no effect"), }, CreatedAt: &referenceTimestamp, - State: Ptr("open"), + State: new("open"), ClosedBy: nil, ClosedAt: nil, - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/25"), - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/25"), + URL: new("https://api.github.com/repos/o/r/code-scanning/alerts/25"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/25"), MostRecentInstance: &MostRecentInstance{ - Ref: Ptr("refs/heads/main"), - State: Ptr("open"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + State: new("open"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, }, { - RuleID: Ptr("js/useless-expression"), - RuleSeverity: Ptr("warning"), - RuleDescription: Ptr("Expression has no effect"), - Tool: &Tool{Name: Ptr("CodeQL"), GUID: nil, Version: Ptr("1.4.0")}, + RuleID: new("js/useless-expression"), + RuleSeverity: new("warning"), + RuleDescription: new("Expression has no effect"), + Tool: &Tool{Name: new("CodeQL"), GUID: nil, Version: new("1.4.0")}, Rule: &Rule{ - ID: Ptr("js/useless-expression"), - Severity: Ptr("warning"), - Description: Ptr("Expression has no effect"), - Name: Ptr("js/useless-expression"), - FullDescription: Ptr("Expression has no effect"), - Help: Ptr("Expression has no effect"), + ID: new("js/useless-expression"), + Severity: new("warning"), + Description: new("Expression has no effect"), + Name: new("js/useless-expression"), + FullDescription: new("Expression has no effect"), + Help: new("Expression has no effect"), }, CreatedAt: &referenceTimestamp, - State: Ptr("open"), + State: new("open"), ClosedBy: nil, ClosedAt: nil, - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), + URL: new("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: Ptr("refs/heads/main"), - State: Ptr("open"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + State: new("open"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, @@ -403,41 +403,41 @@ func TestCodeScanningService_ListAlertsForOrgLisCursorOptions(t *testing.T) { want := []*Alert{ { Repository: &Repository{ - ID: Ptr(int64(1)), - URL: Ptr("url"), - Name: Ptr("n"), + ID: new(int64(1)), + URL: new("url"), + Name: new("n"), }, - RuleID: Ptr("js/trivial-conditional"), - RuleSeverity: Ptr("warning"), - RuleDescription: Ptr("Useless conditional"), - Tool: &Tool{Name: Ptr("CodeQL"), GUID: nil, Version: Ptr("1.4.0")}, + RuleID: new("js/trivial-conditional"), + RuleSeverity: new("warning"), + RuleDescription: new("Useless conditional"), + Tool: &Tool{Name: new("CodeQL"), GUID: nil, Version: new("1.4.0")}, Rule: &Rule{ - ID: Ptr("js/trivial-conditional"), - Severity: Ptr("warning"), - Description: Ptr("Useless conditional"), - Name: Ptr("js/trivial-conditional"), - FullDescription: Ptr("Expression has no effect"), - Help: Ptr("Expression has no effect"), + ID: new("js/trivial-conditional"), + Severity: new("warning"), + Description: new("Useless conditional"), + Name: new("js/trivial-conditional"), + FullDescription: new("Expression has no effect"), + Help: new("Expression has no effect"), }, CreatedAt: &referenceTimestamp, - State: Ptr("open"), + State: new("open"), ClosedBy: nil, ClosedAt: nil, - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/25"), - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/25"), + URL: new("https://api.github.com/repos/o/r/code-scanning/alerts/25"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/25"), MostRecentInstance: &MostRecentInstance{ - Ref: Ptr("refs/heads/main"), - State: Ptr("open"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + State: new("open"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, @@ -564,73 +564,73 @@ func TestCodeScanningService_ListAlertsForRepo(t *testing.T) { want := []*Alert{ { - RuleID: Ptr("js/trivial-conditional"), - RuleSeverity: Ptr("warning"), - RuleDescription: Ptr("Useless conditional"), - Tool: &Tool{Name: Ptr("CodeQL"), GUID: Ptr("guid"), Version: Ptr("1.4.0")}, + RuleID: new("js/trivial-conditional"), + RuleSeverity: new("warning"), + RuleDescription: new("Useless conditional"), + Tool: &Tool{Name: new("CodeQL"), GUID: new("guid"), Version: new("1.4.0")}, Rule: &Rule{ - ID: Ptr("js/trivial-conditional"), - Severity: Ptr("warning"), - Description: Ptr("Useless conditional"), - Name: Ptr("js/trivial-conditional"), - FullDescription: Ptr("Expression has no effect"), - Help: Ptr("Expression has no effect"), + ID: new("js/trivial-conditional"), + Severity: new("warning"), + Description: new("Useless conditional"), + Name: new("js/trivial-conditional"), + FullDescription: new("Expression has no effect"), + Help: new("Expression has no effect"), }, CreatedAt: &referenceTimestamp, - State: Ptr("open"), + State: new("open"), ClosedBy: nil, ClosedAt: nil, - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/25"), - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/25"), + URL: new("https://api.github.com/repos/o/r/code-scanning/alerts/25"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/25"), MostRecentInstance: &MostRecentInstance{ - Ref: Ptr("refs/heads/main"), - State: Ptr("open"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + State: new("open"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, }, { - RuleID: Ptr("js/useless-expression"), - RuleSeverity: Ptr("warning"), - RuleDescription: Ptr("Expression has no effect"), - Tool: &Tool{Name: Ptr("CodeQL"), GUID: Ptr("guid"), Version: Ptr("1.4.0")}, + RuleID: new("js/useless-expression"), + RuleSeverity: new("warning"), + RuleDescription: new("Expression has no effect"), + Tool: &Tool{Name: new("CodeQL"), GUID: new("guid"), Version: new("1.4.0")}, Rule: &Rule{ - ID: Ptr("js/useless-expression"), - Severity: Ptr("warning"), - Description: Ptr("Expression has no effect"), - Name: Ptr("js/useless-expression"), - FullDescription: Ptr("Expression has no effect"), - Help: Ptr("Expression has no effect"), + ID: new("js/useless-expression"), + Severity: new("warning"), + Description: new("Expression has no effect"), + Name: new("js/useless-expression"), + FullDescription: new("Expression has no effect"), + Help: new("Expression has no effect"), }, CreatedAt: &referenceTimestamp, - State: Ptr("open"), + State: new("open"), ClosedBy: nil, ClosedAt: nil, - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), + URL: new("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: Ptr("refs/heads/main"), - State: Ptr("open"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + State: new("open"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, @@ -706,9 +706,9 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { }) ctx := t.Context() - dismissedComment := Ptr("This alert is not actually correct as sanitizer is used") - dismissedReason := Ptr("false positive") - state := Ptr("dismissed") + dismissedComment := new("This alert is not actually correct as sanitizer is used") + dismissedReason := new("false positive") + state := new("dismissed") stateInfo := &CodeScanningAlertState{State: *state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} alert, _, err := client.CodeScanning.UpdateAlert(ctx, "o", "r", 88, stateInfo) if err != nil { @@ -716,17 +716,17 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { } want := &Alert{ - RuleID: Ptr("js/useless-expression"), - RuleSeverity: Ptr("warning"), - RuleDescription: Ptr("Expression has no effect"), - Tool: &Tool{Name: Ptr("CodeQL"), GUID: nil, Version: Ptr("1.4.0")}, + RuleID: new("js/useless-expression"), + RuleSeverity: new("warning"), + RuleDescription: new("Expression has no effect"), + Tool: &Tool{Name: new("CodeQL"), GUID: nil, Version: new("1.4.0")}, Rule: &Rule{ - ID: Ptr("useless expression"), - Severity: Ptr("warning"), - Description: Ptr("Expression has no effect"), - Name: Ptr("useless expression"), - FullDescription: Ptr("Expression has no effect"), - Help: Ptr("Expression has no effect"), + ID: new("useless expression"), + Severity: new("warning"), + Description: new("Expression has no effect"), + Name: new("useless expression"), + FullDescription: new("Expression has no effect"), + Help: new("Expression has no effect"), }, CreatedAt: &referenceTimestamp, State: state, @@ -734,21 +734,21 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { DismissedComment: dismissedComment, ClosedBy: nil, ClosedAt: nil, - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), + URL: new("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: Ptr("refs/heads/main"), - State: Ptr("dismissed"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + State: new("dismissed"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, @@ -813,21 +813,21 @@ func TestCodeScanningService_ListAlertInstances(t *testing.T) { want := []*MostRecentInstance{ { - Ref: Ptr("refs/heads/main"), - AnalysisKey: Ptr(".github/workflows/codeql-analysis.yml:analyze"), - Category: Ptr(".github/workflows/codeql-analysis.yml:analyze"), - Environment: Ptr(""), - State: Ptr("open"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + AnalysisKey: new(".github/workflows/codeql-analysis.yml:analyze"), + Category: new(".github/workflows/codeql-analysis.yml:analyze"), + Environment: new(""), + State: new("open"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, @@ -908,37 +908,37 @@ func TestCodeScanningService_GetAlert(t *testing.T) { } want := &Alert{ - RuleID: Ptr("js/useless-expression"), - RuleSeverity: Ptr("warning"), - RuleDescription: Ptr("Expression has no effect"), - Tool: &Tool{Name: Ptr("CodeQL"), GUID: nil, Version: Ptr("1.4.0")}, + RuleID: new("js/useless-expression"), + RuleSeverity: new("warning"), + RuleDescription: new("Expression has no effect"), + Tool: &Tool{Name: new("CodeQL"), GUID: nil, Version: new("1.4.0")}, Rule: &Rule{ - ID: Ptr("useless expression"), - Severity: Ptr("warning"), - Description: Ptr("Expression has no effect"), - Name: Ptr("useless expression"), - FullDescription: Ptr("Expression has no effect"), - Help: Ptr("Expression has no effect"), + ID: new("useless expression"), + Severity: new("warning"), + Description: new("Expression has no effect"), + Name: new("useless expression"), + FullDescription: new("Expression has no effect"), + Help: new("Expression has no effect"), }, CreatedAt: &referenceTimestamp, - State: Ptr("open"), + State: new("open"), ClosedBy: nil, ClosedAt: nil, - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), + URL: new("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: new("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: Ptr("refs/heads/main"), - State: Ptr("open"), - CommitSHA: Ptr("abcdefg12345"), + Ref: new("refs/heads/main"), + State: new("open"), + CommitSHA: new("abcdefg12345"), Message: &Message{ - Text: Ptr("This path depends on a user-provided value."), + Text: new("This path depends on a user-provided value."), }, Location: &Location{ - Path: Ptr("spec-main/api-session-spec.ts"), - StartLine: Ptr(917), - EndLine: Ptr(917), - StartColumn: Ptr(7), - EndColumn: Ptr(18), + Path: new("spec-main/api-session-spec.ts"), + StartLine: new(917), + EndLine: new(917), + StartColumn: new(7), + EndColumn: new(18), }, Classifications: []string{"test"}, }, @@ -1015,7 +1015,7 @@ func TestCodeScanningService_ListAnalysesForRepo(t *testing.T) { ]`) }) - opts := &AnalysesListOptions{SarifID: Ptr("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), Ref: Ptr("heads/master")} + opts := &AnalysesListOptions{SarifID: new("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), Ref: new("heads/master")} ctx := t.Context() analyses, _, err := client.CodeScanning.ListAnalysesForRepo(ctx, "o", "r", opts) if err != nil { @@ -1024,46 +1024,46 @@ func TestCodeScanningService_ListAnalysesForRepo(t *testing.T) { want := []*ScanningAnalysis{ { - ID: Ptr(int64(201)), - Ref: Ptr("refs/heads/main"), - CommitSHA: Ptr("d99612c3e1f2970085cfbaeadf8f010ef69bad83"), - AnalysisKey: Ptr(".github/workflows/codeql-analysis.yml:analyze"), - Environment: Ptr("{\"language\":\"python\"}"), - Error: Ptr(""), - Category: Ptr(".github/workflows/codeql-analysis.yml:analyze/language:python"), + ID: new(int64(201)), + Ref: new("refs/heads/main"), + CommitSHA: new("d99612c3e1f2970085cfbaeadf8f010ef69bad83"), + AnalysisKey: new(".github/workflows/codeql-analysis.yml:analyze"), + Environment: new("{\"language\":\"python\"}"), + Error: new(""), + Category: new(".github/workflows/codeql-analysis.yml:analyze/language:python"), CreatedAt: &referenceTimestamp, - ResultsCount: Ptr(17), - RulesCount: Ptr(49), - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/analyses/201"), - SarifID: Ptr("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), + ResultsCount: new(17), + RulesCount: new(49), + URL: new("https://api.github.com/repos/o/r/code-scanning/analyses/201"), + SarifID: new("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), Tool: &Tool{ - Name: Ptr("CodeQL"), + Name: new("CodeQL"), GUID: nil, - Version: Ptr("2.4.0"), + Version: new("2.4.0"), }, - Deletable: Ptr(true), - Warning: Ptr(""), + Deletable: new(true), + Warning: new(""), }, { - ID: Ptr(int64(200)), - Ref: Ptr("refs/heads/my-branch"), - CommitSHA: Ptr("c8cff6510d4d084fb1b4aa13b64b97ca12b07321"), - AnalysisKey: Ptr(".github/workflows/shiftleft.yml:build"), - Environment: Ptr("{}"), - Error: Ptr(""), - Category: Ptr(".github/workflows/shiftleft.yml:build/"), + ID: new(int64(200)), + Ref: new("refs/heads/my-branch"), + CommitSHA: new("c8cff6510d4d084fb1b4aa13b64b97ca12b07321"), + AnalysisKey: new(".github/workflows/shiftleft.yml:build"), + Environment: new("{}"), + Error: new(""), + Category: new(".github/workflows/shiftleft.yml:build/"), CreatedAt: &referenceTimestamp, - ResultsCount: Ptr(17), - RulesCount: Ptr(32), - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/analyses/200"), - SarifID: Ptr("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), + ResultsCount: new(17), + RulesCount: new(32), + URL: new("https://api.github.com/repos/o/r/code-scanning/analyses/200"), + SarifID: new("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), Tool: &Tool{ - Name: Ptr("Python Security ScanningAnalysis"), + Name: new("Python Security ScanningAnalysis"), GUID: nil, - Version: Ptr("1.2.0"), + Version: new("1.2.0"), }, - Deletable: Ptr(true), - Warning: Ptr(""), + Deletable: new(true), + Warning: new(""), }, } if !cmp.Equal(analyses, want) { @@ -1121,25 +1121,25 @@ func TestCodeScanningService_GetAnalysis(t *testing.T) { } want := &ScanningAnalysis{ - ID: Ptr(int64(3602840)), - Ref: Ptr("refs/heads/main"), - CommitSHA: Ptr("c18c69115654ff0166991962832dc2bd7756e655"), - AnalysisKey: Ptr(".github/workflows/codeql-analysis.yml:analyze"), - Environment: Ptr("{\"language\":\"javascript\"}"), - Error: Ptr(""), - Category: Ptr(".github/workflows/codeql-analysis.yml:analyze/language:javascript"), + ID: new(int64(3602840)), + Ref: new("refs/heads/main"), + CommitSHA: new("c18c69115654ff0166991962832dc2bd7756e655"), + AnalysisKey: new(".github/workflows/codeql-analysis.yml:analyze"), + Environment: new("{\"language\":\"javascript\"}"), + Error: new(""), + Category: new(".github/workflows/codeql-analysis.yml:analyze/language:javascript"), CreatedAt: &referenceTimestamp, - ResultsCount: Ptr(3), - RulesCount: Ptr(67), - URL: Ptr("https://api.github.com/repos/o/r/code-scanning/analyses/201"), - SarifID: Ptr("47177e22-5596-11eb-80a1-c1e54ef945c6"), + ResultsCount: new(3), + RulesCount: new(67), + URL: new("https://api.github.com/repos/o/r/code-scanning/analyses/201"), + SarifID: new("47177e22-5596-11eb-80a1-c1e54ef945c6"), Tool: &Tool{ - Name: Ptr("CodeQL"), + Name: new("CodeQL"), GUID: nil, - Version: Ptr("2.4.0"), + Version: new("2.4.0"), }, - Deletable: Ptr(true), - Warning: Ptr(""), + Deletable: new(true), + Warning: new(""), } if !cmp.Equal(analysis, want) { t.Errorf("CodeScanning.GetAnalysis returned %+v, want %+v", analysis, want) @@ -1179,8 +1179,8 @@ func TestCodeScanningService_DeleteAnalysis(t *testing.T) { } want := &DeleteAnalysis{ - NextAnalysisURL: Ptr("a"), - ConfirmDeleteURL: Ptr("b"), + NextAnalysisURL: new("a"), + ConfirmDeleteURL: new("b"), } if !cmp.Equal(analysis, want) { t.Errorf("CodeScanning.DeleteAnalysis returned %+v, want %+v", analysis, want) @@ -1249,34 +1249,34 @@ func TestCodeScanningService_ListCodeQLDatabases(t *testing.T) { want := []*CodeQLDatabase{ { - ID: Ptr(int64(1)), - Name: Ptr("name"), - Language: Ptr("language"), + ID: new(int64(1)), + Name: new("name"), + Language: new("language"), Uploader: &User{ - Login: Ptr("a"), - ID: Ptr(int64(1)), - NodeID: Ptr("b"), - AvatarURL: Ptr("c"), - GravatarID: Ptr("d"), - URL: Ptr("e"), - HTMLURL: Ptr("f"), - FollowersURL: Ptr("g"), - FollowingURL: Ptr("h"), - GistsURL: Ptr("i"), - StarredURL: Ptr("j"), - SubscriptionsURL: Ptr("k"), - OrganizationsURL: Ptr("l"), - ReposURL: Ptr("m"), - EventsURL: Ptr("n"), - ReceivedEventsURL: Ptr("o"), - Type: Ptr("p"), - SiteAdmin: Ptr(false), + Login: new("a"), + ID: new(int64(1)), + NodeID: new("b"), + AvatarURL: new("c"), + GravatarID: new("d"), + URL: new("e"), + HTMLURL: new("f"), + FollowersURL: new("g"), + FollowingURL: new("h"), + GistsURL: new("i"), + StarredURL: new("j"), + SubscriptionsURL: new("k"), + OrganizationsURL: new("l"), + ReposURL: new("m"), + EventsURL: new("n"), + ReceivedEventsURL: new("o"), + Type: new("p"), + SiteAdmin: new(false), }, - ContentType: Ptr("r"), - Size: Ptr(int64(1024)), + ContentType: new("r"), + Size: new(int64(1024)), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - URL: Ptr("s"), + URL: new("s"), }, } @@ -1344,34 +1344,34 @@ func TestCodeScanningService_GetCodeQLDatabase(t *testing.T) { } want := &CodeQLDatabase{ - ID: Ptr(int64(1)), - Name: Ptr("name"), - Language: Ptr("language"), + ID: new(int64(1)), + Name: new("name"), + Language: new("language"), Uploader: &User{ - Login: Ptr("a"), - ID: Ptr(int64(1)), - NodeID: Ptr("b"), - AvatarURL: Ptr("c"), - GravatarID: Ptr("d"), - URL: Ptr("e"), - HTMLURL: Ptr("f"), - FollowersURL: Ptr("g"), - FollowingURL: Ptr("h"), - GistsURL: Ptr("i"), - StarredURL: Ptr("j"), - SubscriptionsURL: Ptr("k"), - OrganizationsURL: Ptr("l"), - ReposURL: Ptr("m"), - EventsURL: Ptr("n"), - ReceivedEventsURL: Ptr("o"), - Type: Ptr("p"), - SiteAdmin: Ptr(false), + Login: new("a"), + ID: new(int64(1)), + NodeID: new("b"), + AvatarURL: new("c"), + GravatarID: new("d"), + URL: new("e"), + HTMLURL: new("f"), + FollowersURL: new("g"), + FollowingURL: new("h"), + GistsURL: new("i"), + StarredURL: new("j"), + SubscriptionsURL: new("k"), + OrganizationsURL: new("l"), + ReposURL: new("m"), + EventsURL: new("n"), + ReceivedEventsURL: new("o"), + Type: new("p"), + SiteAdmin: new(false), }, - ContentType: Ptr("r"), - Size: Ptr(int64(1024)), + ContentType: new("r"), + Size: new(int64(1024)), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - URL: Ptr("s"), + URL: new("s"), } if !cmp.Equal(database, want) { @@ -1447,9 +1447,9 @@ func TestCodeScanningService_GetDefaultSetupConfiguration(t *testing.T) { } want := &DefaultSetupConfiguration{ - State: Ptr("configured"), + State: new("configured"), Languages: []string{"javascript", "javascript-typescript", "typescript"}, - QuerySuite: Ptr("default"), + QuerySuite: new("default"), UpdatedAt: &referenceTimestamp, } if !cmp.Equal(cfg, want) { @@ -1490,7 +1490,7 @@ func TestCodeScanningService_UpdateDefaultSetupConfiguration(t *testing.T) { options := &UpdateDefaultSetupConfigurationOptions{ State: "configured", Languages: []string{"go"}, - QuerySuite: Ptr("default"), + QuerySuite: new("default"), } got, _, err := client.CodeScanning.UpdateDefaultSetupConfiguration(ctx, "o", "r", options) if err != nil { @@ -1498,8 +1498,8 @@ func TestCodeScanningService_UpdateDefaultSetupConfiguration(t *testing.T) { } want := &UpdateDefaultSetupConfigurationResponse{ - RunID: Ptr(int64(5301214200)), - RunURL: Ptr("https://api.github.com/repos/o/r/actions/runs/5301214200"), + RunID: new(int64(5301214200)), + RunURL: new("https://api.github.com/repos/o/r/actions/runs/5301214200"), } if !cmp.Equal(got, want) { t.Errorf("CodeScanning.UpdateDefaultSetupConfiguration returned %+v, want %+v", got, want) diff --git a/github/codesofconduct_test.go b/github/codesofconduct_test.go index 281eb8d5749..f8598a622ba 100644 --- a/github/codesofconduct_test.go +++ b/github/codesofconduct_test.go @@ -33,9 +33,9 @@ func TestCodesOfConductService_List(t *testing.T) { want := []*CodeOfConduct{ { - Key: Ptr("key"), - Name: Ptr("name"), - URL: Ptr("url"), + Key: new("key"), + Name: new("name"), + URL: new("url"), }, } if !cmp.Equal(want, cs) { @@ -72,10 +72,10 @@ func TestCodesOfConductService_Get(t *testing.T) { assertNilError(t, err) want := &CodeOfConduct{ - Key: Ptr("key"), - Name: Ptr("name"), - URL: Ptr("url"), - Body: Ptr("body"), + Key: new("key"), + Name: new("name"), + URL: new("url"), + Body: new("body"), } if !cmp.Equal(want, coc) { t.Errorf("returned %+v, want %+v", coc, want) diff --git a/github/codespaces_machines_test.go b/github/codespaces_machines_test.go index d413d168b93..1dd422ec70c 100644 --- a/github/codespaces_machines_test.go +++ b/github/codespaces_machines_test.go @@ -42,9 +42,9 @@ func TestCodespacesService_ListRepositoryMachineTypes(t *testing.T) { ctx := t.Context() opts := &ListRepoMachineTypesOptions{ - Ref: Ptr("main"), - Location: Ptr("WestUs2"), - ClientIP: Ptr("1.2.3.4"), + Ref: new("main"), + Location: new("WestUs2"), + ClientIP: new("1.2.3.4"), } got, _, err := client.Codespaces.ListRepositoryMachineTypes( @@ -61,13 +61,13 @@ func TestCodespacesService_ListRepositoryMachineTypes(t *testing.T) { TotalCount: 1, Machines: []*CodespacesMachine{ { - Name: Ptr("standardLinux"), - DisplayName: Ptr("4 cores, 8 GB RAM, 64 GB storage"), - OperatingSystem: Ptr("linux"), - StorageInBytes: Ptr(int64(68719476736)), - MemoryInBytes: Ptr(int64(17179869184)), - CPUs: Ptr(4), - PrebuildAvailability: Ptr("ready"), + Name: new("standardLinux"), + DisplayName: new("4 cores, 8 GB RAM, 64 GB storage"), + OperatingSystem: new("linux"), + StorageInBytes: new(int64(68719476736)), + MemoryInBytes: new(int64(17179869184)), + CPUs: new(4), + PrebuildAvailability: new("ready"), }, }, } @@ -123,13 +123,13 @@ func TestCodespacesService_ListCodespaceMachineTypes(t *testing.T) { TotalCount: 1, Machines: []*CodespacesMachine{ { - Name: Ptr("standardLinux"), - DisplayName: Ptr("4 cores, 8 GB RAM, 64 GB storage"), - OperatingSystem: Ptr("linux"), - StorageInBytes: Ptr(int64(68719476736)), - MemoryInBytes: Ptr(int64(17179869184)), - CPUs: Ptr(4), - PrebuildAvailability: Ptr("ready"), + Name: new("standardLinux"), + DisplayName: new("4 cores, 8 GB RAM, 64 GB storage"), + OperatingSystem: new("linux"), + StorageInBytes: new(int64(68719476736)), + MemoryInBytes: new(int64(17179869184)), + CPUs: new(4), + PrebuildAvailability: new("ready"), }, }, } diff --git a/github/codespaces_orgs_test.go b/github/codespaces_orgs_test.go index f0661628eb2..fa18acbdc88 100644 --- a/github/codespaces_orgs_test.go +++ b/github/codespaces_orgs_test.go @@ -30,9 +30,9 @@ func TestCodespacesService_ListInOrg(t *testing.T) { } want := &ListCodespaces{ - TotalCount: Ptr(1), + TotalCount: new(1), Codespaces: []*Codespace{ - {ID: Ptr(int64(1))}, + {ID: new(int64(1))}, }, } @@ -171,9 +171,9 @@ func TestCodespacesService_ListUserCodespacesInOrg(t *testing.T) { } want := &ListCodespaces{ - TotalCount: Ptr(1), + TotalCount: new(1), Codespaces: []*Codespace{ - {ID: Ptr(int64(1))}, + {ID: new(int64(1))}, }, } diff --git a/github/codespaces_secrets_test.go b/github/codespaces_secrets_test.go index d495b7003d5..7ed53c41daa 100644 --- a/github/codespaces_secrets_test.go +++ b/github/codespaces_secrets_test.go @@ -466,7 +466,7 @@ func TestCodespacesService_GetPublicKey(t *testing.T) { t.Errorf("Codespaces.%v returned error: %v", tt.methodName, err) } - want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Codespaces.%v returned %+v, want %+v", tt.methodName, key, want) } @@ -545,9 +545,9 @@ func TestCodespacesService_ListSelectedReposForSecret(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Ptr(1), + TotalCount: new(1), Repositories: []*Repository{ - {ID: Ptr(int64(1))}, + {ID: new(int64(1))}, }, } @@ -659,7 +659,7 @@ func TestCodespacesService_AddSelectedReposForSecret(t *testing.T) { badCall func(context.Context, *Client) (*Response, error) methodName string } - repo := &Repository{ID: Ptr(int64(1234))} + repo := &Repository{ID: new(int64(1234))} tests := []*test{ { name: "User", @@ -729,7 +729,7 @@ func TestCodespacesService_RemoveSelectedReposFromSecret(t *testing.T) { badCall func(context.Context, *Client) (*Response, error) methodName string } - repo := &Repository{ID: Ptr(int64(1234))} + repo := &Repository{ID: new(int64(1234))} tests := []*test{ { name: "User", diff --git a/github/codespaces_test.go b/github/codespaces_test.go index 7be8eb434f8..709de4bc6ec 100644 --- a/github/codespaces_test.go +++ b/github/codespaces_test.go @@ -33,55 +33,55 @@ func TestCodespacesService_ListInRepo(t *testing.T) { t.Errorf("Codespaces.ListInRepo returned error: %v", err) } - want := &ListCodespaces{TotalCount: Ptr(2), Codespaces: []*Codespace{ + want := &ListCodespaces{TotalCount: new(2), Codespaces: []*Codespace{ { - ID: Ptr(int64(1)), - Name: Ptr("monalisa-octocat-hello-world-g4wpq6h95q"), - EnvironmentID: Ptr("26a7c758-7299-4a73-b978-5a92a7ae98a0"), + ID: new(int64(1)), + Name: new("monalisa-octocat-hello-world-g4wpq6h95q"), + EnvironmentID: new("26a7c758-7299-4a73-b978-5a92a7ae98a0"), Owner: &User{ - Login: Ptr("octocat"), + Login: new("octocat"), }, BillableOwner: &User{ - Login: Ptr("octocat"), + Login: new("octocat"), }, Repository: &Repository{ - ID: Ptr(int64(1296269)), + ID: new(int64(1296269)), }, Machine: &CodespacesMachine{ - Name: Ptr("standardLinux"), - DisplayName: Ptr("4 cores, 8 GB RAM, 64 GB storage"), - OperatingSystem: Ptr("linux"), - StorageInBytes: Ptr(int64(68719476736)), - MemoryInBytes: Ptr(int64(8589934592)), - CPUs: Ptr(4), + Name: new("standardLinux"), + DisplayName: new("4 cores, 8 GB RAM, 64 GB storage"), + OperatingSystem: new("linux"), + StorageInBytes: new(int64(68719476736)), + MemoryInBytes: new(int64(8589934592)), + CPUs: new(4), }, - Prebuild: Ptr(false), - DevcontainerPath: Ptr(".devcontainer/devcontainer.json"), + Prebuild: new(false), + DevcontainerPath: new(".devcontainer/devcontainer.json"), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), LastUsedAt: refTimestamp(1136178002), - State: Ptr("Available"), - URL: Ptr("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q"), + State: new("Available"), + URL: new("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q"), GitStatus: &CodespacesGitStatus{ - Ahead: Ptr(0), - Behind: Ptr(0), - HasUnpushedChanges: Ptr(false), - HasUncommittedChanges: Ptr(false), - Ref: Ptr("main"), + Ahead: new(0), + Behind: new(0), + HasUnpushedChanges: new(false), + HasUncommittedChanges: new(false), + Ref: new("main"), }, - Location: Ptr("WestUs2"), - IdleTimeoutMinutes: Ptr(60), - WebURL: Ptr("https://monalisa-octocat-hello-world-g4wpq6h95q.github.dev"), - MachinesURL: Ptr("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/machines"), - StartURL: Ptr("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/start"), - StopURL: Ptr("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/stop"), + Location: new("WestUs2"), + IdleTimeoutMinutes: new(60), + WebURL: new("https://monalisa-octocat-hello-world-g4wpq6h95q.github.dev"), + MachinesURL: new("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/machines"), + StartURL: new("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/start"), + StopURL: new("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/stop"), RecentFolders: []string{ "testfolder1", "testfolder2", }, }, { - ID: Ptr(int64(2)), + ID: new(int64(2)), }, }} if !cmp.Equal(codespaces, want) { @@ -119,11 +119,11 @@ func TestCodespacesService_List(t *testing.T) { t.Errorf("Codespaces.List returned error: %v", err) } - want := &ListCodespaces{TotalCount: Ptr(1), Codespaces: []*Codespace{ + want := &ListCodespaces{TotalCount: new(1), Codespaces: []*Codespace{ { - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(1296269)), + ID: new(int64(1296269)), }, }, }} @@ -146,10 +146,10 @@ func TestCodespacesService_CreateInRepo(t *testing.T) { client, mux, _ := setup(t) input := &CreateCodespaceOptions{ - Ref: Ptr("main"), - Geo: Ptr("WestUs2"), - Machine: Ptr("standardLinux"), - IdleTimeoutMinutes: Ptr(60), + Ref: new("main"), + Geo: new("WestUs2"), + Machine: new("standardLinux"), + IdleTimeoutMinutes: new(60), } mux.HandleFunc("/repos/owner/repo/codespaces", func(w http.ResponseWriter, r *http.Request) { @@ -165,9 +165,9 @@ func TestCodespacesService_CreateInRepo(t *testing.T) { t.Errorf("Codespaces.CreateInRepo returned error: %v", err) } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(1296269)), + ID: new(int64(1296269)), }, } @@ -204,9 +204,9 @@ func TestCodespacesService_Start(t *testing.T) { t.Errorf("Codespaces.Start returned error: %v", err) } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(1296269)), + ID: new(int64(1296269)), }, } @@ -243,9 +243,9 @@ func TestCodespacesService_Stop(t *testing.T) { t.Errorf("Codespaces.Stop returned error: %v", err) } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(1296269)), + ID: new(int64(1296269)), }, } @@ -322,8 +322,8 @@ func TestCodespacesService_ListDevContainerConfigurations(t *testing.T) { Devcontainers: []*DevContainer{ { Path: ".devcontainer/foobar/devcontainer.json", - Name: Ptr("foobar"), - DisplayName: Ptr("foobar"), + Name: new("foobar"), + DisplayName: new("foobar"), }, }, } @@ -370,8 +370,8 @@ func TestCodespacesService_GetDefaultAttributes(t *testing.T) { ctx := t.Context() opt := &CodespaceGetDefaultAttributesOptions{ - Ref: Ptr("main"), - ClientIP: Ptr("1.2.3.4"), + Ref: new("main"), + ClientIP: new("1.2.3.4"), } got, _, err := client.Codespaces.GetDefaultAttributes(ctx, "o", "r", opt) @@ -381,12 +381,12 @@ func TestCodespacesService_GetDefaultAttributes(t *testing.T) { want := &CodespaceDefaultAttributes{ BillableOwner: &User{ - Login: Ptr("user1"), - ID: Ptr(int64(1001)), - URL: Ptr("https://example.com/user1"), + Login: new("user1"), + ID: new(int64(1001)), + URL: new("https://example.com/user1"), }, Defaults: &CodespaceDefaults{ - DevcontainerPath: Ptr(".devcontainer/devcontainer.json"), + DevcontainerPath: new(".devcontainer/devcontainer.json"), Location: "WestUs2", }, } @@ -452,8 +452,8 @@ func TestCodespacesService_CreateFromPullRequest(t *testing.T) { client, mux, _ := setup(t) input := &CreateCodespaceOptions{ - Machine: Ptr("standardLinux"), - IdleTimeoutMinutes: Ptr(60), + Machine: new("standardLinux"), + IdleTimeoutMinutes: new(60), } mux.HandleFunc("/repos/owner/repo/pulls/42/codespaces", func(w http.ResponseWriter, r *http.Request) { @@ -468,9 +468,9 @@ func TestCodespacesService_CreateFromPullRequest(t *testing.T) { t.Errorf("Codespaces.CreateFromPullRequest returned error: %v", err) } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(1)), + ID: new(int64(1)), }, } @@ -498,10 +498,10 @@ func TestCodespacesService_Create(t *testing.T) { client, mux, _ := setup(t) opt := &CodespaceCreateForUserOptions{ - Ref: Ptr("main"), - Geo: Ptr("WestUs2"), - Machine: Ptr("standardLinux"), - IdleTimeoutMinutes: Ptr(60), + Ref: new("main"), + Geo: new("WestUs2"), + Machine: new("standardLinux"), + IdleTimeoutMinutes: new(60), RepositoryID: int64(111), PullRequest: nil, } @@ -522,9 +522,9 @@ func TestCodespacesService_Create(t *testing.T) { } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(111)), + ID: new(int64(111)), }, } @@ -561,9 +561,9 @@ func TestCodespacesService_Get(t *testing.T) { } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(111)), + ID: new(int64(111)), }, } @@ -586,7 +586,7 @@ func TestCodespacesService_Update(t *testing.T) { client, mux, _ := setup(t) opt := &UpdateCodespaceOptions{ - Machine: Ptr("standardLinux"), + Machine: new("standardLinux"), RecentFolders: []string{ "folder1", "folder2", @@ -610,9 +610,9 @@ func TestCodespacesService_Update(t *testing.T) { } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(111)), + ID: new(int64(111)), }, } @@ -655,10 +655,10 @@ func TestCodespacesService_ExportCodespace(t *testing.T) { } want := &CodespaceExport{ - State: Ptr("succeeded"), + State: new("succeeded"), CompletedAt: &referenceTimestamp, - Branch: Ptr("main"), - ExportURL: Ptr("https://api.github.com/user/codespaces/:name/exports/latest"), + Branch: new("main"), + ExportURL: new("https://api.github.com/user/codespaces/:name/exports/latest"), } if !cmp.Equal(export, want) { @@ -696,10 +696,10 @@ func TestCodespacesService_GetLatestCodespaceExport(t *testing.T) { } want := &CodespaceExport{ - State: Ptr("succeeded"), + State: new("succeeded"), CompletedAt: &referenceTimestamp, - Branch: Ptr("main"), - ExportURL: Ptr("https://api.github.com/user/codespaces/:name/exports/latest"), + Branch: new("main"), + ExportURL: new("https://api.github.com/user/codespaces/:name/exports/latest"), } if !cmp.Equal(export, want) { @@ -721,8 +721,8 @@ func TestCodespacesService_Publish(t *testing.T) { client, mux, _ := setup(t) opt := &PublishCodespaceOptions{ - Name: Ptr("repo"), - Private: Ptr(true), + Name: new("repo"), + Private: new(true), } mux.HandleFunc("/user/codespaces/codespace_1/publish", func(w http.ResponseWriter, r *http.Request) { @@ -742,9 +742,9 @@ func TestCodespacesService_Publish(t *testing.T) { } want := &Codespace{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repository: &Repository{ - ID: Ptr(int64(111)), + ID: new(int64(111)), }, } if !cmp.Equal(repo, want) { diff --git a/github/copilot_test.go b/github/copilot_test.go index fae2e446da8..9fd71a41422 100644 --- a/github/copilot_test.go +++ b/github/copilot_test.go @@ -154,8 +154,8 @@ func TestCopilotService_GetSeatDetailsUser(t *testing.T) { } want := &User{ - ID: Ptr(int64(1)), - Type: Ptr("User"), + ID: new(int64(1)), + Type: new("User"), } if got, ok := seatDetails.GetUser(); ok && !cmp.Equal(got, want) { @@ -172,8 +172,8 @@ func TestCopilotService_GetSeatDetailsUser(t *testing.T) { }` bad := &Organization{ - ID: Ptr(int64(1)), - Type: Ptr("Organization"), + ID: new(int64(1)), + Type: new("Organization"), } err = json.Unmarshal([]byte(data), seatDetails) @@ -203,8 +203,8 @@ func TestCopilotService_GetSeatDetailsTeam(t *testing.T) { } want := &Team{ - ID: Ptr(int64(1)), - Type: Ptr("Team"), + ID: new(int64(1)), + Type: new("Team"), } if got, ok := seatDetails.GetTeam(); ok && !cmp.Equal(got, want) { @@ -221,8 +221,8 @@ func TestCopilotService_GetSeatDetailsTeam(t *testing.T) { }` bad := &User{ - ID: Ptr(int64(1)), - Type: Ptr("User"), + ID: new(int64(1)), + Type: new("User"), } err = json.Unmarshal([]byte(data), seatDetails) @@ -252,8 +252,8 @@ func TestCopilotService_GetSeatDetailsOrganization(t *testing.T) { } want := &Organization{ - ID: Ptr(int64(1)), - Type: Ptr("Organization"), + ID: new(int64(1)), + Type: new("Organization"), } if got, ok := seatDetails.GetOrganization(); ok && !cmp.Equal(got, want) { @@ -270,7 +270,7 @@ func TestCopilotService_GetSeatDetailsOrganization(t *testing.T) { }` bad := &Team{ - ID: Ptr(int64(1)), + ID: new(int64(1)), } err = json.Unmarshal([]byte(data), seatDetails) @@ -464,38 +464,38 @@ func TestCopilotService_ListCopilotSeats(t *testing.T) { Seats: []*CopilotSeatDetails{ { Assignee: &User{ - Login: Ptr("octocat"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VXNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/octocat_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/octocat"), - HTMLURL: Ptr("https://github.com/octocat"), - FollowersURL: Ptr("https://api.github.com/users/octocat/followers"), - FollowingURL: Ptr("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/octocat/orgs"), - ReposURL: Ptr("https://api.github.com/users/octocat/repos"), - EventsURL: Ptr("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/octocat/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("octocat"), + ID: new(int64(1)), + NodeID: new("MDQ6VXNlcjE="), + AvatarURL: new("https://github.com/images/error/octocat_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/octocat"), + HTMLURL: new("https://github.com/octocat"), + FollowersURL: new("https://api.github.com/users/octocat/followers"), + FollowingURL: new("https://api.github.com/users/octocat/following{/other_user}"), + GistsURL: new("https://api.github.com/users/octocat/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/octocat/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/octocat/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/octocat/orgs"), + ReposURL: new("https://api.github.com/users/octocat/repos"), + EventsURL: new("https://api.github.com/users/octocat/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/octocat/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, AssigningTeam: &Team{ - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VGVhbTE="), - URL: Ptr("https://api.github.com/teams/1"), - HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), - Name: Ptr("Justice League"), - Slug: Ptr("justice-league"), - Description: Ptr("A great team."), - Privacy: Ptr("closed"), - Permission: Ptr("admin"), - NotificationSetting: Ptr("notifications_enabled"), - MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), + ID: new(int64(1)), + NodeID: new("MDQ6VGVhbTE="), + URL: new("https://api.github.com/teams/1"), + HTMLURL: new("https://github.com/orgs/github/teams/justice-league"), + Name: new("Justice League"), + Slug: new("justice-league"), + Description: new("A great team."), + Privacy: new("closed"), + Permission: new("admin"), + NotificationSetting: new("notifications_enabled"), + MembersURL: new("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: new("https://api.github.com/teams/1/repos"), Parent: nil, }, @@ -503,61 +503,61 @@ func TestCopilotService_ListCopilotSeats(t *testing.T) { UpdatedAt: refTimestamp(1136178001), PendingCancellationDate: nil, LastActivityAt: refTimestamp(1136178002), - LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: new("vscode/1.77.3/copilot/1.86.82"), }, { Assignee: &User{ - Login: Ptr("octokitten"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ76VNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/octokitten_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/octokitten"), - HTMLURL: Ptr("https://github.com/octokitten"), - FollowersURL: Ptr("https://api.github.com/users/octokitten/followers"), - FollowingURL: Ptr("https://api.github.com/users/octokitten/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/octokitten/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/octokitten/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/octokitten/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/octokitten/orgs"), - ReposURL: Ptr("https://api.github.com/users/octokitten/repos"), - EventsURL: Ptr("https://api.github.com/users/octokitten/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/octokitten/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("octokitten"), + ID: new(int64(1)), + NodeID: new("MDQ76VNlcjE="), + AvatarURL: new("https://github.com/images/error/octokitten_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/octokitten"), + HTMLURL: new("https://github.com/octokitten"), + FollowersURL: new("https://api.github.com/users/octokitten/followers"), + FollowingURL: new("https://api.github.com/users/octokitten/following{/other_user}"), + GistsURL: new("https://api.github.com/users/octokitten/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/octokitten/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/octokitten/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/octokitten/orgs"), + ReposURL: new("https://api.github.com/users/octokitten/repos"), + EventsURL: new("https://api.github.com/users/octokitten/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/octokitten/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, AssigningTeam: nil, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - PendingCancellationDate: Ptr("2021-11-01"), + PendingCancellationDate: new("2021-11-01"), LastActivityAt: refTimestamp(1136178002), - LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: new("vscode/1.77.3/copilot/1.86.82"), }, { Assignee: &Team{ - ID: Ptr(int64(1)), - Name: Ptr("octokittens"), - Type: Ptr("Team"), + ID: new(int64(1)), + Name: new("octokittens"), + Type: new("Team"), }, AssigningTeam: nil, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - PendingCancellationDate: Ptr("2021-11-01"), + PendingCancellationDate: new("2021-11-01"), LastActivityAt: refTimestamp(1136178002), - LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: new("vscode/1.77.3/copilot/1.86.82"), }, { Assignee: &Organization{ - ID: Ptr(int64(1)), - Name: Ptr("octocats"), - Type: Ptr("Organization"), + ID: new(int64(1)), + Name: new("octocats"), + Type: new("Organization"), }, AssigningTeam: nil, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - PendingCancellationDate: Ptr("2021-11-01"), + PendingCancellationDate: new("2021-11-01"), LastActivityAt: refTimestamp(1136178002), - LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: new("vscode/1.77.3/copilot/1.86.82"), }, }, } @@ -679,74 +679,74 @@ func TestCopilotService_ListCopilotEnterpriseSeats(t *testing.T) { Seats: []*CopilotSeatDetails{ { Assignee: &User{ - Login: Ptr("octocat"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VXNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/octocat_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/octocat"), - HTMLURL: Ptr("https://github.com/octocat"), - FollowersURL: Ptr("https://api.github.com/users/octocat/followers"), - FollowingURL: Ptr("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/octocat/orgs"), - ReposURL: Ptr("https://api.github.com/users/octocat/repos"), - EventsURL: Ptr("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/octocat/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("octocat"), + ID: new(int64(1)), + NodeID: new("MDQ6VXNlcjE="), + AvatarURL: new("https://github.com/images/error/octocat_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/octocat"), + HTMLURL: new("https://github.com/octocat"), + FollowersURL: new("https://api.github.com/users/octocat/followers"), + FollowingURL: new("https://api.github.com/users/octocat/following{/other_user}"), + GistsURL: new("https://api.github.com/users/octocat/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/octocat/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/octocat/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/octocat/orgs"), + ReposURL: new("https://api.github.com/users/octocat/repos"), + EventsURL: new("https://api.github.com/users/octocat/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/octocat/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, AssigningTeam: &Team{ - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VGVhbTE="), - URL: Ptr("https://api.github.com/teams/1"), - HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), - Name: Ptr("Justice League"), - Slug: Ptr("justice-league"), - Description: Ptr("A great team."), - Privacy: Ptr("closed"), - NotificationSetting: Ptr("notifications_enabled"), - Permission: Ptr("admin"), - MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), + ID: new(int64(1)), + NodeID: new("MDQ6VGVhbTE="), + URL: new("https://api.github.com/teams/1"), + HTMLURL: new("https://github.com/orgs/github/teams/justice-league"), + Name: new("Justice League"), + Slug: new("justice-league"), + Description: new("A great team."), + Privacy: new("closed"), + NotificationSetting: new("notifications_enabled"), + Permission: new("admin"), + MembersURL: new("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: new("https://api.github.com/teams/1/repos"), Parent: nil, }, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), PendingCancellationDate: nil, LastActivityAt: refTimestamp(1136178002), - LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), - PlanType: Ptr("business"), + LastActivityEditor: new("vscode/1.77.3/copilot/1.86.82"), + PlanType: new("business"), }, { Assignee: &User{ - Login: Ptr("octokitten"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ76VNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/octokitten_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/octokitten"), - HTMLURL: Ptr("https://github.com/octokitten"), - FollowersURL: Ptr("https://api.github.com/users/octokitten/followers"), - FollowingURL: Ptr("https://api.github.com/users/octokitten/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/octokitten/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/octokitten/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/octokitten/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/octokitten/orgs"), - ReposURL: Ptr("https://api.github.com/users/octokitten/repos"), - EventsURL: Ptr("https://api.github.com/users/octokitten/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/octokitten/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("octokitten"), + ID: new(int64(1)), + NodeID: new("MDQ76VNlcjE="), + AvatarURL: new("https://github.com/images/error/octokitten_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/octokitten"), + HTMLURL: new("https://github.com/octokitten"), + FollowersURL: new("https://api.github.com/users/octokitten/followers"), + FollowingURL: new("https://api.github.com/users/octokitten/following{/other_user}"), + GistsURL: new("https://api.github.com/users/octokitten/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/octokitten/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/octokitten/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/octokitten/orgs"), + ReposURL: new("https://api.github.com/users/octokitten/repos"), + EventsURL: new("https://api.github.com/users/octokitten/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/octokitten/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, AssigningTeam: nil, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - PendingCancellationDate: Ptr("2021-11-01"), + PendingCancellationDate: new("2021-11-01"), LastActivityAt: refTimestamp(1136178002), - LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: new("vscode/1.77.3/copilot/1.86.82"), PlanType: nil, }, }, @@ -803,8 +803,8 @@ func TestCopilotService_ListOrganizationCodingAgentRepositories(t *testing.T) { want := &ListOrganizationCopilotCodingAgentRepositoriesResponse{ TotalCount: 2, Repositories: []*Repository{ - {ID: Ptr(int64(1)), Name: Ptr("Hello-World"), FullName: Ptr("octocat/Hello-World")}, - {ID: Ptr(int64(2)), Name: Ptr("Hello-World-2"), FullName: Ptr("octocat/Hello-World-2")}, + {ID: new(int64(1)), Name: new("Hello-World"), FullName: new("octocat/Hello-World")}, + {ID: new(int64(2)), Name: new("Hello-World-2"), FullName: new("octocat/Hello-World-2")}, }, } if !cmp.Equal(got, want) { @@ -1103,45 +1103,45 @@ func TestCopilotService_GetSeatDetails(t *testing.T) { want := &CopilotSeatDetails{ Assignee: &User{ - Login: Ptr("octocat"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VXNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/octocat_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/octocat"), - HTMLURL: Ptr("https://github.com/octocat"), - FollowersURL: Ptr("https://api.github.com/users/octocat/followers"), - FollowingURL: Ptr("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/octocat/orgs"), - ReposURL: Ptr("https://api.github.com/users/octocat/repos"), - EventsURL: Ptr("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/octocat/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("octocat"), + ID: new(int64(1)), + NodeID: new("MDQ6VXNlcjE="), + AvatarURL: new("https://github.com/images/error/octocat_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/octocat"), + HTMLURL: new("https://github.com/octocat"), + FollowersURL: new("https://api.github.com/users/octocat/followers"), + FollowingURL: new("https://api.github.com/users/octocat/following{/other_user}"), + GistsURL: new("https://api.github.com/users/octocat/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/octocat/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/octocat/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/octocat/orgs"), + ReposURL: new("https://api.github.com/users/octocat/repos"), + EventsURL: new("https://api.github.com/users/octocat/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/octocat/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, AssigningTeam: &Team{ - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VGVhbTE="), - URL: Ptr("https://api.github.com/teams/1"), - HTMLURL: Ptr("https://github.com/orgs/github/teams/justice-league"), - Name: Ptr("Justice League"), - Slug: Ptr("justice-league"), - Description: Ptr("A great team."), - Privacy: Ptr("closed"), - NotificationSetting: Ptr("notifications_enabled"), - Permission: Ptr("admin"), - MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), + ID: new(int64(1)), + NodeID: new("MDQ6VGVhbTE="), + URL: new("https://api.github.com/teams/1"), + HTMLURL: new("https://github.com/orgs/github/teams/justice-league"), + Name: new("Justice League"), + Slug: new("justice-league"), + Description: new("A great team."), + Privacy: new("closed"), + NotificationSetting: new("notifications_enabled"), + Permission: new("admin"), + MembersURL: new("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: new("https://api.github.com/teams/1/repos"), Parent: nil, }, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), PendingCancellationDate: nil, LastActivityAt: refTimestamp(1136178002), - LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: new("vscode/1.77.3/copilot/1.86.82"), } if !cmp.Equal(got, want) { @@ -1334,8 +1334,8 @@ func TestCopilotService_GetEnterpriseMetrics(t *testing.T) { want := []*CopilotMetrics{ { Date: "2024-06-24", - TotalActiveUsers: Ptr(24), - TotalEngagedUsers: Ptr(20), + TotalActiveUsers: new(24), + TotalEngagedUsers: new(20), CopilotIDECodeCompletions: &CopilotIDECodeCompletions{ TotalEngagedUsers: 20, Languages: []*CopilotIDECodeCompletionsLanguage{ @@ -1386,7 +1386,7 @@ func TestCopilotService_GetEnterpriseMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -1429,7 +1429,7 @@ func TestCopilotService_GetEnterpriseMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -1474,7 +1474,7 @@ func TestCopilotService_GetEnterpriseMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, @@ -1675,8 +1675,8 @@ func TestCopilotService_GetEnterpriseTeamMetrics(t *testing.T) { want := []*CopilotMetrics{ { Date: "2024-06-24", - TotalActiveUsers: Ptr(24), - TotalEngagedUsers: Ptr(20), + TotalActiveUsers: new(24), + TotalEngagedUsers: new(20), CopilotIDECodeCompletions: &CopilotIDECodeCompletions{ TotalEngagedUsers: 20, Languages: []*CopilotIDECodeCompletionsLanguage{ @@ -1727,7 +1727,7 @@ func TestCopilotService_GetEnterpriseTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -1770,7 +1770,7 @@ func TestCopilotService_GetEnterpriseTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -1815,7 +1815,7 @@ func TestCopilotService_GetEnterpriseTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, @@ -2016,8 +2016,8 @@ func TestCopilotService_GetOrganizationMetrics(t *testing.T) { want := []*CopilotMetrics{ { Date: "2024-06-24", - TotalActiveUsers: Ptr(24), - TotalEngagedUsers: Ptr(20), + TotalActiveUsers: new(24), + TotalEngagedUsers: new(20), CopilotIDECodeCompletions: &CopilotIDECodeCompletions{ TotalEngagedUsers: 20, Languages: []*CopilotIDECodeCompletionsLanguage{ @@ -2068,7 +2068,7 @@ func TestCopilotService_GetOrganizationMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -2111,7 +2111,7 @@ func TestCopilotService_GetOrganizationMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -2156,7 +2156,7 @@ func TestCopilotService_GetOrganizationMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, @@ -2357,8 +2357,8 @@ func TestCopilotService_GetOrganizationTeamMetrics(t *testing.T) { want := []*CopilotMetrics{ { Date: "2024-06-24", - TotalActiveUsers: Ptr(24), - TotalEngagedUsers: Ptr(20), + TotalActiveUsers: new(24), + TotalEngagedUsers: new(20), CopilotIDECodeCompletions: &CopilotIDECodeCompletions{ TotalEngagedUsers: 20, Languages: []*CopilotIDECodeCompletionsLanguage{ @@ -2409,7 +2409,7 @@ func TestCopilotService_GetOrganizationTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -2452,7 +2452,7 @@ func TestCopilotService_GetOrganizationTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -2497,7 +2497,7 @@ func TestCopilotService_GetOrganizationTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: Ptr("2024-02-01"), + CustomModelTrainingDate: new("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, @@ -2947,8 +2947,8 @@ func TestCopilotService_DownloadCopilotMetrics(t *testing.T) { want := []*CopilotMetrics{ { Date: "2023-01-01", - TotalActiveUsers: Ptr(100), - TotalEngagedUsers: Ptr(50), + TotalActiveUsers: new(100), + TotalEngagedUsers: new(50), CopilotIDECodeCompletions: &CopilotIDECodeCompletions{ TotalEngagedUsers: 50, Languages: []*CopilotIDECodeCompletionsLanguage{ @@ -3095,55 +3095,55 @@ func TestCopilotService_DownloadDailyMetrics(t *testing.T) { want := &CopilotDailyMetrics{ Day: "2026-04-01", - OrganizationID: Ptr("123"), - DailyActiveCLIUsers: Ptr(2), - DailyActiveUsers: Ptr(10), - WeeklyActiveUsers: Ptr(20), - MonthlyActiveUsers: Ptr(30), + OrganizationID: new("123"), + DailyActiveCLIUsers: new(2), + DailyActiveUsers: new(10), + WeeklyActiveUsers: new(20), + MonthlyActiveUsers: new(30), CopilotMetricsChatPanel: CopilotMetricsChatPanel{ - ChatPanelAskMode: Ptr(4), + ChatPanelAskMode: new(4), }, TotalsByIDE: []*CopilotMetricsIDE{ - {IDE: "vscode", UserInitiatedInteractionCount: Ptr(5), CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{LOCAddedSum: Ptr(100)}}, + {IDE: "vscode", UserInitiatedInteractionCount: new(5), CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{LOCAddedSum: new(100)}}, }, TotalsByFeature: []*CopilotMetricsFeature{ - {Feature: "completion", UserInitiatedInteractionCount: Ptr(5)}, - {Feature: "agent_edit", CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{LOCAddedSum: Ptr(7), LOCDeletedSum: Ptr(2)}}, + {Feature: "completion", UserInitiatedInteractionCount: new(5)}, + {Feature: "agent_edit", CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{LOCAddedSum: new(7), LOCDeletedSum: new(2)}}, }, TotalsByLanguageFeature: []*CopilotMetricsLanguageFeature{ - {Language: "go", Feature: "completion", CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{CodeGenerationActivityCount: Ptr(3)}}, + {Language: "go", Feature: "completion", CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{CodeGenerationActivityCount: new(3)}}, }, TotalsByLanguageModel: []*CopilotMetricsLanguageModel{ - {Language: "go", Model: "m1", CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{CodeGenerationActivityCount: Ptr(3)}}, + {Language: "go", Model: "m1", CopilotMetricsCodeActivity: CopilotMetricsCodeActivity{CodeGenerationActivityCount: new(3)}}, }, TotalsByModelFeature: []*CopilotMetricsModelFeature{ - {Model: "m1", Feature: "completion", UserInitiatedInteractionCount: Ptr(5)}, + {Model: "m1", Feature: "completion", UserInitiatedInteractionCount: new(5)}, }, TotalsByCLI: &CopilotMetricsCLI{ - SessionCount: Ptr(3), - RequestCount: Ptr(4), - PromptCount: Ptr(2), + SessionCount: new(3), + RequestCount: new(4), + PromptCount: new(2), TokenUsage: &CopilotMetricsCLITokenUsage{ - AvgTokensPerRequest: Ptr(4123.5), - OutputTokensSum: Ptr(7000), - PromptTokensSum: Ptr(9494), + AvgTokensPerRequest: new(4123.5), + OutputTokensSum: new(7000), + PromptTokensSum: new(9494), }, }, TotalsBy3rdPartyAgent: []*CopilotMetricsThirdPartyAgent{ { AgentName: "Claude", AgentID: "claude", - UserInitiatedInteractionCount: Ptr(8), - SessionCount: Ptr(3), + UserInitiatedInteractionCount: new(8), + SessionCount: new(3), }, }, - LOCAddedSum: Ptr(100), + LOCAddedSum: new(100), PullRequests: &CopilotMetricsPullRequests{ - TotalReviewed: Ptr(1), - TotalCreated: Ptr(2), - MedianMinutesToMerge: Ptr(12.5), - MedianMinutesToMergeCopilotAuthored: Ptr(4.5), - MedianMinutesToMergeCopilotReviewed: Ptr(6.5), + TotalReviewed: new(1), + TotalCreated: new(2), + MedianMinutesToMerge: new(12.5), + MedianMinutesToMergeCopilotAuthored: new(4.5), + MedianMinutesToMergeCopilotReviewed: new(6.5), }, } @@ -3224,30 +3224,30 @@ func TestCopilotService_DownloadPeriodicMetrics(t *testing.T) { want := &CopilotPeriodicMetrics{ ReportStartDay: "2026-03-05", ReportEndDay: "2026-04-01", - OrganizationID: Ptr("123"), + OrganizationID: new("123"), CreatedAt: refTimestamp(1136178000), DayTotals: []*CopilotDailyMetrics{ { Day: "2026-03-05", - DailyActiveCLIUsers: Ptr(2), - DailyActiveUsers: Ptr(5), + DailyActiveCLIUsers: new(2), + DailyActiveUsers: new(5), TotalsByCLI: &CopilotMetricsCLI{ - SessionCount: Ptr(1), - RequestCount: Ptr(2), - PromptCount: Ptr(1), + SessionCount: new(1), + RequestCount: new(2), + PromptCount: new(1), TokenUsage: &CopilotMetricsCLITokenUsage{ - AvgTokensPerRequest: Ptr(4000.0), - OutputTokensSum: Ptr(5000), - PromptTokensSum: Ptr(3000), + AvgTokensPerRequest: new(4000.0), + OutputTokensSum: new(5000), + PromptTokensSum: new(3000), }, }, PullRequests: &CopilotMetricsPullRequests{ - MedianMinutesToMerge: Ptr(8.5), - MedianMinutesToMergeCopilotAuthored: Ptr(5.0), - MedianMinutesToMergeCopilotReviewed: Ptr(7.0), + MedianMinutesToMerge: new(8.5), + MedianMinutesToMergeCopilotAuthored: new(5.0), + MedianMinutesToMergeCopilotReviewed: new(7.0), }, }, - {Day: "2026-03-06", DailyActiveUsers: Ptr(7)}, + {Day: "2026-03-06", DailyActiveUsers: new(7)}, }, } @@ -3304,17 +3304,17 @@ func TestCopilotService_DownloadUserDailyMetrics(t *testing.T) { UserID: 1, UserLogin: "alice", Day: "2026-04-01", - UserInitiatedInteractionCount: Ptr(5), + UserInitiatedInteractionCount: new(5), CopilotMetricsChatPanel: CopilotMetricsChatPanel{ - ChatPanelEditMode: Ptr(2), + ChatPanelEditMode: new(2), }, - UsedChat: Ptr(true), - UsedCLI: Ptr(true), - UsedCopilotCodeReviewActive: Ptr(true), + UsedChat: new(true), + UsedCLI: new(true), + UsedCopilotCodeReviewActive: new(true), TotalsByCLI: &CopilotMetricsCLI{ - SessionCount: Ptr(2), - RequestCount: Ptr(2), - PromptCount: Ptr(1), + SessionCount: new(2), + RequestCount: new(2), + PromptCount: new(1), LastKnownCLIVersion: &CopilotMetricsCLIVersion{ SampledAt: refTimestamp(1136178000), CLIVersion: "1.0.8", @@ -3323,7 +3323,7 @@ func TestCopilotService_DownloadUserDailyMetrics(t *testing.T) { TotalsByIDE: []*CopilotUserMetricsIDE{ { IDE: "vscode", - UserInitiatedInteractionCount: Ptr(5), + UserInitiatedInteractionCount: new(5), LastKnownPluginVersion: &CopilotUserMetricsPluginVersion{ SampledAt: refTimestamp(1136178001), Plugin: "copilot", @@ -3339,7 +3339,7 @@ func TestCopilotService_DownloadUserDailyMetrics(t *testing.T) { { AgentName: "Claude", AgentID: "claude", - UserInitiatedInteractionCount: Ptr(2), + UserInitiatedInteractionCount: new(2), }, }, }, @@ -3347,8 +3347,8 @@ func TestCopilotService_DownloadUserDailyMetrics(t *testing.T) { UserID: 2, UserLogin: "bob", Day: "2026-04-01", - UsedAgent: Ptr(true), - UsedCopilotCodeReviewPassive: Ptr(true), + UsedAgent: new(true), + UsedCopilotCodeReviewPassive: new(true), }, } @@ -3420,8 +3420,8 @@ func TestCopilotService_DownloadUserPeriodicMetrics(t *testing.T) { Day: "2026-03-05", UserID: 1, UserLogin: "alice", - UserInitiatedInteractionCount: Ptr(3), - UsedCopilotCodeReviewActive: Ptr(true), + UserInitiatedInteractionCount: new(3), + UsedCopilotCodeReviewActive: new(true), }, { ReportStartDay: "2026-03-05", @@ -3429,17 +3429,17 @@ func TestCopilotService_DownloadUserPeriodicMetrics(t *testing.T) { Day: "2026-03-06", UserID: 1, UserLogin: "alice", - UsedCLI: Ptr(true), - UsedCopilotCodeReviewPassive: Ptr(true), - UsedCopilotCodingAgent: Ptr(true), + UsedCLI: new(true), + UsedCopilotCodeReviewPassive: new(true), + UsedCopilotCodingAgent: new(true), TotalsByCLI: &CopilotMetricsCLI{ - SessionCount: Ptr(1), - RequestCount: Ptr(3), - PromptCount: Ptr(2), + SessionCount: new(1), + RequestCount: new(3), + PromptCount: new(2), TokenUsage: &CopilotMetricsCLITokenUsage{ - AvgTokensPerRequest: Ptr(1200.5), - OutputTokensSum: Ptr(2400), - PromptTokensSum: Ptr(1201), + AvgTokensPerRequest: new(1200.5), + OutputTokensSum: new(2400), + PromptTokensSum: new(1201), }, }, }, diff --git a/github/dependabot_alerts_test.go b/github/dependabot_alerts_test.go index d5f09ec8e88..7406e9217f6 100644 --- a/github/dependabot_alerts_test.go +++ b/github/dependabot_alerts_test.go @@ -23,7 +23,7 @@ func TestDependabotService_ListRepoAlerts(t *testing.T) { fmt.Fprint(w, `[{"number":1,"state":"open"},{"number":42,"state":"fixed"}]`) }) - opts := &ListAlertsOptions{State: Ptr("open")} + opts := &ListAlertsOptions{State: new("open")} ctx := t.Context() alerts, _, err := client.Dependabot.ListRepoAlerts(ctx, "o", "r", opts) if err != nil { @@ -31,8 +31,8 @@ func TestDependabotService_ListRepoAlerts(t *testing.T) { } want := []*DependabotAlert{ - {Number: Ptr(1), State: Ptr("open")}, - {Number: Ptr(42), State: Ptr("fixed")}, + {Number: new(1), State: new("open")}, + {Number: new(42), State: new("fixed")}, } if !cmp.Equal(alerts, want) { t.Errorf("Dependabot.ListRepoAlerts returned %+v, want %+v", alerts, want) @@ -69,8 +69,8 @@ func TestDependabotService_GetRepoAlert(t *testing.T) { } want := &DependabotAlert{ - Number: Ptr(42), - State: Ptr("fixed"), + Number: new(42), + State: new("fixed"), } if !cmp.Equal(alert, want) { t.Errorf("Dependabot.GetRepoAlert returned %+v, want %+v", alert, want) @@ -101,7 +101,7 @@ func TestDependabotService_ListOrgAlerts(t *testing.T) { fmt.Fprint(w, `[{"number":1,"state":"open"},{"number":42,"state":"fixed"}]`) }) - opts := &ListAlertsOptions{State: Ptr("open")} + opts := &ListAlertsOptions{State: new("open")} ctx := t.Context() alerts, _, err := client.Dependabot.ListOrgAlerts(ctx, "o", opts) if err != nil { @@ -109,8 +109,8 @@ func TestDependabotService_ListOrgAlerts(t *testing.T) { } want := []*DependabotAlert{ - {Number: Ptr(1), State: Ptr("open")}, - {Number: Ptr(42), State: Ptr("fixed")}, + {Number: new(1), State: new("open")}, + {Number: new(42), State: new("fixed")}, } if !cmp.Equal(alerts, want) { t.Errorf("Dependabot.ListOrgAlerts returned %+v, want %+v", alerts, want) @@ -135,9 +135,9 @@ func TestDependabotService_UpdateAlert(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - state := Ptr("dismissed") - dismissedReason := Ptr("no_bandwidth") - dismissedComment := Ptr("no time to fix this") + state := new("dismissed") + dismissedReason := new("no_bandwidth") + dismissedComment := new("no time to fix this") alertState := &DependabotAlertState{State: *state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} @@ -153,10 +153,10 @@ func TestDependabotService_UpdateAlert(t *testing.T) { } want := &DependabotAlert{ - Number: Ptr(42), - State: Ptr("dismissed"), - DismissedReason: Ptr("no_bandwidth"), - DismissedComment: Ptr("no time to fix this"), + Number: new(42), + State: new("dismissed"), + DismissedReason: new("no_bandwidth"), + DismissedComment: new("no time to fix this"), } if !cmp.Equal(alert, want) { t.Errorf("Dependabot.UpdateAlert returned %+v, want %+v", alert, want) diff --git a/github/dependabot_secrets_test.go b/github/dependabot_secrets_test.go index 66ecb474adc..7d6f03e4693 100644 --- a/github/dependabot_secrets_test.go +++ b/github/dependabot_secrets_test.go @@ -28,7 +28,7 @@ func TestDependabotService_GetRepoPublicKey(t *testing.T) { t.Errorf("Dependabot.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Dependabot.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -63,7 +63,7 @@ func TestDependabotService_GetRepoPublicKeyNumeric(t *testing.T) { t.Errorf("Dependabot.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("1234"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Dependabot.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -242,7 +242,7 @@ func TestDependabotService_GetOrgPublicKey(t *testing.T) { t.Errorf("Dependabot.GetOrgPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: Ptr("012345678"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: new("012345678"), Key: new("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Dependabot.GetOrgPublicKey returned %+v, want %+v", key, want) } @@ -410,9 +410,9 @@ func TestDependabotService_ListSelectedReposForOrgSecret(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Ptr(1), + TotalCount: new(1), Repositories: []*Repository{ - {ID: Ptr(int64(1))}, + {ID: new(int64(1))}, }, } if !cmp.Equal(repos, want) { diff --git a/github/dependency_graph_snapshots_test.go b/github/dependency_graph_snapshots_test.go index ef8f360bada..b0a40eeafe2 100644 --- a/github/dependency_graph_snapshots_test.go +++ b/github/dependency_graph_snapshots_test.go @@ -19,17 +19,17 @@ func TestDependencyGraphService_CreateSnapshot(t *testing.T) { snapshot := &DependencyGraphSnapshot{ Version: 0, - Sha: Ptr("ce587453ced02b1526dfb4cb910479d431683101"), - Ref: Ptr("refs/heads/main"), + Sha: new("ce587453ced02b1526dfb4cb910479d431683101"), + Ref: new("refs/heads/main"), Job: &DependencyGraphSnapshotJob{ - Correlator: Ptr("yourworkflowname_youractionname"), - ID: Ptr("yourrunid"), - HTMLURL: Ptr("https://example.com"), + Correlator: new("yourworkflowname_youractionname"), + ID: new("yourrunid"), + HTMLURL: new("https://example.com"), }, Detector: &DependencyGraphSnapshotDetector{ - Name: Ptr("octo-detector"), - Version: Ptr("0.0.1"), - URL: Ptr("https://github.com/octo-org/octo-repo"), + Name: new("octo-detector"), + Version: new("0.0.1"), + URL: new("https://github.com/octo-org/octo-repo"), }, Scanned: &referenceTimestamp, Metadata: map[string]any{ @@ -38,32 +38,32 @@ func TestDependencyGraphService_CreateSnapshot(t *testing.T) { }, Manifests: map[string]*DependencyGraphSnapshotManifest{ "package-lock.json": { - Name: Ptr("package-lock.json"), - File: &DependencyGraphSnapshotManifestFile{SourceLocation: Ptr("src/package-lock.json")}, + Name: new("package-lock.json"), + File: &DependencyGraphSnapshotManifestFile{SourceLocation: new("src/package-lock.json")}, Metadata: map[string]any{ "key1": "value1", "key2": "value2", }, Resolved: map[string]*DependencyGraphSnapshotResolvedDependency{ "@actions/core": { - PackageURL: Ptr("pkg:/npm/%40actions/core@1.1.9"), - Relationship: Ptr("direct"), - Scope: Ptr("runtime"), + PackageURL: new("pkg:/npm/%40actions/core@1.1.9"), + Relationship: new("direct"), + Scope: new("runtime"), Metadata: map[string]any{ "licenses": "MIT", }, Dependencies: []string{"@actions/http-client"}, }, "@actions/http-client": { - PackageURL: Ptr("pkg:/npm/%40actions/http-client@1.0.7"), - Relationship: Ptr("indirect"), - Scope: Ptr("runtime"), + PackageURL: new("pkg:/npm/%40actions/http-client@1.0.7"), + Relationship: new("indirect"), + Scope: new("runtime"), Dependencies: []string{"tunnel"}, }, "tunnel": { - PackageURL: Ptr("pkg:/npm/tunnel@0.0.6"), - Relationship: Ptr("indirect"), - Scope: Ptr("runtime"), + PackageURL: new("pkg:/npm/tunnel@0.0.6"), + Relationship: new("indirect"), + Scope: new("runtime"), }, }, }, @@ -85,8 +85,8 @@ func TestDependencyGraphService_CreateSnapshot(t *testing.T) { want := &DependencyGraphSnapshotCreationData{ ID: 12345, CreatedAt: &referenceTimestamp, - Message: Ptr("Dependency results for the repo have been successfully updated."), - Result: Ptr("SUCCESS"), + Message: new("Dependency results for the repo have been successfully updated."), + Result: new("SUCCESS"), } if !cmp.Equal(snapshotCreationData, want) { t.Errorf("DependencyGraph.CreateSnapshot returned %+v, want %+v", snapshotCreationData, want) diff --git a/github/dependency_graph_test.go b/github/dependency_graph_test.go index 994c87fa18a..5281c570672 100644 --- a/github/dependency_graph_test.go +++ b/github/dependency_graph_test.go @@ -46,11 +46,11 @@ func TestDependencyGraphService_GetSBOM(t *testing.T) { CreationInfo: &CreationInfo{ Created: &referenceTimestamp, }, - Name: Ptr("owner/repo"), + Name: new("owner/repo"), Packages: []*RepoDependencies{ { - Name: Ptr("rubygems:rails"), - VersionInfo: Ptr("1.0.0"), + Name: new("rubygems:rails"), + VersionInfo: new("1.0.0"), }, }, }, diff --git a/github/enterprise_actions_hosted_runners_test.go b/github/enterprise_actions_hosted_runners_test.go index abb6df8db6b..889aba29662 100644 --- a/github/enterprise_actions_hosted_runners_test.go +++ b/github/enterprise_actions_hosted_runners_test.go @@ -84,13 +84,13 @@ func TestEnterpriseService_ListHostedRunners(t *testing.T) { TotalCount: 2, Runners: []*HostedRunner{ { - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -98,9 +98,9 @@ func TestEnterpriseService_ListHostedRunners(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -111,13 +111,13 @@ func TestEnterpriseService_ListHostedRunners(t *testing.T) { LastActiveOn: &referenceTimestamp, }, { - ID: Ptr(int64(7)), - Name: Ptr("My hosted Windows runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("win-x64"), + ID: new(int64(7)), + Name: new("My hosted Windows runner"), + RunnerGroupID: new(int64(2)), + Platform: new("win-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("windows-latest"), - SizeGB: Ptr(int64(256)), + ID: new("windows-latest"), + SizeGB: new(int64(256)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "8-core", @@ -125,9 +125,9 @@ func TestEnterpriseService_ListHostedRunners(t *testing.T) { MemoryGB: 32, StorageGB: 300, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(20)), - PublicIPEnabled: Ptr(false), + Status: new("Ready"), + MaximumRunners: new(int64(20)), + PublicIPEnabled: new(false), PublicIPs: []*HostedRunnerPublicIP{}, LastActiveOn: &referenceTimestamp, }, @@ -193,13 +193,13 @@ func TestEnterpriseService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, RunnerGroupID: 1, Size: "4-core", - MaximumRunners: Ptr(int64(50)), - EnableStaticIP: Ptr(false), - ImageGen: Ptr(true), + MaximumRunners: new(int64(50)), + EnableStaticIP: new(false), + ImageGen: new(true), } hostedRunner, _, err := client.Enterprise.CreateHostedRunner(ctx, "o", req) if err != nil { @@ -207,13 +207,13 @@ func TestEnterpriseService_CreateHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -221,9 +221,9 @@ func TestEnterpriseService_CreateHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -251,7 +251,7 @@ func TestEnterpriseService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, RunnerGroupID: 1, }, @@ -272,7 +272,7 @@ func TestEnterpriseService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, RunnerGroupID: 1, Size: "4-core", @@ -286,7 +286,7 @@ func TestEnterpriseService_CreateHostedRunner(t *testing.T) { Image: HostedRunnerImage{ ID: "ubuntu-latest", Source: "github", - Version: Ptr("latest"), + Version: new("latest"), }, Size: "4-core", }, @@ -621,13 +621,13 @@ func TestEnterpriseService_GetHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -635,9 +635,9 @@ func TestEnterpriseService_GetHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -705,11 +705,11 @@ func TestEnterpriseService_UpdateHostedRunner(t *testing.T) { // Test for a valid update without `Size` ctx := t.Context() validReq := UpdateHostedRunnerRequest{ - Name: Ptr("My larger runner"), - RunnerGroupID: Ptr(int64(1)), - MaximumRunners: Ptr(int64(50)), - EnableStaticIP: Ptr(false), - ImageVersion: Ptr("1.0.0"), + Name: new("My larger runner"), + RunnerGroupID: new(int64(1)), + MaximumRunners: new(int64(50)), + EnableStaticIP: new(false), + ImageVersion: new("1.0.0"), } hostedRunner, _, err := client.Enterprise.UpdateHostedRunner(ctx, "o", 23, validReq) if err != nil { @@ -717,13 +717,13 @@ func TestEnterpriseService_UpdateHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -731,9 +731,9 @@ func TestEnterpriseService_UpdateHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, @@ -805,13 +805,13 @@ func TestEnterpriseService_DeleteHostedRunner(t *testing.T) { } want := &HostedRunner{ - ID: Ptr(int64(5)), - Name: Ptr("My hosted ubuntu runner"), - RunnerGroupID: Ptr(int64(2)), - Platform: Ptr("linux-x64"), + ID: new(int64(5)), + Name: new("My hosted ubuntu runner"), + RunnerGroupID: new(int64(2)), + Platform: new("linux-x64"), ImageDetails: &HostedRunnerImageDetail{ - ID: Ptr("ubuntu-20.04"), - SizeGB: Ptr(int64(86)), + ID: new("ubuntu-20.04"), + SizeGB: new(int64(86)), }, MachineSizeDetails: &HostedRunnerMachineSpec{ ID: "4-core", @@ -819,9 +819,9 @@ func TestEnterpriseService_DeleteHostedRunner(t *testing.T) { MemoryGB: 16, StorageGB: 150, }, - Status: Ptr("Ready"), - MaximumRunners: Ptr(int64(10)), - PublicIPEnabled: Ptr(true), + Status: new("Ready"), + MaximumRunners: new(int64(10)), + PublicIPEnabled: new(true), PublicIPs: []*HostedRunnerPublicIP{ { Enabled: true, diff --git a/github/enterprise_actions_runner_groups_test.go b/github/enterprise_actions_runner_groups_test.go index f77a4ff0450..92b8bfef510 100644 --- a/github/enterprise_actions_runner_groups_test.go +++ b/github/enterprise_actions_runner_groups_test.go @@ -31,11 +31,11 @@ func TestEnterpriseService_ListRunnerGroups(t *testing.T) { } want := &EnterpriseRunnerGroups{ - TotalCount: Ptr(3), + TotalCount: new(3), RunnerGroups: []*EnterpriseRunnerGroup{ - {ID: Ptr(int64(1)), Name: Ptr("Default"), Visibility: Ptr("all"), Default: Ptr(true), RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(true), SelectedWorkflows: []string{"a", "b"}}, - {ID: Ptr(int64(2)), Name: Ptr("octo-runner-group"), Visibility: Ptr("selected"), Default: Ptr(false), SelectedOrganizationsURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, - {ID: Ptr(int64(3)), Name: Ptr("expensive-hardware"), Visibility: Ptr("private"), Default: Ptr(false), RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, + {ID: new(int64(1)), Name: new("Default"), Visibility: new("all"), Default: new(true), RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(true), SelectedWorkflows: []string{"a", "b"}}, + {ID: new(int64(2)), Name: new("octo-runner-group"), Visibility: new("selected"), Default: new(false), SelectedOrganizationsURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: new(true), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, + {ID: new(int64(3)), Name: new("expensive-hardware"), Visibility: new("private"), Default: new(false), RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, }, } if !cmp.Equal(groups, want) { @@ -75,11 +75,11 @@ func TestEnterpriseService_ListRunnerGroupsVisibleToOrganization(t *testing.T) { } want := &EnterpriseRunnerGroups{ - TotalCount: Ptr(3), + TotalCount: new(3), RunnerGroups: []*EnterpriseRunnerGroup{ - {ID: Ptr(int64(1)), Name: Ptr("Default"), Visibility: Ptr("all"), Default: Ptr(true), RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, - {ID: Ptr(int64(2)), Name: Ptr("octo-runner-group"), Visibility: Ptr("selected"), Default: Ptr(false), SelectedOrganizationsURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: Ptr(true), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, - {ID: Ptr(int64(3)), Name: Ptr("expensive-hardware"), Visibility: Ptr("private"), Default: Ptr(false), RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: Ptr(false), AllowsPublicRepositories: Ptr(true), RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}}, + {ID: new(int64(1)), Name: new("Default"), Visibility: new("all"), Default: new(true), RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, + {ID: new(int64(2)), Name: new("octo-runner-group"), Visibility: new("selected"), Default: new(false), SelectedOrganizationsURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: new(true), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, + {ID: new(int64(3)), Name: new("expensive-hardware"), Visibility: new("private"), Default: new(false), RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: new(false), AllowsPublicRepositories: new(true), RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}}, }, } if !cmp.Equal(groups, want) { @@ -117,15 +117,15 @@ func TestEnterpriseService_GetEnterpriseRunnerGroup(t *testing.T) { } want := &EnterpriseRunnerGroup{ - ID: Ptr(int64(2)), - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - Default: Ptr(false), - SelectedOrganizationsURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), - RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), - Inherited: Ptr(false), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + ID: new(int64(2)), + Name: new("octo-runner-group"), + Visibility: new("selected"), + Default: new(false), + SelectedOrganizationsURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), + RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), + Inherited: new(false), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } @@ -184,10 +184,10 @@ func TestEnterpriseService_CreateEnterpriseRunnerGroup(t *testing.T) { ctx := t.Context() req := CreateEnterpriseRunnerGroupRequest{ - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + Name: new("octo-runner-group"), + Visibility: new("selected"), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } group, _, err := client.Enterprise.CreateEnterpriseRunnerGroup(ctx, "o", req) @@ -196,15 +196,15 @@ func TestEnterpriseService_CreateEnterpriseRunnerGroup(t *testing.T) { } want := &EnterpriseRunnerGroup{ - ID: Ptr(int64(2)), - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - Default: Ptr(false), - SelectedOrganizationsURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), - RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), - Inherited: Ptr(false), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + ID: new(int64(2)), + Name: new("octo-runner-group"), + Visibility: new("selected"), + Default: new(false), + SelectedOrganizationsURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), + RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), + Inherited: new(false), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } @@ -238,10 +238,10 @@ func TestEnterpriseService_UpdateEnterpriseRunnerGroup(t *testing.T) { ctx := t.Context() req := UpdateEnterpriseRunnerGroupRequest{ - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + Name: new("octo-runner-group"), + Visibility: new("selected"), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } group, _, err := client.Enterprise.UpdateEnterpriseRunnerGroup(ctx, "o", 2, req) @@ -250,15 +250,15 @@ func TestEnterpriseService_UpdateEnterpriseRunnerGroup(t *testing.T) { } want := &EnterpriseRunnerGroup{ - ID: Ptr(int64(2)), - Name: Ptr("octo-runner-group"), - Visibility: Ptr("selected"), - Default: Ptr(false), - SelectedOrganizationsURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), - RunnersURL: Ptr("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), - Inherited: Ptr(false), - AllowsPublicRepositories: Ptr(true), - RestrictedToWorkflows: Ptr(false), + ID: new(int64(2)), + Name: new("octo-runner-group"), + Visibility: new("selected"), + Default: new(false), + SelectedOrganizationsURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), + RunnersURL: new("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), + Inherited: new(false), + AllowsPublicRepositories: new(true), + RestrictedToWorkflows: new(false), SelectedWorkflows: []string{}, } @@ -299,9 +299,9 @@ func TestEnterpriseService_ListOrganizationAccessRunnerGroup(t *testing.T) { } want := &ListOrganizations{ - TotalCount: Ptr(1), + TotalCount: new(1), Organizations: []*Organization{ - {ID: Ptr(int64(43)), NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: Ptr("Hello-World"), Login: Ptr("octocat")}, + {ID: new(int64(43)), NodeID: new("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: new("Hello-World"), Login: new("octocat")}, }, } if !cmp.Equal(groups, want) { @@ -425,8 +425,8 @@ func TestEnterpriseService_ListRunnerGroupRunners(t *testing.T) { want := &Runners{ TotalCount: 2, Runners: []*Runner{ - {ID: Ptr(int64(23)), Name: Ptr("MBP"), OS: Ptr("macos"), Status: Ptr("online")}, - {ID: Ptr(int64(24)), Name: Ptr("iMac"), OS: Ptr("macos"), Status: Ptr("offline")}, + {ID: new(int64(23)), Name: new("MBP"), OS: new("macos"), Status: new("online")}, + {ID: new(int64(24)), Name: new("iMac"), OS: new("macos"), Status: new("offline")}, }, } if !cmp.Equal(runners, want) { diff --git a/github/enterprise_actions_runners_test.go b/github/enterprise_actions_runners_test.go index 8edbc966e80..8a9a55f0d5c 100644 --- a/github/enterprise_actions_runners_test.go +++ b/github/enterprise_actions_runners_test.go @@ -31,7 +31,7 @@ func TestEnterpriseService_CreateJITConfig(t *testing.T) { t.Errorf("Enterprise.CreateJITConfig returned error: %v", err) } - want := &JITRunnerConfig{EncodedJITConfig: Ptr("foo")} + want := &JITRunnerConfig{EncodedJITConfig: new("foo")} if !cmp.Equal(jitConfig, want) { t.Errorf("Enterprise.CreateJITConfig returned %+v, want %+v", jitConfig, want) } @@ -67,7 +67,7 @@ func TestEnterpriseService_CreateRegistrationToken(t *testing.T) { } want := &RegistrationToken{ - Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), + Token: new("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp, } if !cmp.Equal(token, want) { @@ -100,7 +100,7 @@ func TestEnterpriseService_ListRunners(t *testing.T) { }) opts := &ListRunnersOptions{ - Name: Ptr("MBP"), + Name: new("MBP"), ListOptions: ListOptions{Page: 2, PerPage: 2}, } ctx := t.Context() @@ -112,7 +112,7 @@ func TestEnterpriseService_ListRunners(t *testing.T) { want := &Runners{ TotalCount: 1, Runners: []*Runner{ - {ID: Ptr(int64(23)), Name: Ptr("MBP"), OS: Ptr("macos"), Status: Ptr("online")}, + {ID: new(int64(23)), Name: new("MBP"), OS: new("macos"), Status: new("online")}, }, } if !cmp.Equal(runners, want) { @@ -150,10 +150,10 @@ func TestEnterpriseService_GetRunner(t *testing.T) { } want := &Runner{ - ID: Ptr(int64(23)), - Name: Ptr("MBP"), - OS: Ptr("macos"), - Status: Ptr("online"), + ID: new(int64(23)), + Name: new("MBP"), + OS: new("macos"), + Status: new("online"), } if !cmp.Equal(runner, want) { t.Errorf("Enterprise.GetRunner returned %+v, want %+v", runner, want) @@ -215,11 +215,11 @@ func TestEnterpriseService_ListRunnerApplicationDownloads(t *testing.T) { } want := []*RunnerApplicationDownload{ - {OS: Ptr("osx"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-osx-x64-2.164.0.tar.gz")}, - {OS: Ptr("linux"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-x64-2.164.0.tar.gz")}, - {OS: Ptr("linux"), Architecture: Ptr("arm"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-arm-2.164.0.tar.gz")}, - {OS: Ptr("win"), Architecture: Ptr("x64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: Ptr("actions-runner-win-x64-2.164.0.zip")}, - {OS: Ptr("linux"), Architecture: Ptr("arm64"), DownloadURL: Ptr("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: Ptr("actions-runner-linux-arm64-2.164.0.tar.gz")}, + {OS: new("osx"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: new("actions-runner-osx-x64-2.164.0.tar.gz")}, + {OS: new("linux"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: new("actions-runner-linux-x64-2.164.0.tar.gz")}, + {OS: new("linux"), Architecture: new("arm"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: new("actions-runner-linux-arm-2.164.0.tar.gz")}, + {OS: new("win"), Architecture: new("x64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: new("actions-runner-win-x64-2.164.0.zip")}, + {OS: new("linux"), Architecture: new("arm64"), DownloadURL: new("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: new("actions-runner-linux-arm64-2.164.0.tar.gz")}, } if !cmp.Equal(downloads, want) { t.Errorf("Enterprise.ListRunnerApplicationDownloads returned %+v, want %+v", downloads, want) diff --git a/github/enterprise_app_installation_test.go b/github/enterprise_app_installation_test.go index b42318f70a7..e007b204cba 100644 --- a/github/enterprise_app_installation_test.go +++ b/github/enterprise_app_installation_test.go @@ -108,7 +108,7 @@ func TestEnterpriseService_ListAppInstallations(t *testing.T) { t.Errorf("ListAppInstallations returned error: %v", err) } want := []*Installation{ - {ID: Ptr(int64(99))}, + {ID: new(int64(99))}, } if !cmp.Equal(installations, want) { @@ -153,7 +153,7 @@ func TestEnterpriseService_InstallApp(t *testing.T) { t.Errorf("InstallApp returned error: %v", err) } - want := &Installation{ID: Ptr(int64(555))} + want := &Installation{ID: new(int64(555))} if !cmp.Equal(installation, want) { t.Errorf("InstallApp returned %+v, want %+v", installation, want) @@ -234,7 +234,7 @@ func TestEnterpriseService_UpdateAppInstallationRepositories(t *testing.T) { client, mux, _ := setup(t) input := UpdateAppInstallationRepositoriesRequest{ - RepositorySelection: Ptr("selected"), + RepositorySelection: new("selected"), Repositories: []string{"hello-world", "hello-world-2"}, } @@ -250,7 +250,7 @@ func TestEnterpriseService_UpdateAppInstallationRepositories(t *testing.T) { t.Errorf("Enterprise.UpdateAppInstallationRepositories returned error: %v", err) } - want := &Installation{ID: Ptr(int64(1)), RepositorySelection: Ptr("selected")} + want := &Installation{ID: new(int64(1)), RepositorySelection: new("selected")} if diff := cmp.Diff(inst, want); diff != "" { t.Errorf("Enterprise.UpdateAppInstallationRepositories returned diff (-want +got):\n%v", diff) } diff --git a/github/enterprise_audit_log_test.go b/github/enterprise_audit_log_test.go index b4cc8ee2fce..f9f5e6f4af0 100644 --- a/github/enterprise_audit_log_test.go +++ b/github/enterprise_audit_log_test.go @@ -42,9 +42,9 @@ func TestEnterpriseService_GetAuditLog(t *testing.T) { ]`) }) getOpts := GetAuditLogOptions{ - Include: Ptr("all"), - Phrase: Ptr("action:workflows"), - Order: Ptr("asc"), + Include: new("all"), + Phrase: new("action:workflows"), + Order: new("asc"), } ctx := t.Context() auditEntries, _, err := client.Enterprise.GetAuditLog(ctx, "e", &getOpts) @@ -55,11 +55,11 @@ func TestEnterpriseService_GetAuditLog(t *testing.T) { want := []*AuditEntry{ { Timestamp: &Timestamp{timestamp}, - DocumentID: Ptr("beeZYapIUe-wKg5-beadb33"), - Action: Ptr("workflows.completed_workflow_run"), - Actor: Ptr("testactor"), + DocumentID: new("beeZYapIUe-wKg5-beadb33"), + Action: new("workflows.completed_workflow_run"), + Actor: new("testactor"), CreatedAt: &Timestamp{timestamp}, - Org: Ptr("o"), + Org: new("o"), AdditionalFields: map[string]any{ "completed_at": "2021-03-07T00:35:08.000Z", "conclusion": "success", diff --git a/github/enterprise_billing_cost_centers_test.go b/github/enterprise_billing_cost_centers_test.go index 3994c06dae5..bdfbedb91dc 100644 --- a/github/enterprise_billing_cost_centers_test.go +++ b/github/enterprise_billing_cost_centers_test.go @@ -57,7 +57,7 @@ func TestEnterpriseService_ListCostCenters(t *testing.T) { ctx := t.Context() opts := &ListCostCenterOptions{ - State: Ptr("active"), + State: new("active"), } costCenters, _, err := client.Enterprise.ListCostCenters(ctx, "e", opts) if err != nil { @@ -69,8 +69,8 @@ func TestEnterpriseService_ListCostCenters(t *testing.T) { { ID: "2eeb8ffe-6903-11ee-8c99-0242ac120002", Name: "Cost Center Name", - State: Ptr("active"), - AzureSubscription: Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), + State: new("active"), + AzureSubscription: new("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), Resources: []*CostCenterResource{ { Type: "User", @@ -85,7 +85,7 @@ func TestEnterpriseService_ListCostCenters(t *testing.T) { { ID: "3ffb9ffe-6903-11ee-8c99-0242ac120003", Name: "Another Cost Center", - State: Ptr("active"), + State: new("active"), Resources: []*CostCenterResource{ { Type: "User", @@ -213,8 +213,8 @@ func TestEnterpriseService_GetCostCenter(t *testing.T) { want := &CostCenter{ ID: "2eeb8ffe-6903-11ee-8c99-0242ac120002", Name: "Cost Center Name", - State: Ptr("active"), - AzureSubscription: Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), + State: new("active"), + AzureSubscription: new("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), Resources: []*CostCenterResource{ { Type: "User", @@ -292,8 +292,8 @@ func TestEnterpriseService_UpdateCostCenter(t *testing.T) { want := &CostCenter{ ID: "2eeb8ffe-6903-11ee-8c99-0242ac120002", Name: "Updated Cost Center Name", - State: Ptr("active"), - AzureSubscription: Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), + State: new("active"), + AzureSubscription: new("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), Resources: []*CostCenterResource{ { Type: "User", @@ -427,22 +427,22 @@ func TestEnterpriseService_AddResourcesToCostCenter(t *testing.T) { } want := &AddResourcesToCostCenterResponse{ - Message: Ptr("Resources successfully added to the cost center."), + Message: new("Resources successfully added to the cost center."), ReassignedResources: []*ReassignedResource{ { - ResourceType: Ptr("user"), - Name: Ptr("monalisa"), - PreviousCostCenter: Ptr("old-cost-center"), + ResourceType: new("user"), + Name: new("monalisa"), + PreviousCostCenter: new("old-cost-center"), }, { - ResourceType: Ptr("organization"), - Name: Ptr("octo-org"), - PreviousCostCenter: Ptr("another-cost-center"), + ResourceType: new("organization"), + Name: new("octo-org"), + PreviousCostCenter: new("another-cost-center"), }, { - ResourceType: Ptr("repository"), - Name: Ptr("octo-repo"), - PreviousCostCenter: Ptr("yet-another-cost-center"), + ResourceType: new("repository"), + Name: new("octo-repo"), + PreviousCostCenter: new("yet-another-cost-center"), }, }, } @@ -497,7 +497,7 @@ func TestEnterpriseService_RemoveResourcesFromCostCenter(t *testing.T) { } want := &RemoveResourcesFromCostCenterResponse{ - Message: Ptr("Resources successfully removed from the cost center."), + Message: new("Resources successfully removed from the cost center."), } if !cmp.Equal(result, want) { t.Errorf("Enterprise.RemoveResourcesFromCostCenter returned %+v, want %+v", result, want) diff --git a/github/enterprise_billing_test.go b/github/enterprise_billing_test.go index f180d90e7f9..9f233dd7158 100644 --- a/github/enterprise_billing_test.go +++ b/github/enterprise_billing_test.go @@ -71,7 +71,7 @@ func TestEnterpriseService_GetUsageReport(t *testing.T) { DiscountAmount: 0.0, NetAmount: 0.8, OrganizationName: "GitHub", - RepositoryName: Ptr("github/example"), + RepositoryName: new("github/example"), }, }, } @@ -293,13 +293,13 @@ func TestEnterpriseService_GetPremiumRequestUsageReport(t *testing.T) { want := &EnterpriseAggregatedUsageReport{ TimePeriod: EnterpriseUsageTimePeriod{ Year: 2025, - Month: Ptr(10), + Month: new(10), }, Enterprise: "GitHub", - Organization: Ptr("GitHub"), - User: Ptr("testuser"), - Product: Ptr("Copilot"), - Model: Ptr("GPT-5"), + Organization: new("GitHub"), + User: new("testuser"), + Product: new("Copilot"), + Model: new("GPT-5"), UsageItems: []*EnterpriseAggregatedUsageItem{ { Product: "Copilot", @@ -420,13 +420,13 @@ func TestEnterpriseService_GetAICreditUsage(t *testing.T) { want := &EnterpriseAggregatedUsageReport{ TimePeriod: EnterpriseUsageTimePeriod{ Year: 2025, - Month: Ptr(6), + Month: new(6), }, Enterprise: "GitHub", - Organization: Ptr("GitHub"), - User: Ptr("testuser"), - Product: Ptr("Copilot"), - Model: Ptr("GPT-5"), + Organization: new("GitHub"), + User: new("testuser"), + Product: new("Copilot"), + Model: new("GPT-5"), UsageItems: []*EnterpriseAggregatedUsageItem{ { Product: "Copilot", diff --git a/github/enterprise_budgets_test.go b/github/enterprise_budgets_test.go index d8a5d7af704..28b950b317b 100644 --- a/github/enterprise_budgets_test.go +++ b/github/enterprise_budgets_test.go @@ -48,20 +48,20 @@ func TestEnterpriseService_ListBudgets(t *testing.T) { want := &EnterpriseListBudgets{ Budgets: []*EnterpriseBudget{ { - ID: Ptr("2066deda-923f-43f9-88d2-62395a28c0cdd"), - BudgetType: Ptr(BudgetTypeProductPricing), - BudgetProductSKU: Ptr("actions"), - BudgetScope: Ptr(BudgetScopeEnterprise), - BudgetAmount: Ptr(1000), - PreventFurtherUsage: Ptr(true), + ID: new("2066deda-923f-43f9-88d2-62395a28c0cdd"), + BudgetType: new(BudgetTypeProductPricing), + BudgetProductSKU: new("actions"), + BudgetScope: new(BudgetScopeEnterprise), + BudgetAmount: new(1000), + PreventFurtherUsage: new(true), BudgetAlerting: &EnterpriseBudgetAlerting{ - WillAlert: Ptr(true), + WillAlert: new(true), AlertRecipients: []string{"enterprise-admin"}, }, }, }, - HasNextPage: Ptr(true), - TotalCount: Ptr(1), + HasNextPage: new(true), + TotalCount: new(1), } if !cmp.Equal(budgets, want) { t.Errorf("Enterprise.ListBudgets returned %+v, want %+v", budgets, want) @@ -100,7 +100,7 @@ func TestEnterpriseService_CreateBudget(t *testing.T) { PreventFurtherUsage: true, BudgetScope: BudgetScopeEnterprise, BudgetType: BudgetTypeProductPricing, - BudgetProductSKU: Ptr("actions"), + BudgetProductSKU: new("actions"), BudgetAlerting: &EnterpriseBudgetAlerting{}, } @@ -126,9 +126,9 @@ func TestEnterpriseService_CreateBudget(t *testing.T) { want := &EnterpriseCreateOrUpdateBudgetResponse{ Message: "Budget successfully created.", Budget: &EnterpriseBudget{ - ID: Ptr("b-123"), - BudgetAmount: Ptr(200), - PreventFurtherUsage: Ptr(true), + ID: new("b-123"), + BudgetAmount: new(200), + PreventFurtherUsage: new(true), }, } if !cmp.Equal(resp, want) { @@ -182,12 +182,12 @@ func TestEnterpriseService_GetBudget(t *testing.T) { } want := &EnterpriseBudget{ - ID: Ptr("2066deda-923f-43f9-88d2-62395a28c0cdd"), - BudgetType: Ptr(BudgetTypeProductPricing), - BudgetProductSKU: Ptr("actions_linux"), - BudgetScope: Ptr(BudgetScopeRepository), - BudgetAmount: Ptr(0), - PreventFurtherUsage: Ptr(true), + ID: new("2066deda-923f-43f9-88d2-62395a28c0cdd"), + BudgetType: new(BudgetTypeProductPricing), + BudgetProductSKU: new("actions_linux"), + BudgetScope: new(BudgetScopeRepository), + BudgetAmount: new(0), + PreventFurtherUsage: new(true), } if !cmp.Equal(budget, want) { t.Errorf("Enterprise.GetBudget returned %+v, want %+v", budget, want) @@ -222,8 +222,8 @@ func TestEnterpriseService_UpdateBudget(t *testing.T) { client, mux, _ := setup(t) req := EnterpriseUpdateBudget{ - BudgetAmount: Ptr(10), - PreventFurtherUsage: Ptr(false), + BudgetAmount: new(10), + PreventFurtherUsage: new(false), } mux.HandleFunc("/enterprises/e/settings/billing/budgets/b-123", func(w http.ResponseWriter, r *http.Request) { @@ -248,9 +248,9 @@ func TestEnterpriseService_UpdateBudget(t *testing.T) { want := &EnterpriseCreateOrUpdateBudgetResponse{ Message: "Budget successfully updated.", Budget: &EnterpriseBudget{ - ID: Ptr("b-123"), - BudgetAmount: Ptr(10), - PreventFurtherUsage: Ptr(false), + ID: new("b-123"), + BudgetAmount: new(10), + PreventFurtherUsage: new(false), }, } if !cmp.Equal(resp, want) { diff --git a/github/enterprise_code_security_and_analysis_test.go b/github/enterprise_code_security_and_analysis_test.go index 603ce809929..bbd9e9aa35d 100644 --- a/github/enterprise_code_security_and_analysis_test.go +++ b/github/enterprise_code_security_and_analysis_test.go @@ -39,11 +39,11 @@ func TestEnterpriseService_GetCodeSecurityAndAnalysis(t *testing.T) { t.Errorf("Enterprise.%v returned error: %v", methodName, err) } want := &EnterpriseSecurityAnalysisSettings{ - AdvancedSecurityEnabledForNewRepositories: Ptr(true), - SecretScanningEnabledForNewRepositories: Ptr(true), - SecretScanningPushProtectionEnabledForNewRepositories: Ptr(true), - SecretScanningPushProtectionCustomLink: Ptr("https://github.com/test-org/test-repo/blob/main/README.md"), - SecretScanningValidityChecksEnabled: Ptr(true), + AdvancedSecurityEnabledForNewRepositories: new(true), + SecretScanningEnabledForNewRepositories: new(true), + SecretScanningPushProtectionEnabledForNewRepositories: new(true), + SecretScanningPushProtectionCustomLink: new("https://github.com/test-org/test-repo/blob/main/README.md"), + SecretScanningValidityChecksEnabled: new(true), } if !cmp.Equal(settings, want) { @@ -69,11 +69,11 @@ func TestEnterpriseService_UpdateCodeSecurityAndAnalysis(t *testing.T) { client, mux, _ := setup(t) input := &EnterpriseSecurityAnalysisSettings{ - AdvancedSecurityEnabledForNewRepositories: Ptr(true), - SecretScanningEnabledForNewRepositories: Ptr(true), - SecretScanningPushProtectionEnabledForNewRepositories: Ptr(true), - SecretScanningPushProtectionCustomLink: Ptr("https://github.com/test-org/test-repo/blob/main/README.md"), - SecretScanningValidityChecksEnabled: Ptr(true), + AdvancedSecurityEnabledForNewRepositories: new(true), + SecretScanningEnabledForNewRepositories: new(true), + SecretScanningPushProtectionEnabledForNewRepositories: new(true), + SecretScanningPushProtectionCustomLink: new("https://github.com/test-org/test-repo/blob/main/README.md"), + SecretScanningValidityChecksEnabled: new(true), } mux.HandleFunc("/enterprises/e/code_security_and_analysis", func(_ http.ResponseWriter, r *http.Request) { diff --git a/github/enterprise_codesecurity_configurations_test.go b/github/enterprise_codesecurity_configurations_test.go index 2d53cf5a195..98d07417c71 100644 --- a/github/enterprise_codesecurity_configurations_test.go +++ b/github/enterprise_codesecurity_configurations_test.go @@ -43,8 +43,8 @@ func TestEnterpriseService_ListCodeSecurityConfigurations(t *testing.T) { } want := []*CodeSecurityConfiguration{ - {ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")}, - {ID: Ptr(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: Ptr("enabled")}, + {ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")}, + {ID: new(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: new("enabled")}, } if !cmp.Equal(configurations, want) { t.Errorf("Enterprise.ListCodeSecurityConfigurations returned %+v, want %+v", configurations, want) @@ -83,7 +83,7 @@ func TestEnterpriseService_GetCodeSecurityConfiguration(t *testing.T) { t.Errorf("Enterprise.GetCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")} + want := &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")} if !cmp.Equal(configuration, want) { t.Errorf("Enterprise.GetCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -111,7 +111,7 @@ func TestEnterpriseService_CreateCodeSecurityConfiguration(t *testing.T) { input := CodeSecurityConfiguration{ Name: "config1", Description: "desc1", - CodeScanningDefaultSetup: Ptr("enabled"), + CodeScanningDefaultSetup: new("enabled"), } mux.HandleFunc("/enterprises/e/code-security/configurations", func(w http.ResponseWriter, r *http.Request) { @@ -130,7 +130,7 @@ func TestEnterpriseService_CreateCodeSecurityConfiguration(t *testing.T) { t.Errorf("Enterprise.CreateCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")} + want := &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")} if !cmp.Equal(configuration, want) { t.Errorf("Enterprise.CreateCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -185,8 +185,8 @@ func TestEnterpriseService_ListDefaultCodeSecurityConfigurations(t *testing.T) { } want := []*CodeSecurityConfigurationWithDefaultForNewRepos{ - {DefaultForNewRepos: Ptr("public"), Configuration: &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")}}, - {DefaultForNewRepos: Ptr("private_and_internal"), Configuration: &CodeSecurityConfiguration{ID: Ptr(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: Ptr("enabled")}}, + {DefaultForNewRepos: new("public"), Configuration: &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")}}, + {DefaultForNewRepos: new("private_and_internal"), Configuration: &CodeSecurityConfiguration{ID: new(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: new("enabled")}}, } if !cmp.Equal(configurations, want) { t.Errorf("Enterprise.ListDefaultCodeSecurityConfigurations returned %+v, want %+v", configurations, want) @@ -215,7 +215,7 @@ func TestEnterpriseService_UpdateCodeSecurityConfiguration(t *testing.T) { input := CodeSecurityConfiguration{ Name: "config1", Description: "desc1", - CodeScanningDefaultSetup: Ptr("enabled"), + CodeScanningDefaultSetup: new("enabled"), } mux.HandleFunc("/enterprises/e/code-security/configurations/1", func(w http.ResponseWriter, r *http.Request) { @@ -234,7 +234,7 @@ func TestEnterpriseService_UpdateCodeSecurityConfiguration(t *testing.T) { t.Errorf("Enterprise.UpdateCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")} + want := &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")} if !cmp.Equal(configuration, want) { t.Errorf("Enterprise.UpdateCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -351,9 +351,9 @@ func TestEnterpriseService_SetDefaultCodeSecurityConfiguration(t *testing.T) { t.Errorf("Enterprise.SetDefaultCodeSecurityConfiguration returned status %v, want %v", resp.StatusCode, wantStatus) } want := &CodeSecurityConfigurationWithDefaultForNewRepos{ - DefaultForNewRepos: Ptr("all"), + DefaultForNewRepos: new("all"), Configuration: &CodeSecurityConfiguration{ - ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled"), + ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled"), }, } if !cmp.Equal(got, want) { @@ -407,8 +407,8 @@ func TestEnterpriseService_ListCodeSecurityConfigurationRepositories(t *testing. t.Errorf("Enterprise.ListCodeSecurityConfigurationRepositories returned error: %v", err) } want := []*RepositoryAttachment{ - {Status: Ptr("attached"), Repository: &Repository{ID: Ptr(int64(8)), Name: Ptr("repo8")}}, - {Status: Ptr("attached"), Repository: &Repository{ID: Ptr(int64(42)), Name: Ptr("repo42")}}, + {Status: new("attached"), Repository: &Repository{ID: new(int64(8)), Name: new("repo8")}}, + {Status: new("attached"), Repository: &Repository{ID: new(int64(42)), Name: new("repo42")}}, } if !cmp.Equal(attachments, want) { t.Errorf("Enterprise.ListCodeSecurityConfigurationRepositories returned %+v, want %+v", attachments, want) diff --git a/github/enterprise_licenses_test.go b/github/enterprise_licenses_test.go index 288e8572e88..6a8bbf39717 100644 --- a/github/enterprise_licenses_test.go +++ b/github/enterprise_licenses_test.go @@ -59,22 +59,22 @@ func TestEnterpriseService_ListConsumedLicenses(t *testing.T) { Users: []*EnterpriseLicensedUsers{ { GithubComLogin: "user1", - GithubComName: Ptr("User One"), + GithubComName: new("User One"), EnterpriseServerUserIDs: []string{"123", "456"}, GithubComUser: true, - EnterpriseServerUser: Ptr(false), + EnterpriseServerUser: new(false), VisualStudioSubscriptionUser: false, LicenseType: "Enterprise", - GithubComProfile: Ptr("https://github.com/user1"), + GithubComProfile: new("https://github.com/user1"), GithubComMemberRoles: []string{"member"}, GithubComEnterpriseRoles: []string{"member"}, GithubComVerifiedDomainEmails: []string{"user1@example.com"}, - GithubComSamlNameID: Ptr("saml123"), + GithubComSamlNameID: new("saml123"), GithubComOrgsWithPendingInvites: []string{}, - GithubComTwoFactorAuth: Ptr(true), + GithubComTwoFactorAuth: new(true), EnterpriseServerEmails: []string{"user1@example.com"}, - VisualStudioLicenseStatus: Ptr("active"), - VisualStudioSubscriptionEmail: Ptr("user1@example.com"), + VisualStudioLicenseStatus: new("active"), + VisualStudioSubscriptionEmail: new("user1@example.com"), TotalUserAccounts: 1, }, }, diff --git a/github/enterprise_manage_ghes_config_test.go b/github/enterprise_manage_ghes_config_test.go index cc43ead90b9..24d3faef18c 100644 --- a/github/enterprise_manage_ghes_config_test.go +++ b/github/enterprise_manage_ghes_config_test.go @@ -163,69 +163,69 @@ func TestEnterpriseService_Settings(t *testing.T) { } want := &ConfigSettings{ - PrivateMode: Ptr(false), - PublicPages: Ptr(false), - SubdomainIsolation: Ptr(true), - SignupEnabled: Ptr(false), - GithubHostname: Ptr("ghe.local"), - IdenticonsHost: Ptr("dotcom"), + PrivateMode: new(false), + PublicPages: new(false), + SubdomainIsolation: new(true), + SignupEnabled: new(false), + GithubHostname: new("ghe.local"), + IdenticonsHost: new("dotcom"), HTTPProxy: nil, - AuthMode: Ptr("default"), - ExpireSessions: Ptr(false), + AuthMode: new("default"), + ExpireSessions: new(false), AdminPassword: nil, - ConfigurationID: Ptr(int64(1401777404)), - ConfigurationRunCount: Ptr(4), + ConfigurationID: new(int64(1401777404)), + ConfigurationRunCount: new(4), Avatar: &ConfigSettingsAvatar{ - Enabled: Ptr(false), - URI: Ptr(""), + Enabled: new(false), + URI: new(""), }, Customer: &ConfigSettingsCustomer{ - Name: Ptr("GitHub"), - Email: Ptr("stannis"), - UUID: Ptr("af6cac80-e4e1-012e-d822-1231380e52e9"), + Name: new("GitHub"), + Email: new("stannis"), + UUID: new("af6cac80-e4e1-012e-d822-1231380e52e9"), Secret: nil, - PublicKeyData: Ptr("-"), + PublicKeyData: new("-"), }, License: &ConfigSettingsLicenseSettings{ - Seats: Ptr(0), - Evaluation: Ptr(false), - Perpetual: Ptr(false), - UnlimitedSeating: Ptr(true), - SupportKey: Ptr("ssh-rsa AAAAB3N...."), - SSHAllowed: Ptr(true), - ClusterSupport: Ptr(false), + Seats: new(0), + Evaluation: new(false), + Perpetual: new(false), + UnlimitedSeating: new(true), + SupportKey: new("ssh-rsa AAAAB3N...."), + SSHAllowed: new(true), + ClusterSupport: new(false), ExpireAt: &referenceTimestamp, }, GithubSSL: &ConfigSettingsGithubSSL{ - Enabled: Ptr(false), + Enabled: new(false), Cert: nil, Key: nil, }, LDAP: &ConfigSettingsLDAP{ Host: nil, - Port: Ptr(0), + Port: new(0), Base: []string{}, UID: nil, BindDN: nil, Password: nil, - Method: Ptr("Plain"), - SearchStrategy: Ptr("detect"), + Method: new("Plain"), + SearchStrategy: new("detect"), UserGroups: []string{}, AdminGroup: nil, - VirtualAttributeEnabled: Ptr(false), - RecursiveGroupSearch: Ptr(false), - PosixSupport: Ptr(true), - UserSyncEmails: Ptr(false), - UserSyncKeys: Ptr(false), - UserSyncInterval: Ptr(4), - TeamSyncInterval: Ptr(4), - SyncEnabled: Ptr(false), + VirtualAttributeEnabled: new(false), + RecursiveGroupSearch: new(false), + PosixSupport: new(true), + UserSyncEmails: new(false), + UserSyncKeys: new(false), + UserSyncInterval: new(4), + TeamSyncInterval: new(4), + SyncEnabled: new(false), Reconciliation: &ConfigSettingsLDAPReconciliation{ User: nil, Org: nil, }, Profile: &ConfigSettingsLDAPProfile{ - UID: Ptr("uid"), + UID: new("uid"), Name: nil, Mail: nil, Key: nil, @@ -239,60 +239,60 @@ func TestEnterpriseService_Settings(t *testing.T) { Certificate: nil, CertificatePath: nil, Issuer: nil, - IDPInitiatedSSO: Ptr(false), - DisableAdminDemote: Ptr(false), + IDPInitiatedSSO: new(false), + DisableAdminDemote: new(false), }, GithubOAuth: &ConfigSettingsGithubOAuth{ - ClientID: Ptr("12313412"), - ClientSecret: Ptr("kj123131132"), - OrganizationName: Ptr("Homestar Runners"), - OrganizationTeam: Ptr("homestarrunners/characters"), + ClientID: new("12313412"), + ClientSecret: new("kj123131132"), + OrganizationName: new("Homestar Runners"), + OrganizationTeam: new("homestarrunners/characters"), }, SMTP: &ConfigSettingsSMTP{ - Enabled: Ptr(true), - Address: Ptr("smtp.example.com"), - Authentication: Ptr("plain"), - Port: Ptr("1234"), - Domain: Ptr("blah"), - Username: Ptr("foo"), - UserName: Ptr("mr_foo"), - Password: Ptr("bar"), - DiscardToNoreplyAddress: Ptr(true), - SupportAddress: Ptr("enterprise@github.com"), - SupportAddressType: Ptr("email"), - NoreplyAddress: Ptr("noreply@github.com"), - EnableStarttlsAuto: Ptr(true), + Enabled: new(true), + Address: new("smtp.example.com"), + Authentication: new("plain"), + Port: new("1234"), + Domain: new("blah"), + Username: new("foo"), + UserName: new("mr_foo"), + Password: new("bar"), + DiscardToNoreplyAddress: new(true), + SupportAddress: new("enterprise@github.com"), + SupportAddressType: new("email"), + NoreplyAddress: new("noreply@github.com"), + EnableStarttlsAuto: new(true), }, NTP: &ConfigSettingsNTP{ - PrimaryServer: Ptr("example.com/primary"), - SecondaryServer: Ptr("example.com/secondary"), + PrimaryServer: new("example.com/primary"), + SecondaryServer: new("example.com/secondary"), }, Timezone: nil, SNMP: &ConfigSettingsSNMP{ - Enabled: Ptr(false), - Community: Ptr(""), + Enabled: new(false), + Community: new(""), }, Syslog: &ConfigSettingsSyslog{ - Enabled: Ptr(false), + Enabled: new(false), Server: nil, - ProtocolName: Ptr("udp"), + ProtocolName: new("udp"), }, Assets: nil, Pages: &ConfigSettingsPagesSettings{ - Enabled: Ptr(true), + Enabled: new(true), }, Collectd: &ConfigSettingsCollectd{ - Enabled: Ptr(false), + Enabled: new(false), Server: nil, - Port: Ptr(0), + Port: new(0), Encryption: nil, Username: nil, Password: nil, }, Mapping: &ConfigSettingsMapping{ - Enabled: Ptr(true), + Enabled: new(true), Tileserver: nil, - Basemap: Ptr("company.map-qsz2zrvs"), + Basemap: new("company.map-qsz2zrvs"), Token: nil, }, LoadBalancer: nil, @@ -334,7 +334,7 @@ func TestEnterpriseService_NodeMetadata(t *testing.T) { }) opt := &NodeQueryOptions{ - UUID: Ptr("1234-1234"), ClusterRoles: Ptr("primary"), + UUID: new("1234-1234"), ClusterRoles: new("primary"), } ctx := t.Context() configNodes, _, err := client.Enterprise.NodeMetadata(ctx, opt) @@ -343,10 +343,10 @@ func TestEnterpriseService_NodeMetadata(t *testing.T) { } want := &NodeMetadataStatus{ - Topology: Ptr("Cluster"), + Topology: new("Cluster"), Nodes: []*NodeDetails{{ - Hostname: Ptr("data1"), - UUID: Ptr("1b6cf518-f97c-11ed-8544-061d81f7eedb"), + Hostname: new("data1"), + UUID: new("1b6cf518-f97c-11ed-8544-061d81f7eedb"), ClusterRoles: []string{ "ConsulServer", }, @@ -384,7 +384,7 @@ func TestEnterpriseService_LicenseStatus(t *testing.T) { } want := []*LicenseCheck{{ - Status: Ptr("valid"), + Status: new("valid"), }} if !cmp.Equal(licenseCheck, want) { t.Errorf("Enterprise.LicenseStatus returned %+v, want %+v", licenseCheck, want) @@ -435,24 +435,24 @@ func TestEnterpriseService_License(t *testing.T) { } want := &LicenseStatus{ - AdvancedSecurityEnabled: Ptr(true), - AdvancedSecuritySeats: Ptr(0), - ClusterSupport: Ptr(false), - Company: Ptr("GitHub"), - CroquetSupport: Ptr(true), - CustomTerms: Ptr(true), - Evaluation: Ptr(false), + AdvancedSecurityEnabled: new(true), + AdvancedSecuritySeats: new(0), + ClusterSupport: new(false), + Company: new("GitHub"), + CroquetSupport: new(true), + CustomTerms: new(true), + Evaluation: new(false), ExpireAt: refTimestamp(1136178000), - InsightsEnabled: Ptr(true), + InsightsEnabled: new(true), InsightsExpireAt: refTimestamp(1136178001), LearningLabEvaluationExpires: refTimestamp(1136178002), - LearningLabSeats: Ptr(100), - Perpetual: Ptr(false), - ReferenceNumber: Ptr("32a145"), - Seats: Ptr(0), - SSHAllowed: Ptr(true), - SupportKey: Ptr(true), - UnlimitedSeating: Ptr(true), + LearningLabSeats: new(100), + Perpetual: new(false), + ReferenceNumber: new("32a145"), + Seats: new(0), + SSHAllowed: new(true), + SupportKey: new(true), + UnlimitedSeating: new(true), } if diff := cmp.Diff(want, license); diff != "" { t.Errorf("diff mismatch (-want +got):\n%v", diff) @@ -495,7 +495,7 @@ func TestEnterpriseService_ConfigApplyEvents(t *testing.T) { }) input := &ConfigApplyEventsOptions{ - LastRequestID: Ptr("387cd628c06d606700e79be368e5e574:0cde553750689"), + LastRequestID: new("387cd628c06d606700e79be368e5e574:0cde553750689"), } ctx := t.Context() @@ -506,20 +506,20 @@ func TestEnterpriseService_ConfigApplyEvents(t *testing.T) { want := &ConfigApplyEvents{ Nodes: []*ConfigApplyEventsNode{{ - Node: Ptr("ghes-01.lan"), - LastRequestID: Ptr("387cd628c06d606700e79be368e5e574:0cde553750689c76:0000000000000000"), + Node: new("ghes-01.lan"), + LastRequestID: new("387cd628c06d606700e79be368e5e574:0cde553750689c76:0000000000000000"), Events: []*ConfigApplyEventsNodeEvent{{ Timestamp: &referenceTimestamp, - SeverityText: Ptr("INFO"), - Body: Ptr("Validating services"), - EventName: Ptr("Enterprise::ConfigApply::PhaseValidation#config_phase_validation"), - Topology: Ptr("multinode"), - Hostname: Ptr("ghes-01.lan"), - ConfigRunID: Ptr("d34db33f"), - TraceID: Ptr("387cd628c06d606700e79be368e5e574"), - SpanID: Ptr("0cde553750689c76"), - SpanParentID: Ptr(int64(0)), - SpanDepth: Ptr(0), + SeverityText: new("INFO"), + Body: new("Validating services"), + EventName: new("Enterprise::ConfigApply::PhaseValidation#config_phase_validation"), + Topology: new("multinode"), + Hostname: new("ghes-01.lan"), + ConfigRunID: new("d34db33f"), + TraceID: new("387cd628c06d606700e79be368e5e574"), + SpanID: new("0cde553750689c76"), + SpanParentID: new(int64(0)), + SpanDepth: new(0), }}, }}, } @@ -551,7 +551,7 @@ func TestEnterpriseService_UpdateSettings(t *testing.T) { }) input := &ConfigSettings{ - PrivateMode: Ptr(false), + PrivateMode: new(false), } ctx := t.Context() @@ -621,7 +621,7 @@ func TestEnterpriseService_ConfigApply(t *testing.T) { client, mux, _ := setup(t) input := &ConfigApplyOptions{ - RunID: Ptr("1234"), + RunID: new("1234"), } mux.HandleFunc("/manage/v1/config/apply", func(w http.ResponseWriter, r *http.Request) { @@ -636,7 +636,7 @@ func TestEnterpriseService_ConfigApply(t *testing.T) { t.Errorf("Enterprise.ConfigApply returned error: %v", err) } want := &ConfigApplyOptions{ - RunID: Ptr("1234"), + RunID: new("1234"), } if !cmp.Equal(configApply, want) { t.Errorf("Enterprise.ConfigApply returned %+v, want %+v", configApply, want) @@ -657,7 +657,7 @@ func TestEnterpriseService_ConfigApplyStatus(t *testing.T) { client, mux, _ := setup(t) input := &ConfigApplyOptions{ - RunID: Ptr("1234"), + RunID: new("1234"), } mux.HandleFunc("/manage/v1/config/apply", func(w http.ResponseWriter, r *http.Request) { @@ -683,13 +683,13 @@ func TestEnterpriseService_ConfigApplyStatus(t *testing.T) { t.Errorf("Enterprise.ConfigApplyStatus returned error: %v", err) } want := &ConfigApplyStatus{ - Running: Ptr(true), - Successful: Ptr(false), + Running: new(true), + Successful: new(false), Nodes: []*ConfigApplyStatusNode{{ - RunID: Ptr("d34db33f"), - Hostname: Ptr("ghes-01.lan"), - Running: Ptr(true), - Successful: Ptr(false), + RunID: new("d34db33f"), + Hostname: new("ghes-01.lan"), + Running: new(true), + Successful: new(false), }}, } if !cmp.Equal(configApplyStatus, want) { diff --git a/github/enterprise_manage_ghes_maintenance_test.go b/github/enterprise_manage_ghes_maintenance_test.go index 0a3f3cf559d..8c124bd8045 100644 --- a/github/enterprise_manage_ghes_maintenance_test.go +++ b/github/enterprise_manage_ghes_maintenance_test.go @@ -43,7 +43,7 @@ func TestEnterpriseService_GetMaintenanceStatus(t *testing.T) { }) opt := &NodeQueryOptions{ - UUID: Ptr("1234-1234"), ClusterRoles: Ptr("primary"), + UUID: new("1234-1234"), ClusterRoles: new("primary"), } ctx := t.Context() maintenanceStatus, _, err := client.Enterprise.GetMaintenanceStatus(ctx, opt) @@ -52,17 +52,17 @@ func TestEnterpriseService_GetMaintenanceStatus(t *testing.T) { } want := []*MaintenanceStatus{{ - Hostname: Ptr("primary"), - UUID: Ptr("1b6cf518-f97c-11ed-8544-061d81f7eedb"), - Status: Ptr("scheduled"), + Hostname: new("primary"), + UUID: new("1b6cf518-f97c-11ed-8544-061d81f7eedb"), + Status: new("scheduled"), ScheduledTime: &referenceTimestamp, ConnectionServices: []*ConnectionServiceItem{{ - Name: Ptr("git operations"), - Number: Ptr(15), + Name: new("git operations"), + Number: new(15), }}, - CanUnsetMaintenance: Ptr(true), + CanUnsetMaintenance: new(true), IPExceptionList: []string{"1.1.1.1"}, - MaintenanceModeMessage: Ptr("Scheduled maintenance for upgrading."), + MaintenanceModeMessage: new("Scheduled maintenance for upgrading."), }} if !cmp.Equal(maintenanceStatus, want) { t.Errorf("Enterprise.GetMaintenanceStatus returned %+v, want %+v", maintenanceStatus, want) @@ -84,12 +84,12 @@ func TestEnterpriseService_CreateMaintenance(t *testing.T) { input := &MaintenanceOptions{ Enabled: true, - UUID: Ptr("1234-1234"), - When: Ptr("now"), + UUID: new("1234-1234"), + When: new("now"), IPExceptionList: []string{ "1.1.1.1", }, - MaintenanceModeMessage: Ptr("Scheduled maintenance for upgrading."), + MaintenanceModeMessage: new("Scheduled maintenance for upgrading."), } mux.HandleFunc("/manage/v1/maintenance", func(w http.ResponseWriter, r *http.Request) { @@ -104,7 +104,7 @@ func TestEnterpriseService_CreateMaintenance(t *testing.T) { t.Errorf("Enterprise.CreateMaintenance returned error: %v", err) } - want := []*MaintenanceOperationStatus{{Hostname: Ptr("primary"), UUID: Ptr("1b6cf518-f97c-11ed-8544-061d81f7eedb"), Message: Ptr("Scheduled maintenance for upgrading.")}} + want := []*MaintenanceOperationStatus{{Hostname: new("primary"), UUID: new("1b6cf518-f97c-11ed-8544-061d81f7eedb"), Message: new("Scheduled maintenance for upgrading.")}} if diff := cmp.Diff(want, maintenanceStatus); diff != "" { t.Errorf("diff mismatch (-want +got):\n%v", diff) } diff --git a/github/enterprise_manage_ghes_ssh_test.go b/github/enterprise_manage_ghes_ssh_test.go index 30cfdc23bf3..f319a5d132b 100644 --- a/github/enterprise_manage_ghes_ssh_test.go +++ b/github/enterprise_manage_ghes_ssh_test.go @@ -32,8 +32,8 @@ func TestEnterpriseService_GetSSHKey(t *testing.T) { } want := []*ClusterSSHKey{{ - Key: Ptr("ssh-rsa 1234"), - Fingerprint: Ptr("bd"), + Key: new("ssh-rsa 1234"), + Fingerprint: new("bd"), }} if !cmp.Equal(accessSSH, want) { t.Errorf("Enterprise.GetSSHKey returned %+v, want %+v", accessSSH, want) @@ -69,7 +69,7 @@ func TestEnterpriseService_DeleteSSHKey(t *testing.T) { t.Errorf("Enterprise.DeleteSSHKey returned error: %v", err) } - want := []*SSHKeyStatus{{Hostname: Ptr("primary"), UUID: Ptr("1b6cf518-f97c-11ed-8544-061d81f7eedb"), Message: Ptr("SSH key removed successfully")}} + want := []*SSHKeyStatus{{Hostname: new("primary"), UUID: new("1b6cf518-f97c-11ed-8544-061d81f7eedb"), Message: new("SSH key removed successfully")}} if diff := cmp.Diff(want, sshStatus); diff != "" { t.Errorf("diff mismatch (-want +got):\n%v", diff) } @@ -104,7 +104,7 @@ func TestEnterpriseService_CreateSSHKey(t *testing.T) { t.Errorf("Enterprise.CreateSSHKey returned error: %v", err) } - want := []*SSHKeyStatus{{Hostname: Ptr("primary"), UUID: Ptr("1b6cf518-f97c-11ed-8544-061d81f7eedb"), Message: Ptr("SSH key added successfully"), Modified: Ptr(true)}} + want := []*SSHKeyStatus{{Hostname: new("primary"), UUID: new("1b6cf518-f97c-11ed-8544-061d81f7eedb"), Message: new("SSH key added successfully"), Modified: new(true)}} if diff := cmp.Diff(want, sshStatus); diff != "" { t.Errorf("diff mismatch (-want +got):\n%v", diff) } diff --git a/github/enterprise_manage_ghes_test.go b/github/enterprise_manage_ghes_test.go index 1240b0cc5a6..fee760495ac 100644 --- a/github/enterprise_manage_ghes_test.go +++ b/github/enterprise_manage_ghes_test.go @@ -39,13 +39,13 @@ func TestEnterpriseService_CheckSystemRequirements(t *testing.T) { } want := &SystemRequirements{ - Status: Ptr("OK"), + Status: new("OK"), Nodes: []*SystemRequirementsNode{{ - Hostname: Ptr("primary"), - Status: Ptr("OK"), + Hostname: new("primary"), + Status: new("OK"), RolesStatus: []*SystemRequirementsNodeRoleStatus{{ - Status: Ptr("OK"), - Role: Ptr("ConsulServer"), + Status: new("OK"), + Role: new("ConsulServer"), }}, }}, } @@ -86,10 +86,10 @@ func TestEnterpriseService_ClusterStatus(t *testing.T) { } want := &ClusterStatus{ - Status: Ptr("OK"), + Status: new("OK"), Nodes: []*ClusterStatusNode{{ - Hostname: Ptr("primary"), - Status: Ptr("OK"), + Hostname: new("primary"), + Status: new("OK"), Services: []*ClusterStatusNodeServiceItem{}, }}, } @@ -128,7 +128,7 @@ func TestEnterpriseService_ReplicationStatus(t *testing.T) { }) opt := &NodeQueryOptions{ - UUID: Ptr("1234-1234"), ClusterRoles: Ptr("primary"), + UUID: new("1234-1234"), ClusterRoles: new("primary"), } ctx := t.Context() replicationStatus, _, err := client.Enterprise.ReplicationStatus(ctx, opt) @@ -137,10 +137,10 @@ func TestEnterpriseService_ReplicationStatus(t *testing.T) { } want := &ClusterStatus{ - Status: Ptr("OK"), + Status: new("OK"), Nodes: []*ClusterStatusNode{{ - Hostname: Ptr("primary"), - Status: Ptr("OK"), + Hostname: new("primary"), + Status: new("OK"), Services: []*ClusterStatusNodeServiceItem{}, }}, } @@ -180,7 +180,7 @@ func TestEnterpriseService_Versions(t *testing.T) { }) opt := &NodeQueryOptions{ - UUID: Ptr("1234-1234"), ClusterRoles: Ptr("primary"), + UUID: new("1234-1234"), ClusterRoles: new("primary"), } ctx := t.Context() releaseVersions, _, err := client.Enterprise.GetNodeReleaseVersions(ctx, opt) @@ -189,12 +189,12 @@ func TestEnterpriseService_Versions(t *testing.T) { } want := []*NodeReleaseVersion{{ - Hostname: Ptr("primary"), + Hostname: new("primary"), Version: &ReleaseVersion{ - Version: Ptr("3.9.0"), - Platform: Ptr("azure"), - BuildID: Ptr("fc542058b5"), - BuildDate: Ptr("2023-05-02"), + Version: new("3.9.0"), + Platform: new("azure"), + BuildID: new("fc542058b5"), + BuildDate: new("2023-05-02"), }, }} if !cmp.Equal(releaseVersions, want) { diff --git a/github/enterprise_network_configurations_test.go b/github/enterprise_network_configurations_test.go index c4154b5f654..e07fbc8444d 100644 --- a/github/enterprise_network_configurations_test.go +++ b/github/enterprise_network_configurations_test.go @@ -56,19 +56,19 @@ func TestEnterpriseService_ListEnterpriseNetworkConfigurations(t *testing.T) { } want := &NetworkConfigurations{ - TotalCount: Ptr(int64(2)), + TotalCount: new(int64(2)), NetworkConfigurations: []*NetworkConfiguration{ { - ID: Ptr("123456789ABCDEF"), - Name: Ptr("configuration one"), - ComputeService: Ptr(ComputeService("actions")), + ID: new("123456789ABCDEF"), + Name: new("configuration one"), + ComputeService: new(ComputeService("actions")), NetworkSettingsIDs: []string{"23456789ABDCEF1", "3456789ABDCEF12"}, CreatedOn: &referenceTimestamp, }, { - ID: Ptr("456789ABDCEF123"), - Name: Ptr("configuration two"), - ComputeService: Ptr(ComputeService("none")), + ID: new("456789ABDCEF123"), + Name: new("configuration two"), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{"56789ABDCEF1234", "6789ABDCEF12345"}, CreatedOn: &referenceTimestamp, }, @@ -113,8 +113,8 @@ func TestEnterpriseService_CreateEnterpriseNetworkConfiguration(t *testing.T) { ctx := t.Context() req := NetworkConfigurationRequest{ - Name: Ptr("configuration-one"), - ComputeService: Ptr(ComputeService("actions")), + Name: new("configuration-one"), + ComputeService: new(ComputeService("actions")), NetworkSettingsIDs: []string{ "23456789ABDCEF1", }, @@ -125,9 +125,9 @@ func TestEnterpriseService_CreateEnterpriseNetworkConfiguration(t *testing.T) { } want := &NetworkConfiguration{ - ID: Ptr("123456789ABCDEF"), - Name: Ptr("configuration one"), - ComputeService: Ptr(ComputeService("actions")), + ID: new("123456789ABCDEF"), + Name: new("configuration one"), + ComputeService: new(ComputeService("actions")), NetworkSettingsIDs: []string{"23456789ABDCEF1"}, CreatedOn: &referenceTimestamp, } @@ -143,7 +143,7 @@ func TestEnterpriseService_CreateEnterpriseNetworkConfiguration(t *testing.T) { { name: "invalid network settings id", request: NetworkConfigurationRequest{ - Name: Ptr(""), + Name: new(""), NetworkSettingsIDs: []string{"56789ABDCEF1234"}, }, want: "validation failed: must be between 1 and 100 characters", @@ -151,15 +151,15 @@ func TestEnterpriseService_CreateEnterpriseNetworkConfiguration(t *testing.T) { { name: "invalid network settings id", request: NetworkConfigurationRequest{ - Name: Ptr("updated-configuration-one"), + Name: new("updated-configuration-one"), }, want: "validation failed: exactly one network settings id must be specified", }, { name: "invalid compute service", request: NetworkConfigurationRequest{ - Name: Ptr("updated-configuration-one"), - ComputeService: Ptr(ComputeService("")), + Name: new("updated-configuration-one"), + ComputeService: new(ComputeService("")), NetworkSettingsIDs: []string{"56789ABDCEF1234"}, }, want: "validation failed: compute service can only be one of: none, actions", @@ -212,9 +212,9 @@ func TestEnterpriseService_GetEnterpriseNetworkConfiguration(t *testing.T) { } want := &NetworkConfiguration{ - ID: Ptr("123456789ABCDEF"), - Name: Ptr("configuration one"), - ComputeService: Ptr(ComputeService("actions")), + ID: new("123456789ABCDEF"), + Name: new("configuration one"), + ComputeService: new(ComputeService("actions")), NetworkSettingsIDs: []string{"23456789ABDCEF1", "3456789ABDCEF12"}, CreatedOn: &referenceTimestamp, } @@ -256,11 +256,11 @@ func TestEnterpriseService_UpdateEnterpriseNetworkConfiguration(t *testing.T) { ctx := t.Context() req := NetworkConfigurationRequest{ - Name: Ptr("updated-configuration-one"), + Name: new("updated-configuration-one"), NetworkSettingsIDs: []string{ "456789ABDCEF123", }, - ComputeService: Ptr(ComputeService("none")), + ComputeService: new(ComputeService("none")), } configuration, _, err := client.Enterprise.UpdateEnterpriseNetworkConfiguration(ctx, "e", "123456789ABCDEF", req) if err != nil { @@ -268,9 +268,9 @@ func TestEnterpriseService_UpdateEnterpriseNetworkConfiguration(t *testing.T) { } want := &NetworkConfiguration{ - ID: Ptr("123456789ABCDEF"), - Name: Ptr("updated configuration one"), - ComputeService: Ptr(ComputeService("none")), + ID: new("123456789ABCDEF"), + Name: new("updated configuration one"), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{"456789ABDCEF123"}, CreatedOn: &referenceTimestamp, } @@ -286,7 +286,7 @@ func TestEnterpriseService_UpdateEnterpriseNetworkConfiguration(t *testing.T) { { name: "invalid network settings id", request: NetworkConfigurationRequest{ - Name: Ptr(""), + Name: new(""), NetworkSettingsIDs: []string{"56789ABDCEF1234"}, }, want: "validation failed: must be between 1 and 100 characters", @@ -294,15 +294,15 @@ func TestEnterpriseService_UpdateEnterpriseNetworkConfiguration(t *testing.T) { { name: "invalid network settings id", request: NetworkConfigurationRequest{ - Name: Ptr("updated-configuration-one"), + Name: new("updated-configuration-one"), }, want: "validation failed: exactly one network settings id must be specified", }, { name: "invalid compute service", request: NetworkConfigurationRequest{ - Name: Ptr("updated-configuration-one"), - ComputeService: Ptr(ComputeService("something")), + Name: new("updated-configuration-one"), + ComputeService: new(ComputeService("something")), NetworkSettingsIDs: []string{"56789ABDCEF1234"}, }, want: "validation failed: compute service can only be one of: none, actions", @@ -377,11 +377,11 @@ func TestEnterpriseService_GetEnterpriseNetworkSettingsResource(t *testing.T) { } want := &NetworkSettingsResource{ - ID: Ptr("220F78DACB92BBFBC5E6F22DE1CCF52309D"), - NetworkConfigurationID: Ptr("934E208B3EE0BD60CF5F752C426BFB53562"), - Name: Ptr("my_network_settings"), - SubnetID: Ptr("/subscriptions/14839728-3ad9-43ab-bd2b-fa6ad0f75e2a/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet"), - Region: Ptr("germanywestcentral"), + ID: new("220F78DACB92BBFBC5E6F22DE1CCF52309D"), + NetworkConfigurationID: new("934E208B3EE0BD60CF5F752C426BFB53562"), + Name: new("my_network_settings"), + SubnetID: new("/subscriptions/14839728-3ad9-43ab-bd2b-fa6ad0f75e2a/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet"), + Region: new("germanywestcentral"), } if !cmp.Equal(resource, want) { t.Errorf("Enterprise.GetEnterpriseNetworkSettingsResource mismatch (-want +got):\n%v", cmp.Diff(want, resource)) diff --git a/github/enterprise_organization_properties_test.go b/github/enterprise_organization_properties_test.go index 567676eafb3..486bfe4d04e 100644 --- a/github/enterprise_organization_properties_test.go +++ b/github/enterprise_organization_properties_test.go @@ -37,9 +37,9 @@ func TestEnterpriseService_GetOrganizationCustomPropertySchema(t *testing.T) { want := &EnterpriseCustomPropertySchema{ Properties: []*CustomProperty{ { - PropertyName: Ptr("team"), + PropertyName: new("team"), ValueType: PropertyValueTypeString, - Description: Ptr("Team name"), + Description: new("Team name"), }, }, } @@ -73,7 +73,7 @@ func TestEnterpriseService_CreateOrUpdateOrganizationCustomPropertySchema(t *tes ctx := t.Context() schema := EnterpriseCustomPropertySchema{ - Properties: []*CustomProperty{{PropertyName: Ptr("team")}}, + Properties: []*CustomProperty{{PropertyName: new("team")}}, } _, err := client.Enterprise.CreateOrUpdateOrganizationCustomPropertySchema(ctx, "e", schema) if err != nil { @@ -110,9 +110,9 @@ func TestEnterpriseService_GetOrganizationCustomProperty(t *testing.T) { } want := &CustomProperty{ - PropertyName: Ptr("team"), + PropertyName: new("team"), ValueType: PropertyValueTypeString, - Description: Ptr("Team name"), + Description: new("Team name"), } if !cmp.Equal(got, want) { @@ -143,7 +143,7 @@ func TestEnterpriseService_CreateOrUpdateOrganizationCustomProperty(t *testing.T }) ctx := t.Context() - property := CustomProperty{PropertyName: Ptr("team")} + property := CustomProperty{PropertyName: new("team")} _, err := client.Enterprise.CreateOrUpdateOrganizationCustomProperty(ctx, "e", "prop", property) if err != nil { t.Errorf("Enterprise.CreateOrUpdateOrganizationCustomProperty returned error: %v", err) @@ -208,8 +208,8 @@ func TestEnterpriseService_ListOrganizationCustomPropertyValues(t *testing.T) { want := []*EnterpriseCustomPropertiesValues{ { - OrganizationID: Ptr(int64(1)), - OrganizationLogin: Ptr("org1"), + OrganizationID: new(int64(1)), + OrganizationLogin: new("org1"), Properties: []*CustomPropertyValue{ {PropertyName: "team", Value: "core"}, }, @@ -244,7 +244,7 @@ func TestEnterpriseService_CreateOrUpdateOrganizationCustomPropertyValues(t *tes }) ctx := t.Context() - values := []*CustomPropertyValue{{PropertyName: "team", Value: Ptr("core")}} + values := []*CustomPropertyValue{{PropertyName: "team", Value: new("core")}} orgs := []string{"org1"} opts := EnterpriseCustomPropertyValuesRequest{ diff --git a/github/enterprise_properties_test.go b/github/enterprise_properties_test.go index e6f62c4224a..e9c6c1cd04b 100644 --- a/github/enterprise_properties_test.go +++ b/github/enterprise_properties_test.go @@ -52,22 +52,22 @@ func TestEnterpriseService_GetAllCustomProperties(t *testing.T) { want := []*CustomProperty{ { - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), }, { - PropertyName: Ptr("service"), + PropertyName: new("service"), ValueType: PropertyValueTypeString, }, { - PropertyName: Ptr("team"), + PropertyName: new("team"), ValueType: PropertyValueTypeString, - Description: Ptr("Team owning the repository"), + Description: new("Team owning the repository"), }, } if !cmp.Equal(properties, want) { @@ -91,12 +91,12 @@ func TestEnterpriseService_CreateOrUpdateCustomProperties(t *testing.T) { properties := []*CustomProperty{ { - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), }, { - PropertyName: Ptr("service"), + PropertyName: new("service"), ValueType: PropertyValueTypeString, }, } @@ -129,12 +129,12 @@ func TestEnterpriseService_CreateOrUpdateCustomProperties(t *testing.T) { want := []*CustomProperty{ { - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), }, { - PropertyName: Ptr("service"), + PropertyName: new("service"), ValueType: PropertyValueTypeString, }, } @@ -181,13 +181,13 @@ func TestEnterpriseService_GetCustomProperty(t *testing.T) { } want := &CustomProperty{ - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), } if !cmp.Equal(property, want) { t.Errorf("Enterprise.GetCustomProperty returned %+v, want %+v", property, want) @@ -227,24 +227,24 @@ func TestEnterpriseService_CreateOrUpdateCustomProperty(t *testing.T) { ctx := t.Context() property, _, err := client.Enterprise.CreateOrUpdateCustomProperty(ctx, "e", "name", &CustomProperty{ ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), }) if err != nil { t.Errorf("Enterprise.CreateOrUpdateCustomProperty returned error: %v", err) } want := &CustomProperty{ - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), } if !cmp.Equal(property, want) { t.Errorf("Enterprise.CreateOrUpdateCustomProperty returned %+v, want %+v", property, want) diff --git a/github/enterprise_rules_test.go b/github/enterprise_rules_test.go index 73065a8e7d0..900934df504 100644 --- a/github/enterprise_rules_test.go +++ b/github/enterprise_rules_test.go @@ -176,12 +176,12 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) ctx := t.Context() ruleset, _, err := client.Enterprise.CreateRepositoryRuleset(ctx, "e", RepositoryRuleset{ Name: "ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -192,7 +192,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, RefName: &RepositoryRulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, @@ -219,19 +219,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -240,20 +240,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -273,16 +273,16 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) } want := &RepositoryRuleset{ - ID: Ptr(int64(84)), + ID: new(int64(84)), Name: "ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeEnterprise), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeEnterprise), Source: "e", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -293,7 +293,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, RefName: &RepositoryRulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, @@ -320,19 +320,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -341,20 +341,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoName(t *testing.T) Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -600,12 +600,12 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin ctx := t.Context() ruleset, _, err := client.Enterprise.CreateRepositoryRuleset(ctx, "e", RepositoryRuleset{ Name: "ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -617,7 +617,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -653,19 +653,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -674,20 +674,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -707,16 +707,16 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin } want := &RepositoryRuleset{ - ID: Ptr(int64(84)), + ID: new(int64(84)), Name: "ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeEnterprise), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeEnterprise), Source: "e", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -728,7 +728,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -764,19 +764,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -785,20 +785,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgNameRepoProperty(t *testin Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -985,12 +985,12 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { ctx := t.Context() ruleset, _, err := client.Enterprise.CreateRepositoryRuleset(ctx, "e", RepositoryRuleset{ Name: "ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -1000,7 +1000,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, RefName: &RepositoryRulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, @@ -1027,19 +1027,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -1048,20 +1048,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -1081,16 +1081,16 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(84)), + ID: new(int64(84)), Name: "ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeEnterprise), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeEnterprise), Source: "e", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -1100,7 +1100,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, RefName: &RepositoryRulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, @@ -1127,19 +1127,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -1148,20 +1148,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoName(t *testing.T) { Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -1357,12 +1357,12 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. ctx := t.Context() ruleset, _, err := client.Enterprise.CreateRepositoryRuleset(ctx, "e", RepositoryRuleset{ Name: "ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -1373,7 +1373,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -1409,19 +1409,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -1430,20 +1430,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -1463,16 +1463,16 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. } want := &RepositoryRuleset{ - ID: Ptr(int64(84)), + ID: new(int64(84)), Name: "ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeEnterprise), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeEnterprise), Source: "e", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -1483,7 +1483,7 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -1519,19 +1519,19 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -1540,20 +1540,20 @@ func TestEnterpriseService_CreateRepositoryRuleset_OrgIdRepoProperty(t *testing. Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -1648,15 +1648,15 @@ func TestEnterpriseService_GetRepositoryRuleset(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(84)), + ID: new(int64(84)), Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeEnterprise), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeEnterprise), Source: "e", Enforcement: "active", - NodeID: Ptr("nid"), + NodeID: new("nid"), Links: &RepositoryRulesetLinks{ - Self: &RepositoryRulesetLink{HRef: Ptr("https://api.github.com/enterprises/e/rulesets/84")}, + Self: &RepositoryRulesetLink{HRef: new("https://api.github.com/enterprises/e/rulesets/84")}, }, Conditions: &RepositoryRulesetConditions{ OrganizationName: &RepositoryRulesetOrganizationNamesConditionParameters{ @@ -1666,7 +1666,7 @@ func TestEnterpriseService_GetRepositoryRuleset(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, RefName: &RepositoryRulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, @@ -1751,7 +1751,7 @@ func TestEnterpriseService_UpdateRepositoryRuleset(t *testing.T) { ctx := t.Context() rulesets, _, err := client.Enterprise.UpdateRepositoryRuleset(ctx, "e", 84, RepositoryRuleset{ Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", Conditions: &RepositoryRulesetConditions{ RefName: &RepositoryRulesetRefConditionParameters{ @@ -1761,7 +1761,7 @@ func TestEnterpriseService_UpdateRepositoryRuleset(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, }, Rules: &RepositoryRulesetRules{Creation: &EmptyRuleParameters{}}, @@ -1771,15 +1771,15 @@ func TestEnterpriseService_UpdateRepositoryRuleset(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(84)), + ID: new(int64(84)), Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeEnterprise), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeEnterprise), Source: "e", Enforcement: "active", - NodeID: Ptr("nid"), + NodeID: new("nid"), Links: &RepositoryRulesetLinks{ - Self: &RepositoryRulesetLink{HRef: Ptr("https://api.github.com/enterprises/e/rulesets/84")}, + Self: &RepositoryRulesetLink{HRef: new("https://api.github.com/enterprises/e/rulesets/84")}, }, Conditions: &RepositoryRulesetConditions{ OrganizationName: &RepositoryRulesetOrganizationNamesConditionParameters{ @@ -1789,7 +1789,7 @@ func TestEnterpriseService_UpdateRepositoryRuleset(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, RefName: &RepositoryRulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, diff --git a/github/enterprise_scim_test.go b/github/enterprise_scim_test.go index c0759fff5f2..c5d2727d9a2 100644 --- a/github/enterprise_scim_test.go +++ b/github/enterprise_scim_test.go @@ -54,10 +54,10 @@ func TestEnterpriseService_ListProvisionedSCIMGroups(t *testing.T) { ctx := t.Context() opts := &ListProvisionedSCIMGroupsEnterpriseOptions{ - StartIndex: Ptr(1), - ExcludedAttributes: Ptr("members,meta"), - Count: Ptr(3), - Filter: Ptr(`externalId eq "914a"`), + StartIndex: new(1), + ExcludedAttributes: new("members,meta"), + Count: new(3), + Filter: new(`externalId eq "914a"`), } got, _, err := client.Enterprise.ListProvisionedSCIMGroups(ctx, "ee", opts) if err != nil { @@ -66,24 +66,24 @@ func TestEnterpriseService_ListProvisionedSCIMGroups(t *testing.T) { want := &SCIMEnterpriseGroups{ Schemas: []string{SCIMSchemasURINamespacesListResponse}, - TotalResults: Ptr(1), - ItemsPerPage: Ptr(1), - StartIndex: Ptr(1), + TotalResults: new(1), + ItemsPerPage: new(1), + StartIndex: new(1), Resources: []*SCIMEnterpriseGroupAttributes{{ - ID: Ptr("914a"), + ID: new("914a"), Meta: &SCIMEnterpriseMeta{ ResourceType: "Group", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.com/scim/v2/enterprises/ee/Groups/914a"), + Location: new("https://api.github.com/scim/v2/enterprises/ee/Groups/914a"), }, - DisplayName: Ptr("gn1"), + DisplayName: new("gn1"), Schemas: []string{SCIMSchemasURINamespacesGroups}, - ExternalID: Ptr("de88"), + ExternalID: new("de88"), Members: []*SCIMEnterpriseDisplayReference{{ Value: "e7f9", - Ref: Ptr("https://api.github.com/scim/v2/enterprises/ee/Users/e7f9"), - Display: Ptr("d1"), + Ref: new("https://api.github.com/scim/v2/enterprises/ee/Users/e7f9"), + Display: new("d1"), }}, }}, } @@ -157,9 +157,9 @@ func TestEnterpriseService_ListProvisionedSCIMUsers(t *testing.T) { ctx := t.Context() opts := &ListProvisionedSCIMUsersEnterpriseOptions{ - StartIndex: Ptr(1), - Count: Ptr(3), - Filter: Ptr(`userName eq "octocat@github.com"`), + StartIndex: new(1), + Count: new(3), + Filter: new(`userName eq "octocat@github.com"`), } got, _, err := client.Enterprise.ListProvisionedSCIMUsers(ctx, "ee", opts) if err != nil { @@ -168,19 +168,19 @@ func TestEnterpriseService_ListProvisionedSCIMUsers(t *testing.T) { want := &SCIMEnterpriseUsers{ Schemas: []string{SCIMSchemasURINamespacesListResponse}, - TotalResults: Ptr(1), - ItemsPerPage: Ptr(1), - StartIndex: Ptr(1), + TotalResults: new(1), + ItemsPerPage: new(1), + StartIndex: new(1), Resources: []*SCIMEnterpriseUserAttributes{{ Schemas: []string{SCIMSchemasURINamespacesUser}, - ID: Ptr("5fc0"), + ID: new("5fc0"), ExternalID: "00u1", UserName: "octocat@github.com", DisplayName: "Mona Octocat", Name: &SCIMEnterpriseUserName{ GivenName: "Mona", FamilyName: "Octocat", - Formatted: Ptr("Mona Octocat"), + Formatted: new("Mona Octocat"), }, Emails: []*SCIMEnterpriseUserEmail{{ Value: "octocat@github.com", @@ -191,7 +191,7 @@ func TestEnterpriseService_ListProvisionedSCIMUsers(t *testing.T) { ResourceType: "User", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.com/scim/v2/enterprises/ee/Users/5fc0"), + Location: new("https://api.github.com/scim/v2/enterprises/ee/Users/5fc0"), }, }}, } @@ -221,8 +221,8 @@ func TestEnterpriseService_SetProvisionedSCIMGroup(t *testing.T) { input := SCIMEnterpriseGroupAttributes{ Schemas: []string{SCIMSchemasURINamespacesGroups}, - ExternalID: Ptr("8aa1"), - DisplayName: Ptr("dn"), + ExternalID: new("8aa1"), + DisplayName: new("dn"), } mux.HandleFunc("/scim/v2/enterprises/ee/Groups/abcd", func(w http.ResponseWriter, r *http.Request) { @@ -245,14 +245,14 @@ func TestEnterpriseService_SetProvisionedSCIMGroup(t *testing.T) { }) want := &SCIMEnterpriseGroupAttributes{ Schemas: []string{SCIMSchemasURINamespacesGroups}, - ID: Ptr("abcd"), - ExternalID: Ptr("8aa1"), - DisplayName: Ptr("dn"), + ID: new("abcd"), + ExternalID: new("8aa1"), + DisplayName: new("dn"), Meta: &SCIMEnterpriseMeta{ ResourceType: "Group", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Groups/abcd"), + Location: new("https://api.github.localhost/scim/v2/enterprises/ee/Groups/abcd"), }, } @@ -324,7 +324,7 @@ func TestEnterpriseService_SetProvisionedSCIMUser(t *testing.T) { }) want := &SCIMEnterpriseUserAttributes{ Schemas: []string{SCIMSchemasURINamespacesUser}, - ID: Ptr("7fce"), + ID: new("7fce"), ExternalID: "e123", Active: true, UserName: "e123", @@ -338,7 +338,7 @@ func TestEnterpriseService_SetProvisionedSCIMUser(t *testing.T) { ResourceType: "User", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Users/7fce"), + Location: new("https://api.github.localhost/scim/v2/enterprises/ee/Users/7fce"), }, } @@ -374,7 +374,7 @@ func TestEnterpriseService_UpdateSCIMGroupAttribute(t *testing.T) { Schemas: []string{SCIMSchemasURINamespacesPatchOp}, Operations: []*SCIMEnterpriseAttributeOperation{{ Op: "replace", - Path: Ptr("displayName"), + Path: new("displayName"), Value: "Employees", }}, } @@ -404,19 +404,19 @@ func TestEnterpriseService_UpdateSCIMGroupAttribute(t *testing.T) { }) want := &SCIMEnterpriseGroupAttributes{ Schemas: []string{SCIMSchemasURINamespacesGroups}, - ID: Ptr("abcd"), - ExternalID: Ptr("8aa1"), - DisplayName: Ptr("Employees"), + ID: new("abcd"), + ExternalID: new("8aa1"), + DisplayName: new("Employees"), Members: []*SCIMEnterpriseDisplayReference{{ Value: "879d", - Ref: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Users/879d"), - Display: Ptr("User 1"), + Ref: new("https://api.github.localhost/scim/v2/enterprises/ee/Users/879d"), + Display: new("User 1"), }}, Meta: &SCIMEnterpriseMeta{ ResourceType: "Group", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Groups/abcd"), + Location: new("https://api.github.localhost/scim/v2/enterprises/ee/Groups/abcd"), }, } @@ -452,11 +452,11 @@ func TestEnterpriseService_UpdateSCIMUserAttribute(t *testing.T) { Schemas: []string{SCIMSchemasURINamespacesPatchOp}, Operations: []*SCIMEnterpriseAttributeOperation{{ Op: "replace", - Path: Ptr("emails[type eq 'work'].value"), + Path: new("emails[type eq 'work'].value"), Value: "updatedEmail@example.com", }, { Op: "replace", - Path: Ptr("name.familyName"), + Path: new("name.familyName"), Value: "updatedFamilyName", }}, } @@ -498,16 +498,16 @@ func TestEnterpriseService_UpdateSCIMUserAttribute(t *testing.T) { }) want := &SCIMEnterpriseUserAttributes{ Schemas: []string{SCIMSchemasURINamespacesUser}, - ID: Ptr("7fce"), + ID: new("7fce"), ExternalID: "e123", Active: true, UserName: "e123", DisplayName: "John Doe", Name: &SCIMEnterpriseUserName{ - Formatted: Ptr("John Doe X"), + Formatted: new("John Doe X"), FamilyName: "updatedFamilyName", GivenName: "John", - MiddleName: Ptr("X"), + MiddleName: new("X"), }, Emails: []*SCIMEnterpriseUserEmail{{ Value: "john@example.com", @@ -516,13 +516,13 @@ func TestEnterpriseService_UpdateSCIMUserAttribute(t *testing.T) { }}, Roles: []*SCIMEnterpriseUserRole{{ Value: "User", - Primary: Ptr(false), + Primary: new(false), }}, Meta: &SCIMEnterpriseMeta{ ResourceType: "User", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Users/7fce"), + Location: new("https://api.github.localhost/scim/v2/enterprises/ee/Users/7fce"), }, } @@ -556,14 +556,14 @@ func TestEnterpriseService_ProvisionSCIMGroup(t *testing.T) { input := SCIMEnterpriseGroupAttributes{ Schemas: []string{SCIMSchemasURINamespacesGroups}, - ExternalID: Ptr("8aa1"), - DisplayName: Ptr("dn"), + ExternalID: new("8aa1"), + DisplayName: new("dn"), Members: []*SCIMEnterpriseDisplayReference{{ Value: "879d", - Display: Ptr("d1"), + Display: new("d1"), }, { Value: "0db5", - Display: Ptr("d2"), + Display: new("d2"), }}, } @@ -599,23 +599,23 @@ func TestEnterpriseService_ProvisionSCIMGroup(t *testing.T) { }) want := &SCIMEnterpriseGroupAttributes{ Schemas: []string{SCIMSchemasURINamespacesGroups}, - ID: Ptr("abcd"), - ExternalID: Ptr("8aa1"), - DisplayName: Ptr("dn"), + ID: new("abcd"), + ExternalID: new("8aa1"), + DisplayName: new("dn"), Members: []*SCIMEnterpriseDisplayReference{{ Value: "879d", - Ref: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Users/879d"), - Display: Ptr("d1"), + Ref: new("https://api.github.localhost/scim/v2/enterprises/ee/Users/879d"), + Display: new("d1"), }, { Value: "0db5", - Ref: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Users/0db5"), - Display: Ptr("d2"), + Ref: new("https://api.github.localhost/scim/v2/enterprises/ee/Users/0db5"), + Display: new("d2"), }}, Meta: &SCIMEnterpriseMeta{ ResourceType: "Group", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Groups/abcd"), + Location: new("https://api.github.localhost/scim/v2/enterprises/ee/Groups/abcd"), }, } @@ -653,7 +653,7 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) { Active: true, UserName: "e123", Name: &SCIMEnterpriseUserName{ - Formatted: Ptr("John Doe"), + Formatted: new("John Doe"), FamilyName: "Doe", GivenName: "John", }, @@ -665,7 +665,7 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) { }}, Roles: []*SCIMEnterpriseUserRole{{ Value: "User", - Primary: Ptr(false), + Primary: new(false), }}, } @@ -705,13 +705,13 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) { }) want := &SCIMEnterpriseUserAttributes{ Schemas: []string{SCIMSchemasURINamespacesUser}, - ID: Ptr("7fce"), + ID: new("7fce"), ExternalID: "e123", Active: true, UserName: "e123", DisplayName: "DOE John", Name: &SCIMEnterpriseUserName{ - Formatted: Ptr("John Doe"), + Formatted: new("John Doe"), FamilyName: "Doe", GivenName: "John", }, @@ -722,13 +722,13 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) { }}, Roles: []*SCIMEnterpriseUserRole{{ Value: "User", - Primary: Ptr(false), + Primary: new(false), }}, Meta: &SCIMEnterpriseMeta{ ResourceType: "User", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.localhost/scim/v2/enterprises/ee/Users/7fce"), + Location: new("https://api.github.localhost/scim/v2/enterprises/ee/Users/7fce"), }, } @@ -785,27 +785,27 @@ func TestEnterpriseService_GetProvisionedSCIMGroup(t *testing.T) { }) ctx := t.Context() - opts := &GetProvisionedSCIMGroupEnterpriseOptions{ExcludedAttributes: Ptr("members,meta")} + opts := &GetProvisionedSCIMGroupEnterpriseOptions{ExcludedAttributes: new("members,meta")} got, _, err := client.Enterprise.GetProvisionedSCIMGroup(ctx, "ee", "914a", opts) if err != nil { t.Fatalf("Enterprise.GetProvisionedSCIMGroup returned unexpected error: %v", err) } want := &SCIMEnterpriseGroupAttributes{ - ID: Ptr("914a"), + ID: new("914a"), Meta: &SCIMEnterpriseMeta{ ResourceType: "Group", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.com/scim/v2/enterprises/ee/Groups/914a"), + Location: new("https://api.github.com/scim/v2/enterprises/ee/Groups/914a"), }, - DisplayName: Ptr("gn1"), + DisplayName: new("gn1"), Schemas: []string{SCIMSchemasURINamespacesGroups}, - ExternalID: Ptr("de88"), + ExternalID: new("de88"), Members: []*SCIMEnterpriseDisplayReference{{ Value: "e7f9", - Ref: Ptr("https://api.github.com/scim/v2/enterprises/ee/Users/e7f9"), - Display: Ptr("d1"), + Ref: new("https://api.github.com/scim/v2/enterprises/ee/Users/e7f9"), + Display: new("d1"), }}, } @@ -871,14 +871,14 @@ func TestEnterpriseService_GetProvisionedSCIMUser(t *testing.T) { want := &SCIMEnterpriseUserAttributes{ Schemas: []string{SCIMSchemasURINamespacesUser}, - ID: Ptr("5fc0"), + ID: new("5fc0"), ExternalID: "00u1", UserName: "octocat@github.com", DisplayName: "Mona Octocat", Name: &SCIMEnterpriseUserName{ GivenName: "Mona", FamilyName: "Octocat", - Formatted: Ptr("Mona Octocat"), + Formatted: new("Mona Octocat"), }, Emails: []*SCIMEnterpriseUserEmail{{ Value: "octocat@github.com", @@ -889,7 +889,7 @@ func TestEnterpriseService_GetProvisionedSCIMUser(t *testing.T) { ResourceType: "User", Created: &Timestamp{referenceTime}, LastModified: &Timestamp{referenceTime}, - Location: Ptr("https://api.github.com/scim/v2/enterprises/ee/Users/5fc0"), + Location: new("https://api.github.com/scim/v2/enterprises/ee/Users/5fc0"), }, } diff --git a/github/enterprise_team_test.go b/github/enterprise_team_test.go index e8a9562fcae..588b6b04bc1 100644 --- a/github/enterprise_team_test.go +++ b/github/enterprise_team_test.go @@ -255,9 +255,9 @@ func TestEnterpriseService_ListTeamMembers(t *testing.T) { want := []*User{ { - Login: Ptr("user1"), - ID: Ptr(int64(1001)), - URL: Ptr("https://example.com/user1"), + Login: new("user1"), + ID: new(int64(1001)), + URL: new("https://example.com/user1"), }, } @@ -302,8 +302,8 @@ func TestEnterpriseService_BulkAddTeamMembers(t *testing.T) { } want := []*User{ - {Login: Ptr("u1"), ID: Ptr(int64(1))}, - {Login: Ptr("u2"), ID: Ptr(int64(2))}, + {Login: new("u1"), ID: new(int64(1))}, + {Login: new("u2"), ID: new(int64(2))}, } if !cmp.Equal(got, want) { @@ -347,8 +347,8 @@ func TestEnterpriseService_BulkRemoveTeamMembers(t *testing.T) { } want := []*User{ - {Login: Ptr("u1"), ID: Ptr(int64(1))}, - {Login: Ptr("u2"), ID: Ptr(int64(2))}, + {Login: new("u1"), ID: new(int64(1))}, + {Login: new("u2"), ID: new(int64(2))}, } if !cmp.Equal(got, want) { @@ -388,8 +388,8 @@ func TestEnterpriseService_GetTeamMembership(t *testing.T) { } want := &User{ - Login: Ptr("u1"), - ID: Ptr(int64(10)), + Login: new("u1"), + ID: new(int64(10)), } if !cmp.Equal(got, want) { @@ -429,8 +429,8 @@ func TestEnterpriseService_AddTeamMember(t *testing.T) { } want := &User{ - Login: Ptr("u1"), - ID: Ptr(int64(5)), + Login: new("u1"), + ID: new(int64(5)), } if !cmp.Equal(got, want) { @@ -512,18 +512,18 @@ func TestEnterpriseService_ListAssignments(t *testing.T) { want := []*Organization{ { - Login: Ptr("team-one"), - URL: Ptr("https://example.com/team1"), - NodeID: Ptr("node-id"), - ReposURL: Ptr("https://example.com/members"), - EventsURL: Ptr("https://example.com/events"), - ID: Ptr(int64(1)), - HooksURL: Ptr("https://api.github.com/orgs/team-one/hooks"), - IssuesURL: Ptr("https://api.github.com/orgs/team-one/issues"), - MembersURL: Ptr("https://api.github.com/orgs/team-one/members"), - PublicMembersURL: Ptr("https://api.github.com/orgs/team-one/public_members"), - AvatarURL: Ptr("https://github.com/images/error/octocat_happy.gif"), - Description: Ptr("Team One"), + Login: new("team-one"), + URL: new("https://example.com/team1"), + NodeID: new("node-id"), + ReposURL: new("https://example.com/members"), + EventsURL: new("https://example.com/events"), + ID: new(int64(1)), + HooksURL: new("https://api.github.com/orgs/team-one/hooks"), + IssuesURL: new("https://api.github.com/orgs/team-one/issues"), + MembersURL: new("https://api.github.com/orgs/team-one/members"), + PublicMembersURL: new("https://api.github.com/orgs/team-one/public_members"), + AvatarURL: new("https://github.com/images/error/octocat_happy.gif"), + Description: new("Team One"), }, } @@ -569,8 +569,8 @@ func TestEnterpriseService_AddMultipleAssignments(t *testing.T) { } want := []*Organization{ - {Login: Ptr("o1"), ID: Ptr(int64(1))}, - {Login: Ptr("o2"), ID: Ptr(int64(2))}, + {Login: new("o1"), ID: new(int64(1))}, + {Login: new("o2"), ID: new(int64(2))}, } if !cmp.Equal(got, want) { @@ -614,8 +614,8 @@ func TestEnterpriseService_RemoveMultipleAssignments(t *testing.T) { } want := []*Organization{ - {Login: Ptr("o1"), ID: Ptr(int64(1))}, - {Login: Ptr("o2"), ID: Ptr(int64(2))}, + {Login: new("o1"), ID: new(int64(1))}, + {Login: new("o2"), ID: new(int64(2))}, } if !cmp.Equal(got, want) { @@ -655,8 +655,8 @@ func TestEnterpriseService_GetAssignment(t *testing.T) { } want := &Organization{ - Login: Ptr("o1"), - ID: Ptr(int64(10)), + Login: new("o1"), + ID: new(int64(10)), } if !cmp.Equal(got, want) { @@ -696,8 +696,8 @@ func TestEnterpriseService_AddAssignment(t *testing.T) { } want := &Organization{ - Login: Ptr("o1"), - ID: Ptr(int64(5)), + Login: new("o1"), + ID: new(int64(5)), } if !cmp.Equal(got, want) { diff --git a/github/event_test.go b/github/event_test.go index bbcf6d126b3..a516416c00d 100644 --- a/github/event_test.go +++ b/github/event_test.go @@ -19,14 +19,14 @@ func TestPayload_Panic(t *testing.T) { }() body := json.RawMessage("[") // bogus JSON - e := &Event{Type: Ptr("UserEvent"), RawPayload: &body} + e := &Event{Type: new("UserEvent"), RawPayload: &body} e.Payload() } func TestPayload_NoPanic(t *testing.T) { t.Parallel() body := json.RawMessage("{}") - e := &Event{Type: Ptr("UserEvent"), RawPayload: &body} + e := &Event{Type: new("UserEvent"), RawPayload: &body} e.Payload() } diff --git a/github/examples_test.go b/github/examples_test.go index e1c373b841d..c4a37952f1e 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -91,10 +91,10 @@ func ExampleRepositoriesService_CreateFile() { // Note: the file needs to be absent from the repository as you are not // specifying a SHA reference here. opts := &github.RepositoryContentFileOptions{ - Message: github.Ptr("This is my commit message"), + Message: new("This is my commit message"), Content: fileContent, - Branch: github.Ptr("master"), - Committer: &github.CommitAuthor{Name: github.Ptr("FirstName LastName"), Email: github.Ptr("user@example.com")}, + Branch: new("master"), + Committer: &github.CommitAuthor{Name: new("FirstName LastName"), Email: new("user@example.com")}, } if _, _, err := client.Repositories.CreateFile(ctx, "myOrganization", "myRepository", "myNewFile.md", opts); err != nil { log.Fatalf("Error creating file: %v", err) @@ -136,11 +136,11 @@ func ExamplePullRequestsService_Create() { } newPR := github.CreatePullRequest{ - Title: github.Ptr("My awesome pull request"), + Title: new("My awesome pull request"), Head: "branch_to_merge", Base: "master", - Body: github.Ptr("This is the description of the PR created with the package `github.com/google/go-github/github`"), - MaintainerCanModify: github.Ptr(true), + Body: new("This is the description of the PR created with the package `github.com/google/go-github/github`"), + MaintainerCanModify: new(true), } ctx := context.Background() diff --git a/github/gists_comments_test.go b/github/gists_comments_test.go index a18022cbb93..a5bb3f6deb7 100644 --- a/github/gists_comments_test.go +++ b/github/gists_comments_test.go @@ -30,7 +30,7 @@ func TestGistsService_ListComments(t *testing.T) { t.Errorf("Gists.ListComments returned error: %v", err) } - want := []*GistComment{{ID: Ptr(int64(1))}} + want := []*GistComment{{ID: new(int64(1))}} if !cmp.Equal(comments, want) { t.Errorf("Gists.ListComments returned %+v, want %+v", comments, want) } @@ -74,7 +74,7 @@ func TestGistsService_GetComment(t *testing.T) { t.Errorf("Gists.GetComment returned error: %v", err) } - want := &GistComment{ID: Ptr(int64(1))} + want := &GistComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Gists.GetComment returned %+v, want %+v", comment, want) } @@ -121,7 +121,7 @@ func TestGistsService_CreateComment(t *testing.T) { t.Errorf("Gists.CreateComment returned error: %v", err) } - want := &GistComment{ID: Ptr(int64(1))} + want := &GistComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Gists.CreateComment returned %+v, want %+v", comment, want) } @@ -168,7 +168,7 @@ func TestGistsService_UpdateComment(t *testing.T) { t.Errorf("Gists.UpdateComment returned error: %v", err) } - want := &GistComment{ID: Ptr(int64(1))} + want := &GistComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Gists.UpdateComment returned %+v, want %+v", comment, want) } diff --git a/github/gists_test.go b/github/gists_test.go index 6a5b2859e5e..e024454d251 100644 --- a/github/gists_test.go +++ b/github/gists_test.go @@ -32,7 +32,7 @@ func TestGistsService_List_specifiedUser(t *testing.T) { t.Errorf("Gists.List returned error: %v", err) } - want := []*Gist{{ID: Ptr("1")}} + want := []*Gist{{ID: new("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.List returned %+v, want %+v", gists, want) } @@ -67,7 +67,7 @@ func TestGistsService_List_authenticatedUser(t *testing.T) { t.Errorf("Gists.List returned error: %v", err) } - want := []*Gist{{ID: Ptr("1")}} + want := []*Gist{{ID: new("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.List returned %+v, want %+v", gists, want) } @@ -115,7 +115,7 @@ func TestGistsService_ListAll(t *testing.T) { t.Errorf("Gists.ListAll returned error: %v", err) } - want := []*Gist{{ID: Ptr("1")}} + want := []*Gist{{ID: new("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.ListAll returned %+v, want %+v", gists, want) } @@ -149,7 +149,7 @@ func TestGistsService_ListStarred(t *testing.T) { t.Errorf("Gists.ListStarred returned error: %v", err) } - want := []*Gist{{ID: Ptr("1")}} + want := []*Gist{{ID: new("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.ListStarred returned %+v, want %+v", gists, want) } @@ -179,7 +179,7 @@ func TestGistsService_Get(t *testing.T) { t.Errorf("Gists.Get returned error: %v", err) } - want := &Gist{ID: Ptr("1")} + want := &Gist{ID: new("1")} if !cmp.Equal(gist, want) { t.Errorf("Gists.Get returned %+v, want %+v", gist, want) } @@ -223,7 +223,7 @@ func TestGistsService_GetRevision(t *testing.T) { t.Errorf("Gists.GetRevision returned error: %v", err) } - want := &Gist{ID: Ptr("1")} + want := &Gist{ID: new("1")} if !cmp.Equal(gist, want) { t.Errorf("Gists.GetRevision returned %+v, want %+v", gist, want) } @@ -257,8 +257,8 @@ func TestGistsService_Create(t *testing.T) { client, mux, _ := setup(t) input := CreateGistRequest{ - Description: Ptr("Gist description"), - Public: Ptr(false), + Description: new("Gist description"), + Public: new(false), Files: map[GistFilename]*CreateGistFile{ "test.txt": {Content: "Gist file content"}, }, @@ -289,11 +289,11 @@ func TestGistsService_Create(t *testing.T) { } want := &Gist{ - ID: Ptr("1"), - Description: Ptr("Gist description"), - Public: Ptr(false), + ID: new("1"), + Description: new("Gist description"), + Public: new(false), Files: map[GistFilename]GistFile{ - "test.txt": {Filename: Ptr("test.txt")}, + "test.txt": {Filename: new("test.txt")}, }, } if !cmp.Equal(gist, want) { @@ -315,9 +315,9 @@ func TestGistsService_Update(t *testing.T) { client, mux, _ := setup(t) input := UpdateGistRequest{ - Description: Ptr("New description"), + Description: new("New description"), Files: map[GistFilename]*UpdateGistFile{ - "new.txt": {Content: Ptr("new file content")}, + "new.txt": {Content: new("new file content")}, // A nil value deletes the file from the gist. "old.txt": nil, }, @@ -351,12 +351,12 @@ func TestGistsService_Update(t *testing.T) { } want := &Gist{ - ID: Ptr("1"), - Description: Ptr("new description"), - Public: Ptr(false), + ID: new("1"), + Description: new("new description"), + Public: new(false), Files: map[GistFilename]GistFile{ - "test.txt": {Filename: Ptr("test.txt")}, - "new.txt": {Filename: Ptr("new.txt")}, + "test.txt": {Filename: new("test.txt")}, + "new.txt": {Filename: new("new.txt")}, }, } if !cmp.Equal(gist, want) { @@ -420,14 +420,14 @@ func TestGistsService_ListCommits(t *testing.T) { } want := []*GistCommit{{ - URL: Ptr("https://api.github.com/gists/1/1"), - Version: Ptr("1"), - User: &User{ID: Ptr(int64(1))}, + URL: new("https://api.github.com/gists/1/1"), + Version: new("1"), + User: &User{ID: new(int64(1))}, CommittedAt: &referenceTimestamp, ChangeStatus: &CommitStats{ - Additions: Ptr(180), - Deletions: Ptr(0), - Total: Ptr(180), + Additions: new(180), + Deletions: new(0), + Total: new(180), }, }} @@ -684,7 +684,7 @@ func TestGistsService_Fork(t *testing.T) { t.Errorf("Gists.Fork returned error: %v", err) } - want := &Gist{ID: Ptr("2")} + want := &Gist{ID: new("2")} if !cmp.Equal(gist, want) { t.Errorf("Gists.Fork returned %+v, want %+v", gist, want) } @@ -730,9 +730,9 @@ func TestGistsService_ListForks(t *testing.T) { } want := []*GistFork{{ - URL: Ptr("https://api.github.com/gists/1"), - ID: Ptr("1"), - User: &User{ID: Ptr(int64(1))}, + URL: new("https://api.github.com/gists/1"), + ID: new("1"), + User: &User{ID: new(int64(1))}, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), }} diff --git a/github/git_blobs_test.go b/github/git_blobs_test.go index cfc02da02de..c5cd0eb2c27 100644 --- a/github/git_blobs_test.go +++ b/github/git_blobs_test.go @@ -34,8 +34,8 @@ func TestGitService_GetBlob(t *testing.T) { } want := Blob{ - SHA: Ptr("s"), - Content: Ptr("blob content"), + SHA: new("s"), + Content: new("blob content"), } if !cmp.Equal(*blob, want) { @@ -108,10 +108,10 @@ func TestGitService_CreateBlob(t *testing.T) { client, mux, _ := setup(t) input := Blob{ - SHA: Ptr("s"), - Content: Ptr("blob content"), - Encoding: Ptr("utf-8"), - Size: Ptr(12), + SHA: new("s"), + Content: new("blob content"), + Encoding: new("utf-8"), + Size: new(12), } mux.HandleFunc("/repos/o/r/git/blobs", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/git_commits_test.go b/github/git_commits_test.go index f7febde7246..5e20c13fcb6 100644 --- a/github/git_commits_test.go +++ b/github/git_commits_test.go @@ -51,7 +51,7 @@ func TestGitService_GetCommit(t *testing.T) { t.Errorf("Git.GetCommit returned error: %v", err) } - want := &Commit{SHA: Ptr("s"), Message: Ptr("Commit Message."), Author: &CommitAuthor{Name: Ptr("n")}} + want := &Commit{SHA: new("s"), Message: new("Commit Message."), Author: &CommitAuthor{Name: new("n")}} if !cmp.Equal(commit, want) { t.Errorf("Git.GetCommit returned %+v, want %+v", commit, want) } @@ -85,9 +85,9 @@ func TestGitService_CreateCommit(t *testing.T) { client, mux, _ := setup(t) input := Commit{ - Message: Ptr("Commit Message."), - Tree: &Tree{SHA: Ptr("t")}, - Parents: []*Commit{{SHA: Ptr("p")}}, + Message: new("Commit Message."), + Tree: &Tree{SHA: new("t")}, + Parents: []*Commit{{SHA: new("p")}}, } mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) { @@ -107,7 +107,7 @@ func TestGitService_CreateCommit(t *testing.T) { t.Errorf("Git.CreateCommit returned error: %v", err) } - want := &Commit{SHA: Ptr("s")} + want := &Commit{SHA: new("s")} if !cmp.Equal(commit, want) { t.Errorf("Git.CreateCommit returned %+v, want %+v", commit, want) } @@ -132,11 +132,11 @@ func TestGitService_CreateSignedCommit(t *testing.T) { client, mux, _ := setup(t) input := Commit{ - Message: Ptr("Commit Message."), - Tree: &Tree{SHA: Ptr("t")}, - Parents: []*Commit{{SHA: Ptr("p")}}, + Message: new("Commit Message."), + Tree: &Tree{SHA: new("t")}, + Parents: []*Commit{{SHA: new("p")}}, Verification: &SignatureVerification{ - Signature: Ptr("----- BEGIN PGP SIGNATURE -----\n\naaaa\naaaa\n----- END PGP SIGNATURE -----"), + Signature: new("----- BEGIN PGP SIGNATURE -----\n\naaaa\naaaa\n----- END PGP SIGNATURE -----"), }, } @@ -163,7 +163,7 @@ func TestGitService_CreateSignedCommit(t *testing.T) { t.Errorf("Git.CreateCommit returned error: %v", err) } - want := &Commit{SHA: Ptr("commitSha")} + want := &Commit{SHA: new("commitSha")} if !cmp.Equal(commit, want) { t.Errorf("Git.CreateCommit returned %+v, want %+v", commit, want) } @@ -204,8 +204,8 @@ func TestGitService_CreateCommit_WithSigner(t *testing.T) { signature := "my voice is my password" date := time.Date(2017, time.May, 4, 0, 3, 43, 0, time.FixedZone("CEST", 2*3600)) author := CommitAuthor{ - Name: Ptr("go-github"), - Email: Ptr("go-github@github.com"), + Name: new("go-github"), + Email: new("go-github@github.com"), Date: &Timestamp{date}, } wantMessage := `tree t @@ -217,14 +217,14 @@ Commit Message.` sha := "commitSha" input := Commit{ SHA: &sha, - Message: Ptr("Commit Message."), - Tree: &Tree{SHA: Ptr("t")}, - Parents: []*Commit{{SHA: Ptr("p")}}, + Message: new("Commit Message."), + Tree: &Tree{SHA: new("t")}, + Parents: []*Commit{{SHA: new("p")}}, Author: &author, } wantBody := &createCommit{ Message: input.Message, - Tree: Ptr("t"), + Tree: new("t"), Parents: []string{"p"}, Author: &author, Signature: &signature, @@ -247,8 +247,8 @@ Commit Message.` func TestGitService_createSignature_nilSigner(t *testing.T) { t.Parallel() a := &createCommit{ - Message: Ptr("Commit Message."), - Tree: Ptr("t"), + Message: new("Commit Message."), + Tree: new("t"), Parents: []string{"p"}, } @@ -271,10 +271,10 @@ func TestGitService_createSignature_nilCommit(t *testing.T) { func TestGitService_createSignature_signerError(t *testing.T) { t.Parallel() a := &createCommit{ - Message: Ptr("Commit Message."), - Tree: Ptr("t"), + Message: new("Commit Message."), + Tree: new("t"), Parents: []string{"p"}, - Author: &CommitAuthor{Name: Ptr("go-github")}, + Author: &CommitAuthor{Name: new("go-github")}, } signer := mockSigner(t, "", errors.New("signer error"), "") @@ -301,8 +301,8 @@ func TestGitService_createSignatureMessage_nilMessage(t *testing.T) { Message: nil, Parents: []string{"p"}, Author: &CommitAuthor{ - Name: Ptr("go-github"), - Email: Ptr("go-github@github.com"), + Name: new("go-github"), + Email: new("go-github@github.com"), Date: &Timestamp{date}, }, }) @@ -315,11 +315,11 @@ func TestGitService_createSignatureMessage_emptyMessage(t *testing.T) { t.Parallel() date, _ := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Thu May 04 00:03:43 2017 +0200") _, err := createSignatureMessage(&createCommit{ - Message: Ptr(""), + Message: new(""), Parents: []string{"p"}, Author: &CommitAuthor{ - Name: Ptr("go-github"), - Email: Ptr("go-github@github.com"), + Name: new("go-github"), + Email: new("go-github@github.com"), Date: &Timestamp{date}, }, }) @@ -331,7 +331,7 @@ func TestGitService_createSignatureMessage_emptyMessage(t *testing.T) { func TestGitService_createSignatureMessage_nilAuthor(t *testing.T) { t.Parallel() _, err := createSignatureMessage(&createCommit{ - Message: Ptr("Commit Message."), + Message: new("Commit Message."), Parents: []string{"p"}, Author: nil, }) @@ -345,11 +345,11 @@ func TestGitService_createSignatureMessage_withoutTree(t *testing.T) { date, _ := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Thu May 04 00:03:43 2017 +0200") msg, _ := createSignatureMessage(&createCommit{ - Message: Ptr("Commit Message."), + Message: new("Commit Message."), Parents: []string{"p"}, Author: &CommitAuthor{ - Name: Ptr("go-github"), - Email: Ptr("go-github@github.com"), + Name: new("go-github"), + Email: new("go-github@github.com"), Date: &Timestamp{date}, }, }) @@ -368,16 +368,16 @@ func TestGitService_createSignatureMessage_withoutCommitter(t *testing.T) { date, _ := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Thu May 04 00:03:43 2017 +0200") msg, _ := createSignatureMessage(&createCommit{ - Message: Ptr("Commit Message."), + Message: new("Commit Message."), Parents: []string{"p"}, Author: &CommitAuthor{ - Name: Ptr("go-github"), - Email: Ptr("go-github@github.com"), + Name: new("go-github"), + Email: new("go-github@github.com"), Date: &Timestamp{date}, }, Committer: &CommitAuthor{ - Name: Ptr("foo"), - Email: Ptr("foo@example.com"), + Name: new("foo"), + Email: new("foo@example.com"), Date: &Timestamp{date}, }, }) diff --git a/github/git_refs_test.go b/github/git_refs_test.go index f3dedaba172..c153c3861c6 100644 --- a/github/git_refs_test.go +++ b/github/git_refs_test.go @@ -39,12 +39,12 @@ func TestGitService_GetRef_singleRef(t *testing.T) { } want := &Reference{ - Ref: Ptr("refs/heads/b"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: new("refs/heads/b"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -135,12 +135,12 @@ func TestGitService_ListMatchingRefs_singleRef(t *testing.T) { ref := refs[0] want := &Reference{ - Ref: Ptr("refs/heads/b"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: new("refs/heads/b"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -199,12 +199,12 @@ func TestGitService_ListMatchingRefs_multipleRefs(t *testing.T) { } want := &Reference{ - Ref: Ptr("refs/heads/booger"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/booger"), + Ref: new("refs/heads/booger"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/booger"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(refs[0], want) { @@ -297,21 +297,21 @@ func TestGitService_ListMatchingRefs_allRefs(t *testing.T) { want := []*Reference{ { - Ref: Ptr("refs/heads/branchA"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/branchA"), + Ref: new("refs/heads/branchA"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/branchA"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }, { - Ref: Ptr("refs/heads/branchB"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/branchB"), + Ref: new("refs/heads/branchB"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/branchB"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }, } @@ -368,12 +368,12 @@ func TestGitService_CreateRef(t *testing.T) { } want := &Reference{ - Ref: Ptr("refs/heads/b"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: new("refs/heads/b"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -420,7 +420,7 @@ func TestGitService_UpdateRef(t *testing.T) { args := UpdateRef{ SHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", - Force: Ptr(true), + Force: new(true), } mux.HandleFunc("/repos/o/r/git/refs/heads/b", func(w http.ResponseWriter, r *http.Request) { @@ -441,19 +441,19 @@ func TestGitService_UpdateRef(t *testing.T) { ctx := t.Context() ref, _, err := client.Git.UpdateRef(ctx, "o", "r", "refs/heads/b", UpdateRef{ SHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", - Force: Ptr(true), + Force: new(true), }) if err != nil { t.Errorf("Git.UpdateRef returned error: %v", err) } want := &Reference{ - Ref: Ptr("refs/heads/b"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: new("refs/heads/b"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -463,7 +463,7 @@ func TestGitService_UpdateRef(t *testing.T) { // without 'refs/' prefix _, _, err = client.Git.UpdateRef(ctx, "o", "r", "heads/b", UpdateRef{ SHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", - Force: Ptr(true), + Force: new(true), }) if err != nil { t.Errorf("Git.UpdateRef returned error: %v", err) @@ -481,7 +481,7 @@ func TestGitService_UpdateRef(t *testing.T) { testBadOptions(t, methodName, func() (err error) { _, _, err = client.Git.UpdateRef(ctx, "\n", "\n", "refs/heads/b", UpdateRef{ SHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", - Force: Ptr(true), + Force: new(true), }) return err }) @@ -489,7 +489,7 @@ func TestGitService_UpdateRef(t *testing.T) { testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { got, resp, err := client.Git.UpdateRef(ctx, "o", "r", "refs/heads/b", UpdateRef{ SHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", - Force: Ptr(true), + Force: new(true), }) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) @@ -576,7 +576,7 @@ func TestGitService_UpdateRef_pathEscape(t *testing.T) { args := UpdateRef{ SHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", - Force: Ptr(true), + Force: new(true), } mux.HandleFunc("/repos/o/r/git/refs/heads/b#1", func(w http.ResponseWriter, r *http.Request) { @@ -597,19 +597,19 @@ func TestGitService_UpdateRef_pathEscape(t *testing.T) { ctx := t.Context() ref, _, err := client.Git.UpdateRef(ctx, "o", "r", "refs/heads/b#1", UpdateRef{ SHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", - Force: Ptr(true), + Force: new(true), }) if err != nil { t.Errorf("Git.UpdateRef returned error: %v", err) } want := &Reference{ - Ref: Ptr("refs/heads/b#1"), - URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b%231"), + Ref: new("refs/heads/b#1"), + URL: new("https://api.github.com/repos/o/r/git/refs/heads/b%231"), Object: &GitObject{ - Type: Ptr("commit"), - SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: new("commit"), + SHA: new("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: new("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { diff --git a/github/git_tags_test.go b/github/git_tags_test.go index 2ff9de0dc27..00b01e41751 100644 --- a/github/git_tags_test.go +++ b/github/git_tags_test.go @@ -28,7 +28,7 @@ func TestGitService_GetTag(t *testing.T) { t.Errorf("Git.GetTag returned error: %v", err) } - want := &Tag{Tag: Ptr("t")} + want := &Tag{Tag: new("t")} if !cmp.Equal(tag, want) { t.Errorf("Git.GetTag returned %+v, want %+v", tag, want) } @@ -71,7 +71,7 @@ func TestGitService_CreateTag(t *testing.T) { t.Errorf("Git.CreateTag returned error: %v", err) } - want := &Tag{Tag: Ptr("t")} + want := &Tag{Tag: new("t")} if !cmp.Equal(tag, want) { t.Errorf("Git.CreateTag returned %+v, want %+v", tag, want) } diff --git a/github/git_trees_test.go b/github/git_trees_test.go index 035c648e30c..6a86df28dd0 100644 --- a/github/git_trees_test.go +++ b/github/git_trees_test.go @@ -33,13 +33,13 @@ func TestGitService_GetTree(t *testing.T) { } want := Tree{ - SHA: Ptr("s"), + SHA: new("s"), Entries: []*TreeEntry{ { - Type: Ptr("blob"), + Type: new("blob"), }, }, - Truncated: Ptr(true), + Truncated: new(true), } if !cmp.Equal(*tree, want) { t.Errorf("Git.GetTree returned %+v, want %+v", *tree, want) @@ -75,10 +75,10 @@ func TestGitService_CreateTree(t *testing.T) { input := []*TreeEntry{ { - Path: Ptr("file.rb"), - Mode: Ptr("100644"), - Type: Ptr("blob"), - SHA: Ptr("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), + Path: new("file.rb"), + Mode: new("100644"), + Type: new("blob"), + SHA: new("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), }, } @@ -114,14 +114,14 @@ func TestGitService_CreateTree(t *testing.T) { } want := Tree{ - Ptr("cd8274d15fa3ae2ab983129fb037999f264ba9a7"), + new("cd8274d15fa3ae2ab983129fb037999f264ba9a7"), []*TreeEntry{ { - Path: Ptr("file.rb"), - Mode: Ptr("100644"), - Type: Ptr("blob"), - Size: Ptr(132), - SHA: Ptr("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), + Path: new("file.rb"), + Mode: new("100644"), + Type: new("blob"), + Size: new(132), + SHA: new("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), }, }, nil, @@ -152,9 +152,9 @@ func TestGitService_CreateTree_Content(t *testing.T) { input := []*TreeEntry{ { - Path: Ptr("content.md"), - Mode: Ptr("100644"), - Content: Ptr("file content"), + Path: new("content.md"), + Mode: new("100644"), + Content: new("file content"), }, } @@ -191,15 +191,15 @@ func TestGitService_CreateTree_Content(t *testing.T) { } want := Tree{ - Ptr("5c6780ad2c68743383b740fd1dab6f6a33202b11"), + new("5c6780ad2c68743383b740fd1dab6f6a33202b11"), []*TreeEntry{ { - Path: Ptr("content.md"), - Mode: Ptr("100644"), - Type: Ptr("blob"), - Size: Ptr(12), - SHA: Ptr("aad8feacf6f8063150476a7b2bd9770f2794c08b"), - URL: Ptr("https://api.github.com/repos/o/r/git/blobs/aad8feacf6f8063150476a7b2bd9770f2794c08b"), + Path: new("content.md"), + Mode: new("100644"), + Type: new("blob"), + Size: new(12), + SHA: new("aad8feacf6f8063150476a7b2bd9770f2794c08b"), + URL: new("https://api.github.com/repos/o/r/git/blobs/aad8feacf6f8063150476a7b2bd9770f2794c08b"), }, }, nil, @@ -230,8 +230,8 @@ func TestGitService_CreateTree_Delete(t *testing.T) { input := []*TreeEntry{ { - Path: Ptr("content.md"), - Mode: Ptr("100644"), + Path: new("content.md"), + Mode: new("100644"), }, } @@ -268,15 +268,15 @@ func TestGitService_CreateTree_Delete(t *testing.T) { } want := Tree{ - Ptr("5c6780ad2c68743383b740fd1dab6f6a33202b11"), + new("5c6780ad2c68743383b740fd1dab6f6a33202b11"), []*TreeEntry{ { - Path: Ptr("content.md"), - Mode: Ptr("100644"), - Type: Ptr("blob"), - Size: Ptr(12), + Path: new("content.md"), + Mode: new("100644"), + Type: new("blob"), + Size: new(12), SHA: nil, - URL: Ptr("https://api.github.com/repos/o/r/git/blobs/aad8feacf6f8063150476a7b2bd9770f2794c08b"), + URL: new("https://api.github.com/repos/o/r/git/blobs/aad8feacf6f8063150476a7b2bd9770f2794c08b"), }, }, nil, @@ -315,13 +315,13 @@ func TestTreeEntry_MarshalJSON(t *testing.T) { testJSONMarshal(t, &TreeEntry{}, `{"sha": null}`) u := &TreeEntry{ - SHA: Ptr("sha"), - Path: Ptr("path"), - Mode: Ptr("mode"), - Type: Ptr("type"), - Size: Ptr(1), - Content: Ptr("content"), - URL: Ptr("url"), + SHA: new("sha"), + Path: new("path"), + Mode: new("mode"), + Type: new("type"), + Size: new(1), + Content: new("content"), + URL: new("url"), } want := `{ @@ -340,11 +340,11 @@ func TestTreeEntry_MarshalJSON(t *testing.T) { func TestTreeEntry_MarshalJSON_withNilContentAndSHA(t *testing.T) { t.Parallel() te := TreeEntry{ - Path: Ptr("path"), - Mode: Ptr("mode"), - Type: Ptr("type"), - Size: Ptr(1), - URL: Ptr("url"), + Path: new("path"), + Mode: new("mode"), + Type: new("type"), + Size: new(1), + URL: new("url"), } want := `{"sha":null,"path":"path","mode":"mode","type":"type"}` @@ -357,13 +357,13 @@ func TestTreeEntryWithFileDelete_MarshalJSON(t *testing.T) { testJSONMarshal(t, &treeEntryWithFileDelete{}, `{"sha": null}`) u := &treeEntryWithFileDelete{ - SHA: Ptr("sha"), - Path: Ptr("path"), - Mode: Ptr("mode"), - Type: Ptr("type"), - Size: Ptr(1), - Content: Ptr("content"), - URL: Ptr("url"), + SHA: new("sha"), + Path: new("path"), + Mode: new("mode"), + Type: new("type"), + Size: new(1), + Content: new("content"), + URL: new("url"), } want := `{ diff --git a/github/github.go b/github/github.go index 07b08ea27bf..68ba6ee4de1 100644 --- a/github/github.go +++ b/github/github.go @@ -744,8 +744,8 @@ func (c *Client) Clone(opts ...ClientOptionsFunc) (*Client, error) { apiVersionMin: &c.apiVersionMin, apiVersionMax: &c.apiVersionMax, userAgent: &c.userAgent, - baseURL: Ptr(*c.baseURL), - uploadURL: Ptr(*c.uploadURL), + baseURL: new(*c.baseURL), + uploadURL: new(*c.uploadURL), disableRateLimitCheck: c.disableRateLimitCheck, rateLimitRedirectionalEndpoints: c.rateLimitRedirectionalEndpoints, maxSecondaryRateLimitRetryAfterDuration: &c.maxSecondaryRateLimitRetryAfterDuration, @@ -2170,8 +2170,10 @@ func (c *Client) checkRedirectHost(location string) error { // Ptr is a helper routine that allocates a new T value // to store v and returns a pointer to it. +// +//go:fix inline func Ptr[T any](v T) *T { - return &v + return new(v) } // Bool is a helper routine that allocates a new bool value @@ -2180,7 +2182,7 @@ func Ptr[T any](v T) *T { // Deprecated: use Ptr instead. // //go:fix inline -func Bool(v bool) *bool { return Ptr(v) } +func Bool(v bool) *bool { return new(v) } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. @@ -2188,7 +2190,7 @@ func Bool(v bool) *bool { return Ptr(v) } // Deprecated: use Ptr instead. // //go:fix inline -func Int(v int) *int { return Ptr(v) } +func Int(v int) *int { return new(v) } // Int64 is a helper routine that allocates a new int64 value // to store v and returns a pointer to it. @@ -2196,7 +2198,7 @@ func Int(v int) *int { return Ptr(v) } // Deprecated: use Ptr instead. // //go:fix inline -func Int64(v int64) *int64 { return Ptr(v) } +func Int64(v int64) *int64 { return new(v) } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. @@ -2204,7 +2206,7 @@ func Int64(v int64) *int64 { return Ptr(v) } // Deprecated: use Ptr instead. // //go:fix inline -func String(v string) *string { return Ptr(v) } +func String(v string) *string { return new(v) } // roundTripperFunc creates a RoundTripper (transport). type roundTripperFunc func(*http.Request) (*http.Response, error) diff --git a/github/github_test.go b/github/github_test.go index ae585cede4d..393e9250390 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -608,41 +608,41 @@ func TestWithURLs(t *testing.T) { }{ { name: "does_not_modify_urls_with_trailing_slash", - baseURL: Ptr("https://example.com/"), - wantBaseURL: Ptr("https://example.com/"), - uploadURL: Ptr("https://upload.example.com/"), - wantUploadURL: Ptr("https://upload.example.com/"), + baseURL: new("https://example.com/"), + wantBaseURL: new("https://example.com/"), + uploadURL: new("https://upload.example.com/"), + wantUploadURL: new("https://upload.example.com/"), }, { name: "adds_trailing_slash", - baseURL: Ptr("https://example.com"), - wantBaseURL: Ptr("https://example.com/"), - uploadURL: Ptr("https://upload.example.com"), - wantUploadURL: Ptr("https://upload.example.com/"), + baseURL: new("https://example.com"), + wantBaseURL: new("https://example.com/"), + uploadURL: new("https://upload.example.com"), + wantUploadURL: new("https://upload.example.com/"), }, { name: "skips_unset", }, { name: "error_on_empty_base_url", - baseURL: Ptr(""), + baseURL: new(""), wantErr: "invalid base url: url cannot be empty", }, { name: "error_on_bad_base_url", - baseURL: Ptr("bogus\nbase\nURL"), + baseURL: new("bogus\nbase\nURL"), wantErr: "invalid base url: invalid url", }, { name: "error_on_empty_upload_url", - baseURL: Ptr("https://example.com/"), - uploadURL: Ptr(""), + baseURL: new("https://example.com/"), + uploadURL: new(""), wantErr: "invalid upload url: url cannot be empty", }, { name: "error_on_bad_upload_url", - baseURL: Ptr("https://example.com/"), - uploadURL: Ptr("bogus\nupload\nURL"), + baseURL: new("https://example.com/"), + uploadURL: new("bogus\nupload\nURL"), wantErr: "invalid upload url: invalid url", }, } { @@ -970,9 +970,9 @@ func Test_newClient(t *testing.T) { httpClient: &http.Client{Transport: &http.Transport{IdleConnTimeout: 5 * time.Second}}, transport: &http.Transport{IdleConnTimeout: 10 * time.Second}, timeout: Ptr(15 * time.Second), - apiVersionMin: Ptr(api20221128), - apiVersionMax: Ptr(api20221128), - userAgent: Ptr("CustomUserAgent/1.0"), + apiVersionMin: new(api20221128), + apiVersionMax: new(api20221128), + userAgent: new("CustomUserAgent/1.0"), baseURL: mustParseURL(t, "https://custom-url/api/v3/"), uploadURL: mustParseURL(t, "https://custom-upload-url/api/uploads/"), disableRateLimitCheck: true, @@ -1533,7 +1533,7 @@ func TestNewRequest(t *testing.T) { c := mustNewClient(t) inURL, outURL := "/foo", defaultBaseURL+"foo" - inBody, outBody := &User{Login: Ptr("l")}, `{"login":"l"}`+"\n" + inBody, outBody := &User{Login: new("l")}, `{"login":"l"}`+"\n" req, _ := c.NewRequest(t.Context(), "GET", inURL, inBody) // test that relative URL was expanded @@ -4676,10 +4676,10 @@ func TestPtr(t *testing.T) { } } - equal(t, true, *Ptr(true)) - equal(t, int(10), *Ptr(int(10))) - equal(t, int64(-10), *Ptr(int64(-10))) - equal(t, "str", *Ptr("str")) + equal(t, true, *new(true)) + equal(t, int(10), *new(int(10))) + equal(t, int64(-10), *new(int64(-10))) + equal(t, "str", *new("str")) } func TestDeploymentProtectionRuleEvent_GetRunID(t *testing.T) { diff --git a/github/gitignore_test.go b/github/gitignore_test.go index 1d21836ea4b..fdb1fe29a34 100644 --- a/github/gitignore_test.go +++ b/github/gitignore_test.go @@ -58,7 +58,7 @@ func TestGitignoresService_Get(t *testing.T) { t.Errorf("Gitignores.Get returned error: %v", err) } - want := &Gitignore{Name: Ptr("Name"), Source: Ptr("template source")} + want := &Gitignore{Name: new("Name"), Source: new("template source")} if !cmp.Equal(gitignore, want) { t.Errorf("Gitignores.Get returned %+v, want %+v", gitignore, want) } diff --git a/github/interactions_orgs_test.go b/github/interactions_orgs_test.go index e4acf9603ec..f161f26dcc0 100644 --- a/github/interactions_orgs_test.go +++ b/github/interactions_orgs_test.go @@ -29,7 +29,7 @@ func TestInteractionsService_GetRestrictionsForOrgs(t *testing.T) { t.Errorf("Interactions.GetRestrictionsForOrg returned error: %v", err) } - want := &InteractionRestriction{Origin: Ptr("organization")} + want := &InteractionRestriction{Origin: new("organization")} if !cmp.Equal(organizationInteractions, want) { t.Errorf("Interactions.GetRestrictionsForOrg returned %+v, want %+v", organizationInteractions, want) } @@ -53,7 +53,7 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &InteractionRestriction{Limit: Ptr("existing_users")} + input := &InteractionRestriction{Limit: new("existing_users")} mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -68,7 +68,7 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) { t.Errorf("Interactions.UpdateRestrictionsForOrg returned error: %v", err) } - want := &InteractionRestriction{Origin: Ptr("organization")} + want := &InteractionRestriction{Origin: new("organization")} if !cmp.Equal(organizationInteractions, want) { t.Errorf("Interactions.UpdateRestrictionsForOrg returned %+v, want %+v", organizationInteractions, want) } diff --git a/github/interactions_repos_test.go b/github/interactions_repos_test.go index 0146f51a62b..5224a59db2c 100644 --- a/github/interactions_repos_test.go +++ b/github/interactions_repos_test.go @@ -29,7 +29,7 @@ func TestInteractionsService_GetRestrictionsForRepo(t *testing.T) { t.Errorf("Interactions.GetRestrictionsForRepo returned error: %v", err) } - want := &InteractionRestriction{Origin: Ptr("repository")} + want := &InteractionRestriction{Origin: new("repository")} if !cmp.Equal(repoInteractions, want) { t.Errorf("Interactions.GetRestrictionsForRepo returned %+v, want %+v", repoInteractions, want) } @@ -53,7 +53,7 @@ func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &InteractionRestriction{Limit: Ptr("existing_users")} + input := &InteractionRestriction{Limit: new("existing_users")} mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -68,7 +68,7 @@ func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) { t.Errorf("Interactions.UpdateRestrictionsForRepo returned error: %v", err) } - want := &InteractionRestriction{Origin: Ptr("repository")} + want := &InteractionRestriction{Origin: new("repository")} if !cmp.Equal(repoInteractions, want) { t.Errorf("Interactions.UpdateRestrictionsForRepo returned %+v, want %+v", repoInteractions, want) } diff --git a/github/issue_import_test.go b/github/issue_import_test.go index e3509145206..76151dc5985 100644 --- a/github/issue_import_test.go +++ b/github/issue_import_test.go @@ -20,11 +20,11 @@ func TestIssueImportService_Create(t *testing.T) { input := &IssueImportRequest{ IssueImport: IssueImport{ - Assignee: Ptr("developer"), + Assignee: new("developer"), Body: "Dummy description", CreatedAt: &referenceTimestamp, Labels: []string{"l1", "l2"}, - Milestone: Ptr(1), + Milestone: new(1), Title: "Dummy Issue", }, Comments: []*Comment{{ @@ -72,11 +72,11 @@ func TestIssueImportService_Create_deferred(t *testing.T) { input := &IssueImportRequest{ IssueImport: IssueImport{ - Assignee: Ptr("developer"), + Assignee: new("developer"), Body: "Dummy description", CreatedAt: &referenceTimestamp, Labels: []string{"l1", "l2"}, - Milestone: Ptr(1), + Milestone: new(1), Title: "Dummy Issue", }, Comments: []*Comment{{ @@ -112,11 +112,11 @@ func TestIssueImportService_Create_badResponse(t *testing.T) { input := &IssueImportRequest{ IssueImport: IssueImport{ - Assignee: Ptr("developer"), + Assignee: new("developer"), Body: "Dummy description", CreatedAt: &referenceTimestamp, Labels: []string{"l1", "l2"}, - Milestone: Ptr(1), + Milestone: new(1), Title: "Dummy Issue", }, Comments: []*Comment{{ @@ -268,9 +268,9 @@ var issueImportResponseJSON = []byte(`{ }`) var wantIssueImportResponse = &IssueImportResponse{ - ID: Ptr(3), - Status: Ptr("pending"), - URL: Ptr("https://api.github.com/repos/o/r/import/issues/3"), - ImportIssuesURL: Ptr("https://api.github.com/repos/o/r/import/issues"), - RepositoryURL: Ptr("https://api.github.com/repos/o/r"), + ID: new(3), + Status: new("pending"), + URL: new("https://api.github.com/repos/o/r/import/issues/3"), + ImportIssuesURL: new("https://api.github.com/repos/o/r/import/issues"), + RepositoryURL: new("https://api.github.com/repos/o/r"), } diff --git a/github/issues_assignees_test.go b/github/issues_assignees_test.go index 62002f95073..677f69d02af 100644 --- a/github/issues_assignees_test.go +++ b/github/issues_assignees_test.go @@ -30,7 +30,7 @@ func TestIssuesService_ListAssignees(t *testing.T) { t.Errorf("Issues.ListAssignees returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(assignees, want) { t.Errorf("Issues.ListAssignees returned %+v, want %+v", assignees, want) } @@ -187,7 +187,7 @@ func TestIssuesService_AddAssignees(t *testing.T) { t.Errorf("Issues.AddAssignees returned error: %v", err) } - want := &Issue{Number: Ptr(1), Assignees: []*User{{Login: Ptr("user1")}, {Login: Ptr("user2")}}} + want := &Issue{Number: new(1), Assignees: []*User{{Login: new("user1")}, {Login: new("user2")}}} if !cmp.Equal(got, want) { t.Errorf("Issues.AddAssignees = %+v, want %+v", got, want) } @@ -229,7 +229,7 @@ func TestIssuesService_RemoveAssignees(t *testing.T) { t.Errorf("Issues.RemoveAssignees returned error: %v", err) } - want := &Issue{Number: Ptr(1), Assignees: []*User{}} + want := &Issue{Number: new(1), Assignees: []*User{}} if !cmp.Equal(got, want) { t.Errorf("Issues.RemoveAssignees = %+v, want %+v", got, want) } diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go index a91cc756ca6..49049033ae7 100644 --- a/github/issues_comments_test.go +++ b/github/issues_comments_test.go @@ -30,8 +30,8 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) { }) opt := &IssueListCommentsOptions{ - Sort: Ptr("updated"), - Direction: Ptr("desc"), + Sort: new("updated"), + Direction: new("desc"), Since: &referenceTime, ListOptions: ListOptions{Page: 2}, } @@ -41,7 +41,7 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) { t.Errorf("Issues.ListComments returned error: %v", err) } - want := []*IssueComment{{ID: Ptr(int64(1))}} + want := []*IssueComment{{ID: new(int64(1))}} if !cmp.Equal(comments, want) { t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want) } @@ -77,7 +77,7 @@ func TestIssuesService_ListComments_specificIssue(t *testing.T) { t.Errorf("Issues.ListComments returned error: %v", err) } - want := []*IssueComment{{ID: Ptr(int64(1))}} + want := []*IssueComment{{ID: new(int64(1))}} if !cmp.Equal(comments, want) { t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want) } @@ -122,7 +122,7 @@ func TestIssuesService_GetComment(t *testing.T) { t.Errorf("Issues.GetComment returned error: %v", err) } - want := &IssueComment{ID: Ptr(int64(1))} + want := &IssueComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Issues.GetComment returned %+v, want %+v", comment, want) } @@ -169,7 +169,7 @@ func TestIssuesService_CreateComment(t *testing.T) { t.Errorf("Issues.CreateComment returned error: %v", err) } - want := &IssueComment{ID: Ptr(int64(1))} + want := &IssueComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Issues.CreateComment returned %+v, want %+v", comment, want) } @@ -216,7 +216,7 @@ func TestIssuesService_UpdateComment(t *testing.T) { t.Errorf("Issues.UpdateComment returned error: %v", err) } - want := &IssueComment{ID: Ptr(int64(1))} + want := &IssueComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Issues.UpdateComment returned %+v, want %+v", comment, want) } diff --git a/github/issues_dependencies_test.go b/github/issues_dependencies_test.go index 34a45f8c7fa..f0bba8bd885 100644 --- a/github/issues_dependencies_test.go +++ b/github/issues_dependencies_test.go @@ -30,7 +30,7 @@ func TestIssuesService_ListBlockedBy(t *testing.T) { t.Errorf("Issues.ListBlockedBy returned error: %v", err) } - want := []*Issue{{Number: Ptr(1347), Title: Ptr("Found a bug")}} + want := []*Issue{{Number: new(1347), Title: new("Found a bug")}} if !cmp.Equal(issues, want) { t.Errorf("Issues.ListBlockedBy returned %+v, want %+v", issues, want) } @@ -79,7 +79,7 @@ func TestIssuesService_AddBlockedBy(t *testing.T) { t.Errorf("Issues.AddBlockedBy returned error: %v", err) } - want := &Issue{Number: Ptr(42), Title: Ptr("Dependency issue")} + want := &Issue{Number: new(42), Title: new("Dependency issue")} if !cmp.Equal(issue, want) { t.Errorf("Issues.AddBlockedBy returned %+v, want %+v", issue, want) } @@ -123,7 +123,7 @@ func TestIssuesService_RemoveBlockedBy(t *testing.T) { t.Errorf("Issues.RemoveBlockedBy returned error: %v", err) } - want := &Issue{Number: Ptr(1), Title: Ptr("Original issue")} + want := &Issue{Number: new(1), Title: new("Original issue")} if !cmp.Equal(issue, want) { t.Errorf("Issues.RemoveBlockedBy returned %+v, want %+v", issue, want) } @@ -169,7 +169,7 @@ func TestIssuesService_ListBlocking(t *testing.T) { t.Errorf("Issues.ListBlocking returned error: %v", err) } - want := []*Issue{{Number: Ptr(1348), Title: Ptr("Blocked issue")}} + want := []*Issue{{Number: new(1348), Title: new("Blocked issue")}} if !cmp.Equal(issues, want) { t.Errorf("Issues.ListBlocking returned %+v, want %+v", issues, want) } diff --git a/github/issues_events_test.go b/github/issues_events_test.go index 48b1e9afc6b..03f3b1276df 100644 --- a/github/issues_events_test.go +++ b/github/issues_events_test.go @@ -34,7 +34,7 @@ func TestIssuesService_ListIssueEvents(t *testing.T) { t.Errorf("Issues.ListIssueEvents returned error: %v", err) } - want := []*IssueEvent{{ID: Ptr(int64(1))}} + want := []*IssueEvent{{ID: new(int64(1))}} if !cmp.Equal(events, want) { t.Errorf("Issues.ListIssueEvents returned %+v, want %+v", events, want) } @@ -74,7 +74,7 @@ func TestIssuesService_ListRepositoryEvents(t *testing.T) { t.Errorf("Issues.ListRepositoryEvents returned error: %v", err) } - want := []*IssueEvent{{ID: Ptr(int64(1))}} + want := []*IssueEvent{{ID: new(int64(1))}} if !cmp.Equal(events, want) { t.Errorf("Issues.ListRepositoryEvents returned %+v, want %+v", events, want) } @@ -109,7 +109,7 @@ func TestIssuesService_GetEvent(t *testing.T) { t.Errorf("Issues.GetEvent returned error: %v", err) } - want := &IssueEvent{ID: Ptr(int64(1))} + want := &IssueEvent{ID: new(int64(1))} if !cmp.Equal(event, want) { t.Errorf("Issues.GetEvent returned %+v, want %+v", event, want) } diff --git a/github/issues_labels_test.go b/github/issues_labels_test.go index 0b672218e2d..342b5a98c9b 100644 --- a/github/issues_labels_test.go +++ b/github/issues_labels_test.go @@ -74,7 +74,7 @@ func TestIssuesService_GetLabel(t *testing.T) { t.Errorf("Issues.GetLabel returned error: %v", err) } - want := &Label{URL: "u", Name: "n", Color: "c", Description: Ptr("d")} + want := &Label{URL: "u", Name: "n", Color: "c", Description: new("d")} if !cmp.Equal(label, want) { t.Errorf("Issues.GetLabel returned %+v, want %+v", label, want) } @@ -154,7 +154,7 @@ func TestIssuesService_UpdateLabel(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateIssueLabelRequest{NewName: Ptr("z")} + input := UpdateIssueLabelRequest{NewName: new("z")} mux.HandleFunc("/repos/o/r/labels/n", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") diff --git a/github/issues_milestones_test.go b/github/issues_milestones_test.go index 233f4b59b5b..6e802d3b5a7 100644 --- a/github/issues_milestones_test.go +++ b/github/issues_milestones_test.go @@ -35,7 +35,7 @@ func TestIssuesService_ListMilestones(t *testing.T) { t.Errorf("IssuesService.ListMilestones returned error: %v", err) } - want := []*Milestone{{Number: Ptr(1)}} + want := []*Milestone{{Number: new(1)}} if !cmp.Equal(milestones, want) { t.Errorf("IssuesService.ListMilestones returned %+v, want %+v", milestones, want) } @@ -79,7 +79,7 @@ func TestIssuesService_GetMilestone(t *testing.T) { t.Errorf("IssuesService.GetMilestone returned error: %v", err) } - want := &Milestone{Number: Ptr(1)} + want := &Milestone{Number: new(1)} if !cmp.Equal(milestone, want) { t.Errorf("IssuesService.GetMilestone returned %+v, want %+v", milestone, want) } @@ -126,7 +126,7 @@ func TestIssuesService_CreateMilestone(t *testing.T) { t.Errorf("IssuesService.CreateMilestone returned error: %v", err) } - want := &Milestone{Number: Ptr(1)} + want := &Milestone{Number: new(1)} if !cmp.Equal(milestone, want) { t.Errorf("IssuesService.CreateMilestone returned %+v, want %+v", milestone, want) } @@ -159,7 +159,7 @@ func TestIssuesService_UpdateMilestone(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateMilestoneRequest{Title: Ptr("t")} + input := UpdateMilestoneRequest{Title: new("t")} mux.HandleFunc("/repos/o/r/milestones/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -173,7 +173,7 @@ func TestIssuesService_UpdateMilestone(t *testing.T) { t.Errorf("IssuesService.UpdateMilestone returned error: %v", err) } - want := &Milestone{Number: Ptr(1)} + want := &Milestone{Number: new(1)} if !cmp.Equal(milestone, want) { t.Errorf("IssuesService.UpdateMilestone returned %+v, want %+v", milestone, want) } diff --git a/github/issues_test.go b/github/issues_test.go index 9c5f90fda8c..6952c5d5447 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -57,7 +57,7 @@ func TestIssuesService_ListAllIssues(t *testing.T) { t.Errorf("Issues.ListAllIssues returned error: %v", err) } - want := []*Issue{{Number: Ptr(1)}} + want := []*Issue{{Number: new(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.ListAllIssues = %+v, want %+v", issues, want) } @@ -107,7 +107,7 @@ func TestIssuesService_ListUserIssues(t *testing.T) { t.Errorf("Issues.ListUserIssues returned error: %v", err) } - want := []*Issue{{Number: Ptr(1)}} + want := []*Issue{{Number: new(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.ListUserIssues = %+v, want %+v", issues, want) } @@ -159,7 +159,7 @@ func TestIssuesService_ListByOrg(t *testing.T) { t.Errorf("Issues.ListByOrg returned error: %v", err) } - want := []*Issue{{Number: Ptr(1)}} + want := []*Issue{{Number: new(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.ListByOrg returned %+v, want %+v", issues, want) } @@ -221,7 +221,7 @@ func TestIssuesService_ListByRepo(t *testing.T) { t.Errorf("Issues.ListByRepo returned error: %v", err) } - want := []*Issue{{Number: Ptr(1)}} + want := []*Issue{{Number: new(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.ListByRepo returned %+v, want %+v", issues, want) } @@ -258,8 +258,8 @@ func TestIssuesService_Get(t *testing.T) { } want := &Issue{ - Number: Ptr(1), - AuthorAssociation: Ptr("MEMBER"), + Number: new(1), + AuthorAssociation: new("MEMBER"), Labels: []*Label{{ URL: "u", Name: "n", @@ -300,8 +300,8 @@ func TestIssuesService_Create(t *testing.T) { input := CreateIssueRequest{ Title: "t", - Body: Ptr("b"), - Assignee: Ptr("a"), + Body: new("b"), + Assignee: new("a"), Labels: []string{"l1", "l2"}, } @@ -317,7 +317,7 @@ func TestIssuesService_Create(t *testing.T) { t.Errorf("Issues.Create returned error: %v", err) } - want := &Issue{Number: Ptr(1)} + want := &Issue{Number: new(1)} if !cmp.Equal(issue, want) { t.Errorf("Issues.Create returned %+v, want %+v", issue, want) } @@ -350,7 +350,7 @@ func TestIssuesService_Update(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateIssueRequest{Title: Ptr("t"), Type: Ptr("bug")} + input := UpdateIssueRequest{Title: new("t"), Type: new("bug")} mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -364,7 +364,7 @@ func TestIssuesService_Update(t *testing.T) { t.Errorf("Issues.Update returned error: %v", err) } - want := &Issue{Number: Ptr(1), Type: &IssueType{Name: Ptr("bug")}} + want := &Issue{Number: new(1), Type: &IssueType{Name: new("bug")}} if !cmp.Equal(issue, want) { t.Errorf("Issues.Update returned %+v, want %+v", issue, want) } @@ -399,7 +399,7 @@ func TestIssuesService_RemoveMilestone(t *testing.T) { t.Errorf("Issues.RemoveMilestone returned error: %v", err) } - want := &Issue{Number: Ptr(1)} + want := &Issue{Number: new(1)} if !cmp.Equal(issue, want) { t.Errorf("Issues.RemoveMilestone returned %+v, want %+v", issue, want) } @@ -547,7 +547,7 @@ func TestIsPullRequest(t *testing.T) { if i.IsPullRequest() { t.Errorf("expected i.IsPullRequest (%v) to return false, got true", i) } - i.PullRequestLinks = &PullRequestLinks{URL: Ptr("http://example.com")} + i.PullRequestLinks = &PullRequestLinks{URL: new("http://example.com")} if !i.IsPullRequest() { t.Errorf("expected i.IsPullRequest (%v) to return true, got false", i) } diff --git a/github/issues_timeline_test.go b/github/issues_timeline_test.go index 81cc6e5b0ae..4fc6b945bf8 100644 --- a/github/issues_timeline_test.go +++ b/github/issues_timeline_test.go @@ -36,7 +36,7 @@ func TestIssuesService_ListIssueTimeline(t *testing.T) { t.Errorf("Issues.ListIssueTimeline returned error: %v", err) } - want := []*Timeline{{ID: Ptr(int64(1))}} + want := []*Timeline{{ID: new(int64(1))}} if !cmp.Equal(events, want) { t.Errorf("Issues.ListIssueTimeline = %+v, want %+v", events, want) } @@ -104,35 +104,35 @@ func TestTimeline_ReviewRequests(t *testing.T) { want := []*Timeline{ { - ID: Ptr(int64(1234567890)), - URL: Ptr("http://example.com/timeline/1"), + ID: new(int64(1234567890)), + URL: new("http://example.com/timeline/1"), Actor: &User{ - Login: Ptr("actor-user"), - ID: Ptr(int64(1)), + Login: new("actor-user"), + ID: new(int64(1)), }, - Event: Ptr("review_requested"), + Event: new("review_requested"), CreatedAt: &Timestamp{referenceTime}, Reviewer: &User{ - Login: Ptr("reviewer-user"), - ID: Ptr(int64(2)), + Login: new("reviewer-user"), + ID: new(int64(2)), }, Requester: &User{ - Login: Ptr("requester-user"), - ID: Ptr(int64(1)), + Login: new("requester-user"), + ID: new(int64(1)), }, }, { - ID: Ptr(int64(1234567891)), - URL: Ptr("http://example.com/timeline/2"), + ID: new(int64(1234567891)), + URL: new("http://example.com/timeline/2"), Actor: &User{ - Login: Ptr("actor-user"), - ID: Ptr(int64(1)), + Login: new("actor-user"), + ID: new(int64(1)), }, - Event: Ptr("review_request_removed"), + Event: new("review_request_removed"), CreatedAt: &Timestamp{referenceTime}, Reviewer: &User{ - Login: Ptr("reviewer-user"), - ID: Ptr(int64(2)), + Login: new("reviewer-user"), + ID: new(int64(2)), }, }, } diff --git a/github/licenses_test.go b/github/licenses_test.go index 521e3712bcf..c69e3839e13 100644 --- a/github/licenses_test.go +++ b/github/licenses_test.go @@ -23,7 +23,7 @@ func TestLicensesService_List(t *testing.T) { fmt.Fprint(w, `[{"key":"mit","name":"MIT","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","featured":true}]`) }) - opts := &ListLicensesOptions{Featured: Ptr(true), ListOptions: ListOptions{Page: 2, PerPage: 20}} + opts := &ListLicensesOptions{Featured: new(true), ListOptions: ListOptions{Page: 2, PerPage: 20}} ctx := t.Context() licenses, _, err := client.Licenses.List(ctx, opts) if err != nil { @@ -31,11 +31,11 @@ func TestLicensesService_List(t *testing.T) { } want := []*License{{ - Key: Ptr("mit"), - Name: Ptr("MIT"), - SPDXID: Ptr("MIT"), - URL: Ptr("https://api.github.com/licenses/mit"), - Featured: Ptr(true), + Key: new("mit"), + Name: new("MIT"), + SPDXID: new("MIT"), + URL: new("https://api.github.com/licenses/mit"), + Featured: new(true), }} if !cmp.Equal(licenses, want) { t.Errorf("Licenses.List returned %+v, want %+v", licenses, want) @@ -66,7 +66,7 @@ func TestLicensesService_Get(t *testing.T) { t.Errorf("Licenses.Get returned error: %v", err) } - want := &License{Key: Ptr("mit"), Name: Ptr("MIT")} + want := &License{Key: new("mit"), Name: new("MIT")} if !cmp.Equal(license, want) { t.Errorf("Licenses.Get returned %+v, want %+v", license, want) } diff --git a/github/markdown_test.go b/github/markdown_test.go index 37eda279592..78c1400b020 100644 --- a/github/markdown_test.go +++ b/github/markdown_test.go @@ -16,9 +16,9 @@ func TestMarkdownService_Markdown(t *testing.T) { client, mux, _ := setup(t) input := &markdownRenderRequest{ - Text: Ptr("# text #"), - Mode: Ptr("gfm"), - Context: Ptr("google/go-github"), + Text: new("# text #"), + Mode: new("gfm"), + Context: new("google/go-github"), } mux.HandleFunc("/markdown", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") diff --git a/github/meta_test.go b/github/meta_test.go index 443f2e75fd1..2e17a5d3437 100644 --- a/github/meta_test.go +++ b/github/meta_test.go @@ -64,7 +64,7 @@ func TestMetaService_Get(t *testing.T) { }, }, - VerifiablePasswordAuthentication: Ptr(true), + VerifiablePasswordAuthentication: new(true), } if !cmp.Equal(want, meta) { t.Errorf("Get returned %+v, want %+v", meta, want) diff --git a/github/migrations_source_import_test.go b/github/migrations_source_import_test.go index ae1fcce69ef..ff57ec40ac2 100644 --- a/github/migrations_source_import_test.go +++ b/github/migrations_source_import_test.go @@ -18,10 +18,10 @@ func TestMigrationService_StartImport(t *testing.T) { client, mux, _ := setup(t) input := &Import{ - VCS: Ptr("git"), - VCSURL: Ptr("url"), - VCSUsername: Ptr("u"), - VCSPassword: Ptr("p"), + VCS: new("git"), + VCSURL: new("url"), + VCSUsername: new("u"), + VCSPassword: new("p"), } mux.HandleFunc("/repos/o/r/import", func(w http.ResponseWriter, r *http.Request) { @@ -36,7 +36,7 @@ func TestMigrationService_StartImport(t *testing.T) { if err != nil { t.Errorf("StartImport returned error: %v", err) } - want := &Import{Status: Ptr("importing")} + want := &Import{Status: new("importing")} if !cmp.Equal(got, want) { t.Errorf("StartImport = %+v, want %+v", got, want) } @@ -70,7 +70,7 @@ func TestMigrationService_ImportProgress(t *testing.T) { if err != nil { t.Errorf("ImportProgress returned error: %v", err) } - want := &Import{Status: Ptr("complete")} + want := &Import{Status: new("complete")} if !cmp.Equal(got, want) { t.Errorf("ImportProgress = %+v, want %+v", got, want) } @@ -95,10 +95,10 @@ func TestMigrationService_UpdateImport(t *testing.T) { client, mux, _ := setup(t) input := &Import{ - VCS: Ptr("git"), - VCSURL: Ptr("url"), - VCSUsername: Ptr("u"), - VCSPassword: Ptr("p"), + VCS: new("git"), + VCSURL: new("url"), + VCSUsername: new("u"), + VCSPassword: new("p"), } mux.HandleFunc("/repos/o/r/import", func(w http.ResponseWriter, r *http.Request) { @@ -113,7 +113,7 @@ func TestMigrationService_UpdateImport(t *testing.T) { if err != nil { t.Errorf("UpdateImport returned error: %v", err) } - want := &Import{Status: Ptr("importing")} + want := &Import{Status: new("importing")} if !cmp.Equal(got, want) { t.Errorf("UpdateImport = %+v, want %+v", got, want) } @@ -148,8 +148,8 @@ func TestMigrationService_CommitAuthors(t *testing.T) { t.Errorf("CommitAuthors returned error: %v", err) } want := []*SourceImportAuthor{ - {ID: Ptr(int64(1)), Name: Ptr("a")}, - {ID: Ptr(int64(2)), Name: Ptr("b")}, + {ID: new(int64(1)), Name: new("a")}, + {ID: new(int64(2)), Name: new("b")}, } if !cmp.Equal(got, want) { t.Errorf("CommitAuthors = %+v, want %+v", got, want) @@ -174,7 +174,7 @@ func TestMigrationService_MapCommitAuthor(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &SourceImportAuthor{Name: Ptr("n"), Email: Ptr("e")} + input := &SourceImportAuthor{Name: new("n"), Email: new("e")} mux.HandleFunc("/repos/o/r/import/authors/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -187,7 +187,7 @@ func TestMigrationService_MapCommitAuthor(t *testing.T) { if err != nil { t.Errorf("MapCommitAuthor returned error: %v", err) } - want := &SourceImportAuthor{ID: Ptr(int64(1))} + want := &SourceImportAuthor{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("MapCommitAuthor = %+v, want %+v", got, want) } @@ -211,7 +211,7 @@ func TestMigrationService_SetLFSPreference(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Import{UseLFS: Ptr("opt_in")} + input := &Import{UseLFS: new("opt_in")} mux.HandleFunc("/repos/o/r/import/lfs", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -225,7 +225,7 @@ func TestMigrationService_SetLFSPreference(t *testing.T) { if err != nil { t.Errorf("SetLFSPreference returned error: %v", err) } - want := &Import{Status: Ptr("importing")} + want := &Import{Status: new("importing")} if !cmp.Equal(got, want) { t.Errorf("SetLFSPreference = %+v, want %+v", got, want) } @@ -260,8 +260,8 @@ func TestMigrationService_LargeFiles(t *testing.T) { t.Errorf("LargeFiles returned error: %v", err) } want := []*LargeFile{ - {OID: Ptr("a")}, - {OID: Ptr("b")}, + {OID: new("a")}, + {OID: new("b")}, } if !cmp.Equal(got, want) { t.Errorf("LargeFiles = %+v, want %+v", got, want) diff --git a/github/migrations_test.go b/github/migrations_test.go index 73d34ec46f2..894e512fa94 100644 --- a/github/migrations_test.go +++ b/github/migrations_test.go @@ -257,20 +257,20 @@ var migrationJSON = []byte(`{ }`) var wantMigration = &Migration{ - ID: Ptr(int64(79)), - GUID: Ptr("0b989ba4-242f-11e5-81e1-c7b6966d2516"), - State: Ptr("pending"), - LockRepositories: Ptr(true), - ExcludeAttachments: Ptr(false), - URL: Ptr("https://api.github.com/orgs/octo-org/migrations/79"), - CreatedAt: Ptr("2015-07-06T15:33:38-07:00"), - UpdatedAt: Ptr("2015-07-06T15:33:38-07:00"), + ID: new(int64(79)), + GUID: new("0b989ba4-242f-11e5-81e1-c7b6966d2516"), + State: new("pending"), + LockRepositories: new(true), + ExcludeAttachments: new(false), + URL: new("https://api.github.com/orgs/octo-org/migrations/79"), + CreatedAt: new("2015-07-06T15:33:38-07:00"), + UpdatedAt: new("2015-07-06T15:33:38-07:00"), Repositories: []*Repository{ { - ID: Ptr(int64(1296269)), - Name: Ptr("Hello-World"), - FullName: Ptr("octocat/Hello-World"), - Description: Ptr("This your first repo!"), + ID: new(int64(1296269)), + Name: new("Hello-World"), + FullName: new("octocat/Hello-World"), + Description: new("This your first repo!"), }, }, } diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go index 7ffdc0935ea..7ebc30cff61 100644 --- a/github/migrations_user_test.go +++ b/github/migrations_user_test.go @@ -231,20 +231,20 @@ var userMigrationJSON = []byte(`{ }`) var wantUserMigration = &UserMigration{ - ID: Ptr(int64(79)), - GUID: Ptr("0b989ba4-242f-11e5-81e1-c7b6966d2516"), - State: Ptr("pending"), - LockRepositories: Ptr(true), - ExcludeAttachments: Ptr(false), - URL: Ptr("https://api.github.com/orgs/octo-org/migrations/79"), - CreatedAt: Ptr("2015-07-06T15:33:38-07:00"), - UpdatedAt: Ptr("2015-07-06T15:33:38-07:00"), + ID: new(int64(79)), + GUID: new("0b989ba4-242f-11e5-81e1-c7b6966d2516"), + State: new("pending"), + LockRepositories: new(true), + ExcludeAttachments: new(false), + URL: new("https://api.github.com/orgs/octo-org/migrations/79"), + CreatedAt: new("2015-07-06T15:33:38-07:00"), + UpdatedAt: new("2015-07-06T15:33:38-07:00"), Repositories: []*Repository{ { - ID: Ptr(int64(1296269)), - Name: Ptr("Hello-World"), - FullName: Ptr("octocat/Hello-World"), - Description: Ptr("This your first repo!"), + ID: new(int64(1296269)), + Name: new("Hello-World"), + FullName: new("octocat/Hello-World"), + Description: new("This your first repo!"), }, }, } diff --git a/github/orgs_actions_allowed_test.go b/github/orgs_actions_allowed_test.go index 4eb5e9496ed..a4de8ebaa73 100644 --- a/github/orgs_actions_allowed_test.go +++ b/github/orgs_actions_allowed_test.go @@ -27,7 +27,7 @@ func TestOrganizationsService_GetActionsAllowed(t *testing.T) { if err != nil { t.Errorf("Organizations.GetActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Organizations.GetActionsAllowed returned %+v, want %+v", org, want) } @@ -51,7 +51,7 @@ func TestOrganizationsService_UpdateActionsAllowed(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -65,7 +65,7 @@ func TestOrganizationsService_UpdateActionsAllowed(t *testing.T) { t.Errorf("Organizations.UpdateActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Organizations.UpdateActionsAllowed returned %+v, want %+v", org, want) } diff --git a/github/orgs_actions_permissions_test.go b/github/orgs_actions_permissions_test.go index c97f783fe35..bbb2113f10f 100644 --- a/github/orgs_actions_permissions_test.go +++ b/github/orgs_actions_permissions_test.go @@ -27,7 +27,7 @@ func TestOrganizationsService_GetActionsPermissions(t *testing.T) { if err != nil { t.Errorf("Organizations.GetActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("all")} + want := &ActionsPermissions{EnabledRepositories: new("all"), AllowedActions: new("all")} if !cmp.Equal(org, want) { t.Errorf("Organizations.GetActionsPermissions returned %+v, want %+v", org, want) } @@ -51,7 +51,7 @@ func TestOrganizationsService_UpdateActionsPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected")} + input := &ActionsPermissions{EnabledRepositories: new("all"), AllowedActions: new("selected")} mux.HandleFunc("/orgs/o/actions/permissions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -65,7 +65,7 @@ func TestOrganizationsService_UpdateActionsPermissions(t *testing.T) { t.Errorf("Organizations.UpdateActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected")} + want := &ActionsPermissions{EnabledRepositories: new("all"), AllowedActions: new("selected")} if !cmp.Equal(org, want) { t.Errorf("Organizations.UpdateActionsPermissions returned %+v, want %+v", org, want) } diff --git a/github/orgs_artifacts_test.go b/github/orgs_artifacts_test.go index 8ebfbc3df08..71a640a1759 100644 --- a/github/orgs_artifacts_test.go +++ b/github/orgs_artifacts_test.go @@ -20,12 +20,12 @@ func TestOrganizationsService_CreateArtifactDeploymentRecord(t *testing.T) { input := CreateArtifactDeploymentRequest{ Name: "test-n", Digest: "sha256:123", - Version: Ptr("v1.0.0"), + Version: new("v1.0.0"), Status: "deployed", LogicalEnvironment: "prod", DeploymentName: "dep-1", RuntimeRisks: []DeploymentRuntimeRisk{DeploymentRuntimeRiskCriticalResource, DeploymentRuntimeRiskInternetExposed}, - GithubRepository: Ptr("octo-org/octo-repo"), + GithubRepository: new("octo-org/octo-repo"), Tags: map[string]string{ "data-access": "sensitive", }, @@ -44,8 +44,8 @@ func TestOrganizationsService_CreateArtifactDeploymentRecord(t *testing.T) { } want := &ArtifactDeploymentResponse{ - TotalCount: Ptr(1), - DeploymentRecords: []*ArtifactDeploymentRecord{{ID: Ptr(int64(1))}}, + TotalCount: new(1), + DeploymentRecords: []*ArtifactDeploymentRecord{{ID: new(int64(1))}}, } if !cmp.Equal(got, want) { @@ -73,13 +73,13 @@ func TestOrganizationsService_SetClusterDeploymentRecords(t *testing.T) { input := ClusterDeploymentRecordsRequest{ LogicalEnvironment: "prod", - PhysicalEnvironment: Ptr("pacific-east"), + PhysicalEnvironment: new("pacific-east"), Deployments: []*ClusterArtifactDeployment{ { Name: "awesome-image", Digest: "sha256:abc", DeploymentName: "dep-1", - Version: Ptr("v2.0"), + Version: new("v2.0"), Status: "deployed", }, }, @@ -98,8 +98,8 @@ func TestOrganizationsService_SetClusterDeploymentRecords(t *testing.T) { } want := &ArtifactDeploymentResponse{ - TotalCount: Ptr(1), - DeploymentRecords: []*ArtifactDeploymentRecord{{ID: Ptr(int64(2))}}, + TotalCount: new(1), + DeploymentRecords: []*ArtifactDeploymentRecord{{ID: new(int64(2))}}, } if !cmp.Equal(got, want) { t.Errorf("SetClusterDeploymentRecords returned %+v, want %+v", got, want) @@ -127,11 +127,11 @@ func TestOrganizationsService_CreateArtifactStorageRecord(t *testing.T) { input := CreateArtifactStorageRequest{ Name: "libfoo", Digest: "sha256:123", - Version: Ptr("v1.2.3"), - Path: Ptr("target/libs"), - GithubRepository: Ptr("org/repo"), + Version: new("v1.2.3"), + Path: new("target/libs"), + GithubRepository: new("org/repo"), RegistryURL: "https://reg.example.com", - Status: Ptr("active"), + Status: new("active"), } mux.HandleFunc("/orgs/o/artifacts/metadata/storage-record", func(w http.ResponseWriter, r *http.Request) { @@ -147,8 +147,8 @@ func TestOrganizationsService_CreateArtifactStorageRecord(t *testing.T) { } want := &ArtifactStorageResponse{ - TotalCount: Ptr(1), - StorageRecords: []*ArtifactStorageRecord{{Name: Ptr("libfoo")}}, + TotalCount: new(1), + StorageRecords: []*ArtifactStorageRecord{{Name: new("libfoo")}}, } if !cmp.Equal(got, want) { @@ -187,9 +187,9 @@ func TestOrganizationsService_ListArtifactDeploymentRecords(t *testing.T) { } want := &ArtifactDeploymentResponse{ - TotalCount: Ptr(1), + TotalCount: new(1), DeploymentRecords: []*ArtifactDeploymentRecord{ - {ID: Ptr(int64(1)), RuntimeRisks: []DeploymentRuntimeRisk{DeploymentRuntimeRiskSensitiveData}}, + {ID: new(int64(1)), RuntimeRisks: []DeploymentRuntimeRisk{DeploymentRuntimeRiskSensitiveData}}, }, } if !cmp.Equal(got, want) { @@ -228,8 +228,8 @@ func TestOrganizationsService_ListArtifactStorageRecords(t *testing.T) { } want := &ArtifactStorageResponse{ - TotalCount: Ptr(1), - StorageRecords: []*ArtifactStorageRecord{{Name: Ptr("libfoo")}}, + TotalCount: new(1), + StorageRecords: []*ArtifactStorageRecord{{Name: new("libfoo")}}, } if !cmp.Equal(got, want) { t.Errorf("ListArtifactStorageRecords returned %+v, want %+v", got, want) diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index 65e65e893b0..db87e2b65b3 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -132,7 +132,7 @@ func unmarshalStringOrArray(raw json.RawMessage) (*string, error) { if len(ss) == 0 { return nil, nil } - return Ptr(strings.Join(ss, ", ")), nil + return new(strings.Join(ss, ", ")), nil } // unmarshalIntOrArray decodes a JSON value that is either a plain integer or an array of integers. diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index 67833e90ccd..cd8a1657d1b 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -82,9 +82,9 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { }) ctx := t.Context() getOpts := GetAuditLogOptions{ - Include: Ptr("all"), - Phrase: Ptr("action:workflows"), - Order: Ptr("asc"), + Include: new("all"), + Phrase: new("action:workflows"), + Order: new("asc"), } auditEntries, _, err := client.Organizations.GetAuditLog(ctx, "o", &getOpts) @@ -96,18 +96,18 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { want := []*AuditEntry{ { Timestamp: &Timestamp{timestamp}, - DocumentID: Ptr("beeZYapIUe-wKg5-beadb33"), - Action: Ptr("workflows.completed_workflow_run"), - Actor: Ptr("testactor"), + DocumentID: new("beeZYapIUe-wKg5-beadb33"), + Action: new("workflows.completed_workflow_run"), + Actor: new("testactor"), ActorLocation: &ActorLocation{ - CountryCode: Ptr("US"), + CountryCode: new("US"), }, CreatedAt: &Timestamp{timestamp}, - HashedToken: Ptr("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="), - Org: Ptr("o"), - OrgID: Ptr(int64(1)), - TokenID: Ptr(int64(1)), - TokenScopes: Ptr("gist,repo:read"), + HashedToken: new("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="), + Org: new("o"), + OrgID: new(int64(1)), + TokenID: new(int64(1)), + TokenScopes: new("gist,repo:read"), AdditionalFields: map[string]any{ "actor_ip": "10.0.0.1", "active": true, @@ -172,21 +172,21 @@ func TestAuditEntry_MarshalJSON(t *testing.T) { testJSONMarshal(t, &AuditEntry{}, "{}") u := AuditEntry{ - Action: Ptr("a"), - Actor: Ptr("ac"), - ActorLocation: &ActorLocation{CountryCode: Ptr("alcc")}, - Business: Ptr("b"), + Action: new("a"), + Actor: new("ac"), + ActorLocation: &ActorLocation{CountryCode: new("alcc")}, + Business: new("b"), CreatedAt: &Timestamp{referenceTime}, - DocumentID: Ptr("did"), - ExternalIdentityNameID: Ptr("ein"), - ExternalIdentityUsername: Ptr("eiu"), - HashedToken: Ptr("ht"), - Org: Ptr("o"), - OrgID: Ptr(int64(1)), + DocumentID: new("did"), + ExternalIdentityNameID: new("ein"), + ExternalIdentityUsername: new("eiu"), + HashedToken: new("ht"), + Org: new("o"), + OrgID: new(int64(1)), Timestamp: &Timestamp{referenceTime}, - TokenID: Ptr(int64(1)), - TokenScopes: Ptr("ts"), - User: Ptr("u"), + TokenID: new(int64(1)), + TokenScopes: new("ts"), + User: new("u"), Data: map[string]any{ "old_name": "on", "old_login": "ol", @@ -381,42 +381,42 @@ func TestAuditEntry_UnmarshalJSON(t *testing.T) { { name: "org is scalar", payload: `{"action":"test","org":"myorg","org_id":42}`, - want: &AuditEntry{Action: Ptr("test"), Org: Ptr("myorg"), OrgID: Ptr(int64(42))}, + want: &AuditEntry{Action: new("test"), Org: new("myorg"), OrgID: new(int64(42))}, }, { name: "org is single element array", payload: `{"action":"test","org":["myorg"],"org_id":[42]}`, - want: &AuditEntry{Action: Ptr("test"), Org: Ptr("myorg"), OrgID: Ptr(int64(42))}, + want: &AuditEntry{Action: new("test"), Org: new("myorg"), OrgID: new(int64(42))}, }, { name: "org is multi-element array", payload: `{"action":"test","org":["org1","org2","org3"],"org_id":[1,2,3]}`, - want: &AuditEntry{Action: Ptr("test"), Org: Ptr("org1, org2, org3"), OrgID: Ptr(int64(1))}, + want: &AuditEntry{Action: new("test"), Org: new("org1, org2, org3"), OrgID: new(int64(1))}, }, { name: "org_id is scalar", payload: `{"action":"test","org_id":42}`, - want: &AuditEntry{Action: Ptr("test"), OrgID: Ptr(int64(42))}, + want: &AuditEntry{Action: new("test"), OrgID: new(int64(42))}, }, { name: "org_id is array", payload: `{"action":"test","org_id":[42,43,44]}`, - want: &AuditEntry{Action: Ptr("test"), OrgID: Ptr(int64(42))}, // first element + want: &AuditEntry{Action: new("test"), OrgID: new(int64(42))}, // first element }, { name: "org is empty array", payload: `{"action":"test","org":[]}`, - want: &AuditEntry{Action: Ptr("test"), AdditionalFields: map[string]any{"org": []any{}}}, + want: &AuditEntry{Action: new("test"), AdditionalFields: map[string]any{"org": []any{}}}, }, { name: "org_id is empty array", payload: `{"action":"test","org_id":[]}`, - want: &AuditEntry{Action: Ptr("test"), AdditionalFields: map[string]any{"org_id": []any{}}}, + want: &AuditEntry{Action: new("test"), AdditionalFields: map[string]any{"org_id": []any{}}}, }, { name: "org and org_id are null", payload: `{"action":"test","org":null,"org_id":null}`, - want: &AuditEntry{Action: Ptr("test")}, + want: &AuditEntry{Action: new("test")}, }, } diff --git a/github/orgs_codesecurity_configurations_test.go b/github/orgs_codesecurity_configurations_test.go index 15f845aac41..a425bd25bde 100644 --- a/github/orgs_codesecurity_configurations_test.go +++ b/github/orgs_codesecurity_configurations_test.go @@ -43,8 +43,8 @@ func TestOrganizationsService_ListCodeSecurityConfigurations(t *testing.T) { } want := []*CodeSecurityConfiguration{ - {ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")}, - {ID: Ptr(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: Ptr("enabled")}, + {ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")}, + {ID: new(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: new("enabled")}, } if !cmp.Equal(configurations, want) { t.Errorf("Organizations.ListCodeSecurityConfigurations returned %+v, want %+v", configurations, want) @@ -83,7 +83,7 @@ func TestOrganizationsService_GetCodeSecurityConfiguration(t *testing.T) { t.Errorf("Organizations.GetCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")} + want := &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")} if !cmp.Equal(configuration, want) { t.Errorf("Organizations.GetCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -111,7 +111,7 @@ func TestOrganizationsService_CreateCodeSecurityConfiguration(t *testing.T) { input := CodeSecurityConfiguration{ Name: "config1", Description: "desc1", - CodeScanningDefaultSetup: Ptr("enabled"), + CodeScanningDefaultSetup: new("enabled"), } mux.HandleFunc("/orgs/o/code-security/configurations", func(w http.ResponseWriter, r *http.Request) { @@ -129,7 +129,7 @@ func TestOrganizationsService_CreateCodeSecurityConfiguration(t *testing.T) { t.Errorf("Organizations.CreateCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")} + want := &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")} if !cmp.Equal(configuration, want) { t.Errorf("Organizations.CreateCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -157,10 +157,10 @@ func TestOrganizationsService_CreateCodeSecurityConfigurationWithDelegatedBypass input := CodeSecurityConfiguration{ Name: "config1", Description: "desc1", - SecretProtection: Ptr("enabled"), // required to configure bypass - SecretScanning: Ptr("enabled"), // required to configure bypass - SecretScanningPushProtection: Ptr("enabled"), // required to configure bypass - SecretScanningDelegatedBypass: Ptr("enabled"), + SecretProtection: new("enabled"), // required to configure bypass + SecretScanning: new("enabled"), // required to configure bypass + SecretScanningPushProtection: new("enabled"), // required to configure bypass + SecretScanningDelegatedBypass: new("enabled"), SecretScanningDelegatedBypassOptions: &SecretScanningDelegatedBypassOptions{ Reviewers: []*BypassReviewer{ { @@ -208,22 +208,22 @@ func TestOrganizationsService_CreateCodeSecurityConfigurationWithDelegatedBypass } want := &CodeSecurityConfiguration{ - ID: Ptr(int64(123)), + ID: new(int64(123)), Name: "config1", Description: "desc1", - SecretProtection: Ptr("enabled"), - SecretScanning: Ptr("enabled"), - SecretScanningPushProtection: Ptr("enabled"), - SecretScanningDelegatedBypass: Ptr("enabled"), + SecretProtection: new("enabled"), + SecretScanning: new("enabled"), + SecretScanningPushProtection: new("enabled"), + SecretScanningDelegatedBypass: new("enabled"), SecretScanningDelegatedBypassOptions: &SecretScanningDelegatedBypassOptions{ Reviewers: []*BypassReviewer{ { - SecurityConfigurationID: Ptr(int64(123)), + SecurityConfigurationID: new(int64(123)), ReviewerType: "TEAM", ReviewerID: 456, }, { - SecurityConfigurationID: Ptr(int64(123)), + SecurityConfigurationID: new(int64(123)), ReviewerType: "ROLE", ReviewerID: 789, }, @@ -284,8 +284,8 @@ func TestOrganizationsService_ListDefaultCodeSecurityConfigurations(t *testing.T } want := []*CodeSecurityConfigurationWithDefaultForNewRepos{ - {DefaultForNewRepos: Ptr("public"), Configuration: &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")}}, - {DefaultForNewRepos: Ptr("private_and_internal"), Configuration: &CodeSecurityConfiguration{ID: Ptr(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: Ptr("enabled")}}, + {DefaultForNewRepos: new("public"), Configuration: &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")}}, + {DefaultForNewRepos: new("private_and_internal"), Configuration: &CodeSecurityConfiguration{ID: new(int64(2)), Name: "config2", Description: "desc2", PrivateVulnerabilityReporting: new("enabled")}}, } if !cmp.Equal(configurations, want) { t.Errorf("Organizations.ListDefaultCodeSecurityConfigurations returned %+v, want %+v", configurations, want) @@ -346,7 +346,7 @@ func TestOrganizationsService_UpdateCodeSecurityConfiguration(t *testing.T) { input := CodeSecurityConfiguration{ Name: "config1", Description: "desc1", - CodeScanningDefaultSetup: Ptr("enabled"), + CodeScanningDefaultSetup: new("enabled"), } mux.HandleFunc("/orgs/o/code-security/configurations/1", func(w http.ResponseWriter, r *http.Request) { @@ -364,7 +364,7 @@ func TestOrganizationsService_UpdateCodeSecurityConfiguration(t *testing.T) { t.Errorf("Organizations.UpdateCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")} + want := &CodeSecurityConfiguration{ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled")} if !cmp.Equal(configuration, want) { t.Errorf("Organizations.UpdateCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -485,9 +485,9 @@ func TestOrganizationsService_SetDefaultCodeSecurityConfiguration(t *testing.T) t.Errorf("Organizations.SetDefaultCodeSecurityConfiguration returned status %v, want %v", resp.StatusCode, wantStatus) } want := &CodeSecurityConfigurationWithDefaultForNewRepos{ - DefaultForNewRepos: Ptr("all"), + DefaultForNewRepos: new("all"), Configuration: &CodeSecurityConfiguration{ - ID: Ptr(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled"), + ID: new(int64(1)), Name: "config1", Description: "desc1", CodeScanningDefaultSetup: new("enabled"), }, } if !cmp.Equal(got, want) { @@ -541,8 +541,8 @@ func TestOrganizationsService_ListCodeSecurityConfigurationRepositories(t *testi t.Errorf("Organizations.ListCodeSecurityConfigurationRepositories returned error: %v", err) } want := []*RepositoryAttachment{ - {Status: Ptr("attached"), Repository: &Repository{ID: Ptr(int64(8)), Name: Ptr("repo8")}}, - {Status: Ptr("attached"), Repository: &Repository{ID: Ptr(int64(42)), Name: Ptr("repo42")}}, + {Status: new("attached"), Repository: &Repository{ID: new(int64(8)), Name: new("repo8")}}, + {Status: new("attached"), Repository: &Repository{ID: new(int64(42)), Name: new("repo42")}}, } if !cmp.Equal(attachments, want) { t.Errorf("Organizations.ListCodeSecurityConfigurationRepositories returned %+v, want %+v", attachments, want) @@ -585,9 +585,9 @@ func TestOrganizationsService_GetCodeSecurityConfigurationForRepository(t *testi if err != nil { t.Errorf("Organizations.GetCodeSecurityConfigurationForRepository returned error: %v", err) } - c := &CodeSecurityConfiguration{ID: Ptr(int64(42)), Name: "config42", Description: "desc1", CodeScanningDefaultSetup: Ptr("enabled")} + c := &CodeSecurityConfiguration{ID: new(int64(42)), Name: "config42", Description: "desc1", CodeScanningDefaultSetup: new("enabled")} want := &RepositoryCodeSecurityConfiguration{ - State: Ptr("attached"), + State: new("attached"), Configuration: c, } if !cmp.Equal(rc, want) { diff --git a/github/orgs_credential_authorizations_test.go b/github/orgs_credential_authorizations_test.go index 8770c77c8ec..46e10d5ed0a 100644 --- a/github/orgs_credential_authorizations_test.go +++ b/github/orgs_credential_authorizations_test.go @@ -45,12 +45,12 @@ func TestOrganizationsService_ListCredentialAuthorizations(t *testing.T) { want := []*CredentialAuthorization{ { - Login: Ptr("l"), - CredentialID: Ptr(int64(1)), - CredentialType: Ptr("t"), + Login: new("l"), + CredentialID: new(int64(1)), + CredentialType: new("t"), CredentialAuthorizedAt: refTimestamp(1136178000), CredentialAccessedAt: refTimestamp(1136178001), - AuthorizedCredentialID: Ptr(int64(1)), + AuthorizedCredentialID: new(int64(1)), }, } if !cmp.Equal(creds, want) { diff --git a/github/orgs_custom_repository_roles_test.go b/github/orgs_custom_repository_roles_test.go index 4a980a4809e..47bc439a952 100644 --- a/github/orgs_custom_repository_roles_test.go +++ b/github/orgs_custom_repository_roles_test.go @@ -51,24 +51,24 @@ func TestOrganizationsService_ListCustomRepoRoles(t *testing.T) { } want := &OrganizationCustomRepoRoles{ - TotalCount: Ptr(1), + TotalCount: new(1), CustomRepoRoles: []*CustomRepoRoles{ { - ID: Ptr(int64(1)), - Name: Ptr("Developer"), - BaseRole: Ptr("write"), + ID: new(int64(1)), + Name: new("Developer"), + BaseRole: new("write"), Permissions: []string{"delete_alerts_code_scanning"}, Org: &Organization{ - Login: Ptr("l"), - ID: Ptr(int64(1)), - NodeID: Ptr("n"), - AvatarURL: Ptr("a"), - HTMLURL: Ptr("h"), - Name: Ptr("n"), - Company: Ptr("c"), - Blog: Ptr("b"), - Location: Ptr("l"), - Email: Ptr("e"), + Login: new("l"), + ID: new(int64(1)), + NodeID: new("n"), + AvatarURL: new("a"), + HTMLURL: new("h"), + Name: new("n"), + Company: new("c"), + Blog: new("b"), + Location: new("l"), + Email: new("e"), }, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), @@ -129,21 +129,21 @@ func TestOrganizationsService_GetCustomRepoRole(t *testing.T) { } want := &CustomRepoRoles{ - ID: Ptr(int64(1)), - Name: Ptr("Developer"), - BaseRole: Ptr("write"), + ID: new(int64(1)), + Name: new("Developer"), + BaseRole: new("write"), Permissions: []string{"delete_alerts_code_scanning"}, Org: &Organization{ - Login: Ptr("l"), - ID: Ptr(int64(1)), - NodeID: Ptr("n"), - AvatarURL: Ptr("a"), - HTMLURL: Ptr("h"), - Name: Ptr("n"), - Company: Ptr("c"), - Blog: Ptr("b"), - Location: Ptr("l"), - Email: Ptr("e"), + Login: new("l"), + ID: new(int64(1)), + NodeID: new("n"), + AvatarURL: new("a"), + HTMLURL: new("h"), + Name: new("n"), + Company: new("c"), + Blog: new("b"), + Location: new("l"), + Email: new("e"), }, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), @@ -185,7 +185,7 @@ func TestOrganizationsService_CreateCustomRepoRole(t *testing.T) { body := CreateCustomRepoRoleRequest{ Name: "Labeler", - Description: Ptr("A role for issue and PR labelers"), + Description: new("A role for issue and PR labelers"), BaseRole: "read", Permissions: []string{"add_label"}, } @@ -194,7 +194,7 @@ func TestOrganizationsService_CreateCustomRepoRole(t *testing.T) { t.Errorf("Organizations.CreateCustomRepoRole returned error: %v", err) } - want := &CustomRepoRoles{ID: Ptr(int64(8030)), Name: Ptr("Labeler"), BaseRole: Ptr("read"), Permissions: []string{"add_label"}, Description: Ptr("A role for issue and PR labelers")} + want := &CustomRepoRoles{ID: new(int64(8030)), Name: new("Labeler"), BaseRole: new("read"), Permissions: []string{"add_label"}, Description: new("A role for issue and PR labelers")} if !cmp.Equal(apps, want) { t.Errorf("Organizations.CreateCustomRepoRole returned %+v, want %+v", apps, want) @@ -227,15 +227,15 @@ func TestOrganizationsService_UpdateCustomRepoRole(t *testing.T) { ctx := t.Context() body := UpdateCustomRepoRoleRequest{ - Name: Ptr("Updated Name"), - Description: Ptr("Updated Description"), + Name: new("Updated Name"), + Description: new("Updated Description"), } apps, _, err := client.Organizations.UpdateCustomRepoRole(ctx, "o", 8030, body) if err != nil { t.Errorf("Organizations.UpdateCustomRepoRole returned error: %v", err) } - want := &CustomRepoRoles{ID: Ptr(int64(8030)), Name: Ptr("Updated Name"), BaseRole: Ptr("read"), Permissions: []string{"add_label"}, Description: Ptr("Updated Description")} + want := &CustomRepoRoles{ID: new(int64(8030)), Name: new("Updated Name"), BaseRole: new("read"), Permissions: []string{"add_label"}, Description: new("Updated Description")} if !cmp.Equal(apps, want) { t.Errorf("Organizations.UpdateCustomRepoRole returned %+v, want %+v", apps, want) diff --git a/github/orgs_hooks_configuration_test.go b/github/orgs_hooks_configuration_test.go index db31cf9df25..57958834659 100644 --- a/github/orgs_hooks_configuration_test.go +++ b/github/orgs_hooks_configuration_test.go @@ -29,10 +29,10 @@ func TestOrganizationsService_GetHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: Ptr("json"), - InsecureSSL: Ptr("0"), - Secret: Ptr("********"), - URL: Ptr("https://example.com/webhook"), + ContentType: new("json"), + InsecureSSL: new("0"), + Secret: new("********"), + URL: new("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Organizations.GetHookConfiguration returned %+v, want %+v", config, want) @@ -81,10 +81,10 @@ func TestOrganizationsService_UpdateHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: Ptr("json"), - InsecureSSL: Ptr("0"), - Secret: Ptr("********"), - URL: Ptr("https://example.com/webhook"), + ContentType: new("json"), + InsecureSSL: new("0"), + Secret: new("********"), + URL: new("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Organizations.UpdateHookConfiguration returned %+v, want %+v", config, want) diff --git a/github/orgs_hooks_deliveries_test.go b/github/orgs_hooks_deliveries_test.go index 66c85ff905c..3f24fc362a5 100644 --- a/github/orgs_hooks_deliveries_test.go +++ b/github/orgs_hooks_deliveries_test.go @@ -31,7 +31,7 @@ func TestOrganizationsService_ListHookDeliveries(t *testing.T) { t.Errorf("Organizations.ListHookDeliveries returned error: %v", err) } - want := []*HookDelivery{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*HookDelivery{{ID: new(int64(1))}, {ID: new(int64(2))}} if d := cmp.Diff(hooks, want); d != "" { t.Errorf("Organizations.ListHooks want (-), got (+):\n%v", d) } @@ -75,7 +75,7 @@ func TestOrganizationsService_GetHookDelivery(t *testing.T) { t.Errorf("Organizations.GetHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Ptr(int64(1))} + want := &HookDelivery{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.GetHookDelivery returned %+v, want %+v", hook, want) } @@ -119,7 +119,7 @@ func TestOrganizationsService_RedeliverHookDelivery(t *testing.T) { t.Errorf("Organizations.RedeliverHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Ptr(int64(1))} + want := &HookDelivery{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.RedeliverHookDelivery returned %+v, want %+v", hook, want) } diff --git a/github/orgs_hooks_test.go b/github/orgs_hooks_test.go index 40cdae6096b..ddc2dbc2e7a 100644 --- a/github/orgs_hooks_test.go +++ b/github/orgs_hooks_test.go @@ -31,7 +31,7 @@ func TestOrganizationsService_ListHooks(t *testing.T) { t.Errorf("Organizations.ListHooks returned error: %v", err) } - want := []*Hook{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Hook{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(hooks, want) { t.Errorf("Organizations.ListHooks returned %+v, want %+v", hooks, want) } @@ -79,7 +79,7 @@ func TestOrganizationsService_CreateHook(t *testing.T) { t.Errorf("Organizations.CreateHook returned error: %v", err) } - want := &Hook{ID: Ptr(int64(1))} + want := &Hook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.CreateHook returned %+v, want %+v", hook, want) } @@ -118,7 +118,7 @@ func TestOrganizationsService_GetHook(t *testing.T) { t.Errorf("Organizations.GetHook returned error: %v", err) } - want := &Hook{ID: Ptr(int64(1))} + want := &Hook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.GetHook returned %+v, want %+v", hook, want) } @@ -165,7 +165,7 @@ func TestOrganizationsService_EditHook(t *testing.T) { t.Errorf("Organizations.EditHook returned error: %v", err) } - want := &Hook{ID: Ptr(int64(1))} + want := &Hook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.EditHook returned %+v, want %+v", hook, want) } diff --git a/github/orgs_immutable_releases_test.go b/github/orgs_immutable_releases_test.go index e6729ed4f08..1906189fb50 100644 --- a/github/orgs_immutable_releases_test.go +++ b/github/orgs_immutable_releases_test.go @@ -32,8 +32,8 @@ func TestOrganizationsService_GetImmutableReleasesSettings(t *testing.T) { } want := &ImmutableReleaseSettings{ - EnforcedRepositories: Ptr("selected"), - SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/o/r"), + EnforcedRepositories: new("selected"), + SelectedRepositoriesURL: new("https://api.github.com/orgs/o/r"), } if !cmp.Equal(settings, want) { @@ -61,7 +61,7 @@ func TestOrganizationsService_UpdateImmutableReleasesSettings(t *testing.T) { client, mux, _ := setup(t) input := ImmutableReleasePolicy{ - EnforcedRepositories: Ptr("selected"), + EnforcedRepositories: new("selected"), } mux.HandleFunc("/orgs/o/settings/immutable-releases", func(w http.ResponseWriter, r *http.Request) { @@ -119,10 +119,10 @@ func TestOrganizationsService_ListImmutableReleaseRepositories(t *testing.T) { } want := &ListRepositories{ - TotalCount: Ptr(2), + TotalCount: new(2), Repositories: []*Repository{ - {ID: Ptr(int64(1)), Name: Ptr("repo1")}, - {ID: Ptr(int64(2)), Name: Ptr("repo2")}, + {ID: new(int64(1)), Name: new("repo1")}, + {ID: new(int64(2)), Name: new("repo2")}, }, } diff --git a/github/orgs_issue_types_test.go b/github/orgs_issue_types_test.go index dad06d3cbf0..f126c84efd7 100644 --- a/github/orgs_issue_types_test.go +++ b/github/orgs_issue_types_test.go @@ -47,18 +47,18 @@ func TestOrganizationsService_ListIssueTypes(t *testing.T) { want := []*IssueType{ { - ID: Ptr(int64(410)), - NodeID: Ptr("IT_kwDNAd3NAZo"), - Name: Ptr("Task"), - Description: Ptr("A specific piece of work"), + ID: new(int64(410)), + NodeID: new("IT_kwDNAd3NAZo"), + Name: new("Task"), + Description: new("A specific piece of work"), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), }, { - ID: Ptr(int64(411)), - NodeID: Ptr("IT_kwDNAd3NAZs"), - Name: Ptr("Bug"), - Description: Ptr("An unexpected problem or behavior"), + ID: new(int64(411)), + NodeID: new("IT_kwDNAd3NAZs"), + Name: new("Bug"), + Description: new("An unexpected problem or behavior"), CreatedAt: refTimestamp(1136178002), UpdatedAt: refTimestamp(1136178003), }, @@ -88,10 +88,10 @@ func TestOrganizationsService_CreateIssueType(t *testing.T) { input := &CreateOrUpdateIssueTypesOptions{ Name: "Epic", - Description: Ptr("An issue type for a multi-week tracking of work"), + Description: new("An issue type for a multi-week tracking of work"), IsEnabled: true, - Color: Ptr("green"), - IsPrivate: Ptr(true), + Color: new("green"), + IsPrivate: new(true), } mux.HandleFunc("/orgs/o/issue-types", func(w http.ResponseWriter, r *http.Request) { @@ -113,10 +113,10 @@ func TestOrganizationsService_CreateIssueType(t *testing.T) { t.Errorf("Organizations.CreateIssueType returned error: %v", err) } want := &IssueType{ - ID: Ptr(int64(410)), - NodeID: Ptr("IT_kwDNAd3NAZo"), - Name: Ptr("Epic"), - Description: Ptr("An issue type for a multi-week tracking of work"), + ID: new(int64(410)), + NodeID: new("IT_kwDNAd3NAZo"), + Name: new("Epic"), + Description: new("An issue type for a multi-week tracking of work"), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), } @@ -146,10 +146,10 @@ func TestOrganizationsService_UpdateIssueType(t *testing.T) { input := &CreateOrUpdateIssueTypesOptions{ Name: "Epic", - Description: Ptr("An issue type for a multi-week tracking of work"), + Description: new("An issue type for a multi-week tracking of work"), IsEnabled: true, - Color: Ptr("green"), - IsPrivate: Ptr(true), + Color: new("green"), + IsPrivate: new(true), } mux.HandleFunc("/orgs/o/issue-types/410", func(w http.ResponseWriter, r *http.Request) { @@ -171,10 +171,10 @@ func TestOrganizationsService_UpdateIssueType(t *testing.T) { t.Errorf("Organizations.UpdateIssueType returned error: %v", err) } want := &IssueType{ - ID: Ptr(int64(410)), - NodeID: Ptr("IT_kwDNAd3NAZo"), - Name: Ptr("Epic"), - Description: Ptr("An issue type for a multi-week tracking of work"), + ID: new(int64(410)), + NodeID: new("IT_kwDNAd3NAZo"), + Name: new("Epic"), + Description: new("An issue type for a multi-week tracking of work"), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), } diff --git a/github/orgs_members_test.go b/github/orgs_members_test.go index 576620a77ec..ca6fb90785c 100644 --- a/github/orgs_members_test.go +++ b/github/orgs_members_test.go @@ -39,7 +39,7 @@ func TestOrganizationsService_ListMembers(t *testing.T) { t.Errorf("Organizations.ListMembers returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want) } @@ -84,7 +84,7 @@ func TestOrganizationsService_ListMembers_public(t *testing.T) { t.Errorf("Organizations.ListMembers returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want) } @@ -389,7 +389,7 @@ func TestOrganizationsService_ListOrgMemberships(t *testing.T) { t.Errorf("Organizations.ListOrgMemberships returned error: %v", err) } - want := []*Membership{{URL: Ptr("u")}} + want := []*Membership{{URL: new("u")}} if !cmp.Equal(memberships, want) { t.Errorf("Organizations.ListOrgMemberships returned %+v, want %+v", memberships, want) } @@ -419,7 +419,7 @@ func TestOrganizationsService_GetOrgMembership_AuthenticatedUser(t *testing.T) { t.Errorf("Organizations.GetOrgMembership returned error: %v", err) } - want := &Membership{URL: Ptr("u")} + want := &Membership{URL: new("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.GetOrgMembership returned %+v, want %+v", membership, want) } @@ -454,7 +454,7 @@ func TestOrganizationsService_GetOrgMembership_SpecifiedUser(t *testing.T) { t.Errorf("Organizations.GetOrgMembership returned error: %v", err) } - want := &Membership{URL: Ptr("u")} + want := &Membership{URL: new("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.GetOrgMembership returned %+v, want %+v", membership, want) } @@ -464,7 +464,7 @@ func TestOrganizationsService_EditOrgMembership_AuthenticatedUser(t *testing.T) t.Parallel() client, mux, _ := setup(t) - input := &Membership{State: Ptr("active")} + input := &Membership{State: new("active")} mux.HandleFunc("/user/memberships/orgs/o", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -478,7 +478,7 @@ func TestOrganizationsService_EditOrgMembership_AuthenticatedUser(t *testing.T) t.Errorf("Organizations.EditOrgMembership returned error: %v", err) } - want := &Membership{URL: Ptr("u")} + want := &Membership{URL: new("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.EditOrgMembership returned %+v, want %+v", membership, want) } @@ -502,7 +502,7 @@ func TestOrganizationsService_EditOrgMembership_SpecifiedUser(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Membership{State: Ptr("active")} + input := &Membership{State: new("active")} mux.HandleFunc("/orgs/o/memberships/u", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -516,7 +516,7 @@ func TestOrganizationsService_EditOrgMembership_SpecifiedUser(t *testing.T) { t.Errorf("Organizations.EditOrgMembership returned error: %v", err) } - want := &Membership{URL: Ptr("u")} + want := &Membership{URL: new("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.EditOrgMembership returned %+v, want %+v", membership, want) } @@ -596,32 +596,32 @@ func TestOrganizationsService_ListPendingOrgInvitations(t *testing.T) { want := []*Invitation{ { - ID: Ptr(int64(1)), - Login: Ptr("monalisa"), - Email: Ptr("octocat@github.com"), - Role: Ptr("direct_member"), + ID: new(int64(1)), + Login: new("monalisa"), + Email: new("octocat@github.com"), + Role: new("direct_member"), CreatedAt: &referenceTimestamp, Inviter: &User{ - Login: Ptr("other_user"), - ID: Ptr(int64(1)), - AvatarURL: Ptr("https://github.com/images/error/other_user_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/other_user"), - HTMLURL: Ptr("https://github.com/other_user"), - FollowersURL: Ptr("https://api.github.com/users/other_user/followers"), - FollowingURL: Ptr("https://api.github.com/users/other_user/following/other_user"), - GistsURL: Ptr("https://api.github.com/users/other_user/gists/gist_id"), - StarredURL: Ptr("https://api.github.com/users/other_user/starred/owner/repo"), - SubscriptionsURL: Ptr("https://api.github.com/users/other_user/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/other_user/orgs"), - ReposURL: Ptr("https://api.github.com/users/other_user/repos"), - EventsURL: Ptr("https://api.github.com/users/other_user/events/privacy"), - ReceivedEventsURL: Ptr("https://api.github.com/users/other_user/received_events/privacy"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("other_user"), + ID: new(int64(1)), + AvatarURL: new("https://github.com/images/error/other_user_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/other_user"), + HTMLURL: new("https://github.com/other_user"), + FollowersURL: new("https://api.github.com/users/other_user/followers"), + FollowingURL: new("https://api.github.com/users/other_user/following/other_user"), + GistsURL: new("https://api.github.com/users/other_user/gists/gist_id"), + StarredURL: new("https://api.github.com/users/other_user/starred/owner/repo"), + SubscriptionsURL: new("https://api.github.com/users/other_user/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/other_user/orgs"), + ReposURL: new("https://api.github.com/users/other_user/repos"), + EventsURL: new("https://api.github.com/users/other_user/events/privacy"), + ReceivedEventsURL: new("https://api.github.com/users/other_user/received_events/privacy"), + Type: new("User"), + SiteAdmin: new(false), }, - TeamCount: Ptr(2), - InvitationTeamURL: Ptr("https://api.github.com/organizations/2/invitations/1/teams"), + TeamCount: new(2), + InvitationTeamURL: new("https://api.github.com/organizations/2/invitations/1/teams"), }, } @@ -649,8 +649,8 @@ func TestOrganizationsService_CreateOrgInvitation(t *testing.T) { client, mux, _ := setup(t) input := &CreateOrgInvitationOptions{ - Email: Ptr("octocat@github.com"), - Role: Ptr("direct_member"), + Email: new("octocat@github.com"), + Role: new("direct_member"), TeamID: []int64{ 12, 26, @@ -669,7 +669,7 @@ func TestOrganizationsService_CreateOrgInvitation(t *testing.T) { t.Errorf("Organizations.CreateOrgInvitation returned error: %v", err) } - want := &Invitation{Email: Ptr("octocat@github.com")} + want := &Invitation{Email: new("octocat@github.com")} if !cmp.Equal(invitations, want) { t.Errorf("Organizations.CreateOrgInvitation returned %+v, want %+v", invitations, want) } @@ -720,15 +720,15 @@ func TestOrganizationsService_ListOrgInvitationTeams(t *testing.T) { want := []*Team{ { - ID: Ptr(int64(1)), - URL: Ptr("https://api.github.com/teams/1"), - Name: Ptr("Justice League"), - Slug: Ptr("justice-league"), - Description: Ptr("A great team."), - Privacy: Ptr("closed"), - Permission: Ptr("admin"), - MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), + ID: new(int64(1)), + URL: new("https://api.github.com/teams/1"), + Name: new("Justice League"), + Slug: new("justice-league"), + Description: new("A great team."), + Privacy: new("closed"), + Permission: new("admin"), + MembersURL: new("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: new("https://api.github.com/teams/1/repos"), }, } @@ -803,36 +803,36 @@ func TestOrganizationsService_ListFailedOrgInvitations(t *testing.T) { want := []*Invitation{ { - ID: Ptr(int64(1)), - Login: Ptr("monalisa"), - NodeID: Ptr("MDQ6VXNlcjE="), - Email: Ptr("octocat@github.com"), - Role: Ptr("direct_member"), + ID: new(int64(1)), + Login: new("monalisa"), + NodeID: new("MDQ6VXNlcjE="), + Email: new("octocat@github.com"), + Role: new("direct_member"), CreatedAt: refTimestamp(1136178000), FailedAt: refTimestamp(1136178001), - FailedReason: Ptr("the reason"), + FailedReason: new("the reason"), Inviter: &User{ - Login: Ptr("other_user"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VXNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/other_user_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/other_user"), - HTMLURL: Ptr("https://github.com/other_user"), - FollowersURL: Ptr("https://api.github.com/users/other_user/followers"), - FollowingURL: Ptr("https://api.github.com/users/other_user/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/other_user/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/other_user/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/other_user/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/other_user/orgs"), - ReposURL: Ptr("https://api.github.com/users/other_user/repos"), - EventsURL: Ptr("https://api.github.com/users/other_user/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/other_user/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("other_user"), + ID: new(int64(1)), + NodeID: new("MDQ6VXNlcjE="), + AvatarURL: new("https://github.com/images/error/other_user_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/other_user"), + HTMLURL: new("https://github.com/other_user"), + FollowersURL: new("https://api.github.com/users/other_user/followers"), + FollowingURL: new("https://api.github.com/users/other_user/following{/other_user}"), + GistsURL: new("https://api.github.com/users/other_user/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/other_user/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/other_user/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/other_user/orgs"), + ReposURL: new("https://api.github.com/users/other_user/repos"), + EventsURL: new("https://api.github.com/users/other_user/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/other_user/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, - TeamCount: Ptr(2), - InvitationTeamURL: Ptr("https://api.github.com/organizations/2/invitations/1/teams"), + TeamCount: new(2), + InvitationTeamURL: new("https://api.github.com/organizations/2/invitations/1/teams"), }, } diff --git a/github/orgs_network_configurations_test.go b/github/orgs_network_configurations_test.go index cb2767cfe51..1150005bf8e 100644 --- a/github/orgs_network_configurations_test.go +++ b/github/orgs_network_configurations_test.go @@ -65,12 +65,12 @@ func TestOrganizationsService_ListOrgsNetworkConfigurations(t *testing.T) { t.Errorf("Organizations.ListNetworkConfigurations returned error %v", err) } want := &NetworkConfigurations{ - TotalCount: Ptr(int64(3)), + TotalCount: new(int64(3)), NetworkConfigurations: []*NetworkConfiguration{ { - ID: Ptr("123456789ABCDEF"), - Name: Ptr("Network Configuration One"), - ComputeService: Ptr(ComputeService("actions")), + ID: new("123456789ABCDEF"), + Name: new("Network Configuration One"), + ComputeService: new(ComputeService("actions")), NetworkSettingsIDs: []string{ "23456789ABDCEF1", "3456789ABDCEF12", @@ -78,9 +78,9 @@ func TestOrganizationsService_ListOrgsNetworkConfigurations(t *testing.T) { CreatedOn: &referenceTimestamp, }, { - ID: Ptr("456789ABDCEF123"), - Name: Ptr("Network Configuration Two"), - ComputeService: Ptr(ComputeService("none")), + ID: new("456789ABDCEF123"), + Name: new("Network Configuration Two"), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", "6789ABDCEF12345", @@ -88,9 +88,9 @@ func TestOrganizationsService_ListOrgsNetworkConfigurations(t *testing.T) { CreatedOn: &referenceTimestamp, }, { - ID: Ptr("789ABDCEF123456"), - Name: Ptr("Network Configuration Three"), - ComputeService: Ptr(ComputeService("codespaces")), + ID: new("789ABDCEF123456"), + Name: new("Network Configuration Three"), + ComputeService: new(ComputeService("codespaces")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", "6789ABDCEF12345", @@ -138,8 +138,8 @@ func TestOrganizationsService_CreateOrgsNetworkConfiguration(t *testing.T) { ctx := t.Context() req := NetworkConfigurationRequest{ - Name: Ptr("network-configuration-two"), - ComputeService: Ptr(ComputeService("none")), + Name: new("network-configuration-two"), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -151,9 +151,9 @@ func TestOrganizationsService_CreateOrgsNetworkConfiguration(t *testing.T) { } want := &NetworkConfiguration{ - ID: Ptr("456789ABDCEF123"), - Name: Ptr("network-configuration-two"), - ComputeService: Ptr(ComputeService("none")), + ID: new("456789ABDCEF123"), + Name: new("network-configuration-two"), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -172,8 +172,8 @@ func TestOrganizationsService_CreateOrgsNetworkConfiguration(t *testing.T) { { name: "invalid network configuration name length", request: NetworkConfigurationRequest{ - Name: Ptr(""), - ComputeService: Ptr(ComputeService("none")), + Name: new(""), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -184,7 +184,7 @@ func TestOrganizationsService_CreateOrgsNetworkConfiguration(t *testing.T) { name: "invalid network configuration name", // may only contain upper and lowercase letters a-z, numbers 0-9, '.', '-', and '_'. request: NetworkConfigurationRequest{ - Name: Ptr("network configuration two"), + Name: new("network configuration two"), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -194,8 +194,8 @@ func TestOrganizationsService_CreateOrgsNetworkConfiguration(t *testing.T) { { name: "invalid network settings ids", request: NetworkConfigurationRequest{ - Name: Ptr("network-configuration-two"), - ComputeService: Ptr(ComputeService("none")), + Name: new("network-configuration-two"), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", "3456789ABDCEF12", @@ -206,8 +206,8 @@ func TestOrganizationsService_CreateOrgsNetworkConfiguration(t *testing.T) { { name: "invalid compute service", request: NetworkConfigurationRequest{ - Name: Ptr("network-configuration-two"), - ComputeService: Ptr(ComputeService("codespaces")), + Name: new("network-configuration-two"), + ComputeService: new(ComputeService("codespaces")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -263,9 +263,9 @@ func TestOrganizationsService_GetOrgsNetworkConfiguration(t *testing.T) { t.Errorf("Organizations.GetNetworkConfiguration returned error: %v", err) } want := &NetworkConfiguration{ - ID: Ptr("789ABDCEF123456"), - Name: Ptr("Network Configuration Three"), - ComputeService: Ptr(ComputeService("codespaces")), + ID: new("789ABDCEF123456"), + Name: new("Network Configuration Three"), + ComputeService: new(ComputeService("codespaces")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", "6789ABDCEF12345", @@ -312,8 +312,8 @@ func TestOrganizationsService_UpdateOrgsNetworkConfiguration(t *testing.T) { ctx := t.Context() req := NetworkConfigurationRequest{ - Name: Ptr("network-configuration-three-update"), - ComputeService: Ptr(ComputeService("actions")), + Name: new("network-configuration-three-update"), + ComputeService: new(ComputeService("actions")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -324,9 +324,9 @@ func TestOrganizationsService_UpdateOrgsNetworkConfiguration(t *testing.T) { } want := &NetworkConfiguration{ - ID: Ptr("789ABDCEF123456"), - Name: Ptr("Network Configuration Three Update"), - ComputeService: Ptr(ComputeService("actions")), + ID: new("789ABDCEF123456"), + Name: new("Network Configuration Three Update"), + ComputeService: new(ComputeService("actions")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", "6789ABDCEF12345", @@ -345,8 +345,8 @@ func TestOrganizationsService_UpdateOrgsNetworkConfiguration(t *testing.T) { { name: "invalid network configuration name length", request: NetworkConfigurationRequest{ - Name: Ptr(""), - ComputeService: Ptr(ComputeService("none")), + Name: new(""), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -357,7 +357,7 @@ func TestOrganizationsService_UpdateOrgsNetworkConfiguration(t *testing.T) { name: "invalid network configuration name", // may only contain upper and lowercase letters a-z, numbers 0-9, '.', '-', and '_'. request: NetworkConfigurationRequest{ - Name: Ptr("network configuration three update"), + Name: new("network configuration three update"), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -367,8 +367,8 @@ func TestOrganizationsService_UpdateOrgsNetworkConfiguration(t *testing.T) { { name: "invalid network settings ids", request: NetworkConfigurationRequest{ - Name: Ptr("network-configuration-three-update"), - ComputeService: Ptr(ComputeService("none")), + Name: new("network-configuration-three-update"), + ComputeService: new(ComputeService("none")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", "3456789ABDCEF12", @@ -379,8 +379,8 @@ func TestOrganizationsService_UpdateOrgsNetworkConfiguration(t *testing.T) { { name: "invalid compute service", request: NetworkConfigurationRequest{ - Name: Ptr("network-configuration-three-update"), - ComputeService: Ptr(ComputeService("codespaces")), + Name: new("network-configuration-three-update"), + ComputeService: new(ComputeService("codespaces")), NetworkSettingsIDs: []string{ "56789ABDCEF1234", }, @@ -460,11 +460,11 @@ func TestOrganizationsService_GetOrgsNetworkConfigurationResource(t *testing.T) } want := &NetworkSettingsResource{ - ID: Ptr("220F78DACB92BBFBC5E6F22DE1CCF52309D"), - Name: Ptr("my_network_settings"), - NetworkConfigurationID: Ptr("934E208B3EE0BD60CF5F752C426BFB53562"), - SubnetID: Ptr("/subscriptions/14839728-3ad9-43ab-bd2b-fa6ad0f75e2a/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet"), - Region: Ptr("germanywestcentral"), + ID: new("220F78DACB92BBFBC5E6F22DE1CCF52309D"), + Name: new("my_network_settings"), + NetworkConfigurationID: new("934E208B3EE0BD60CF5F752C426BFB53562"), + SubnetID: new("/subscriptions/14839728-3ad9-43ab-bd2b-fa6ad0f75e2a/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet"), + Region: new("germanywestcentral"), } if !cmp.Equal(want, resource) { diff --git a/github/orgs_organization_properties_test.go b/github/orgs_organization_properties_test.go index e7bc715c164..1f2cd0a8b9f 100644 --- a/github/orgs_organization_properties_test.go +++ b/github/orgs_organization_properties_test.go @@ -71,8 +71,8 @@ func TestOrganizationsService_CreateOrUpdateOrganizationCustomPropertyValues(t * ctx := t.Context() values := []*CustomPropertyValue{ - {PropertyName: "team", Value: Ptr("core")}, - {PropertyName: "level", Value: Ptr("gold")}, + {PropertyName: "team", Value: new("core")}, + {PropertyName: "level", Value: new("gold")}, } props := OrganizationCustomPropertyValues{ diff --git a/github/orgs_organization_roles_test.go b/github/orgs_organization_roles_test.go index e1300ad5356..ef9f7d70115 100644 --- a/github/orgs_organization_roles_test.go +++ b/github/orgs_organization_roles_test.go @@ -52,28 +52,28 @@ func TestOrganizationsService_ListRoles(t *testing.T) { } want := &OrganizationCustomRoles{ - TotalCount: Ptr(1), + TotalCount: new(1), CustomRepoRoles: []*CustomOrgRole{ { - ID: Ptr(int64(1)), - Name: Ptr("Auditor"), + ID: new(int64(1)), + Name: new("Auditor"), Permissions: []string{"read_audit_logs"}, Org: &Organization{ - Login: Ptr("l"), - ID: Ptr(int64(1)), - NodeID: Ptr("n"), - AvatarURL: Ptr("a"), - HTMLURL: Ptr("h"), - Name: Ptr("n"), - Company: Ptr("c"), - Blog: Ptr("b"), - Location: Ptr("l"), - Email: Ptr("e"), + Login: new("l"), + ID: new(int64(1)), + NodeID: new("n"), + AvatarURL: new("a"), + HTMLURL: new("h"), + Name: new("n"), + Company: new("c"), + Blog: new("b"), + Location: new("l"), + Email: new("e"), }, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Source: Ptr("Organization"), - BaseRole: Ptr("admin"), + Source: new("Organization"), + BaseRole: new("admin"), }, }, } @@ -123,14 +123,14 @@ func TestOrganizationsService_GetOrgRole(t *testing.T) { } wantBuiltInRole := &CustomOrgRole{ - ID: Ptr(int64(8132)), - Name: Ptr("all_repo_read"), - Description: Ptr("Grants read access to all repositories in the organization."), + ID: new(int64(8132)), + Name: new("all_repo_read"), + Description: new("Grants read access to all repositories in the organization."), Permissions: []string{}, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Source: Ptr("Predefined"), - BaseRole: Ptr("read"), + Source: new("Predefined"), + BaseRole: new("read"), } if !cmp.Equal(gotBuiltInRole, wantBuiltInRole) { @@ -162,9 +162,9 @@ func TestOrganizationsService_GetOrgRole(t *testing.T) { } wantCustomRole := &CustomOrgRole{ - ID: Ptr(int64(123456)), - Name: Ptr("test-role"), - Description: Ptr("test-role"), + ID: new(int64(123456)), + Name: new("test-role"), + Description: new("test-role"), Permissions: []string{ "read_organization_custom_org_role", "read_organization_custom_repo_role", @@ -172,7 +172,7 @@ func TestOrganizationsService_GetOrgRole(t *testing.T) { }, CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Source: Ptr("Organization"), + Source: new("Organization"), BaseRole: nil, } @@ -209,14 +209,14 @@ func TestOrganizationsService_CreateCustomOrgRole(t *testing.T) { opts := CreateCustomOrgRoleRequest{ Name: "Reader", Permissions: []string{"read_organization_custom_org_role"}, - Description: Ptr("A role for reading custom org roles"), + Description: new("A role for reading custom org roles"), } gotRoles, _, err := client.Organizations.CreateCustomOrgRole(ctx, "o", opts) if err != nil { t.Errorf("Organizations.CreateCustomOrgRole returned error: %v", err) } - want := &CustomOrgRole{ID: Ptr(int64(8030)), Name: Ptr("Reader"), Permissions: []string{"read_organization_custom_org_role"}, Description: Ptr("A role for reading custom org roles")} + want := &CustomOrgRole{ID: new(int64(8030)), Name: new("Reader"), Permissions: []string{"read_organization_custom_org_role"}, Description: new("A role for reading custom org roles")} if !cmp.Equal(gotRoles, want) { t.Errorf("Organizations.CreateCustomOrgRole returned %+v, want %+v", gotRoles, want) @@ -249,15 +249,15 @@ func TestOrganizationsService_UpdateCustomOrgRole(t *testing.T) { ctx := t.Context() opts := UpdateCustomOrgRoleRequest{ - Name: Ptr("Updated Name"), - Description: Ptr("Updated Description"), + Name: new("Updated Name"), + Description: new("Updated Description"), } gotRoles, _, err := client.Organizations.UpdateCustomOrgRole(ctx, "o", 8030, opts) if err != nil { t.Errorf("Organizations.UpdateCustomOrgRole returned error: %v", err) } - want := &CustomOrgRole{ID: Ptr(int64(8030)), Name: Ptr("Updated Name"), Permissions: []string{"read_organization_custom_org_role"}, Description: Ptr("Updated Description")} + want := &CustomOrgRole{ID: new(int64(8030)), Name: new("Updated Name"), Permissions: []string{"read_organization_custom_org_role"}, Description: new("Updated Description")} if !cmp.Equal(gotRoles, want) { t.Errorf("Organizations.UpdateCustomOrgRole returned %+v, want %+v", gotRoles, want) @@ -440,7 +440,7 @@ func TestOrganizationsService_ListTeamsAssignedToOrgRole(t *testing.T) { t.Errorf("Organizations.ListTeamsAssignedToOrgRole returned error: %v", err) } - want := []*Team{{ID: Ptr(int64(1))}} + want := []*Team{{ID: new(int64(1))}} if !cmp.Equal(apps, want) { t.Errorf("Organizations.ListTeamsAssignedToOrgRole returned %+v, want %+v", apps, want) } @@ -475,7 +475,7 @@ func TestOrganizationsService_ListUsersAssignedToOrgRole(t *testing.T) { t.Errorf("Organizations.ListUsersAssignedToOrgRole returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(apps, want) { t.Errorf("Organizations.ListUsersAssignedToOrgRole returned %+v, want %+v", apps, want) } diff --git a/github/orgs_outside_collaborators_test.go b/github/orgs_outside_collaborators_test.go index 8d27a13b8b7..7ffe1897c35 100644 --- a/github/orgs_outside_collaborators_test.go +++ b/github/orgs_outside_collaborators_test.go @@ -37,7 +37,7 @@ func TestOrganizationsService_ListOutsideCollaborators(t *testing.T) { t.Errorf("Organizations.ListOutsideCollaborators returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Organizations.ListOutsideCollaborators returned %+v, want %+v", members, want) } diff --git a/github/orgs_packages_test.go b/github/orgs_packages_test.go index 18e506a006e..7084d8785d8 100644 --- a/github/orgs_packages_test.go +++ b/github/orgs_packages_test.go @@ -64,34 +64,34 @@ func TestOrganizationsService_ListPackages(t *testing.T) { } want := []*Package{{ - ID: Ptr(int64(197)), - Name: Ptr("hello_docker"), - PackageType: Ptr("container"), - VersionCount: Ptr(int64(1)), - Visibility: Ptr("private"), - URL: Ptr("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: Ptr("https://github.com/orgs/github/packages/container/package/hello_docker"), + ID: new(int64(197)), + Name: new("hello_docker"), + PackageType: new("container"), + VersionCount: new(int64(1)), + Visibility: new("private"), + URL: new("https://api.github.com/orgs/github/packages/container/hello_docker"), + HTMLURL: new("https://github.com/orgs/github/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, Owner: &User{ - Login: Ptr("github"), - ID: Ptr(int64(9919)), - NodeID: Ptr("MDEyOk9yZ2FuaXphdGlvbjk5MTk="), - AvatarURL: Ptr("https://avatars.githubusercontent.com/u/9919?v=4"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/github"), - HTMLURL: Ptr("https://github.com/github"), - FollowersURL: Ptr("https://api.github.com/users/github/followers"), - FollowingURL: Ptr("https://api.github.com/users/github/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/github/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/github/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/github/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/github/orgs"), - ReposURL: Ptr("https://api.github.com/users/github/repos"), - EventsURL: Ptr("https://api.github.com/users/github/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/github/received_events"), - Type: Ptr("Organization"), - SiteAdmin: Ptr(false), + Login: new("github"), + ID: new(int64(9919)), + NodeID: new("MDEyOk9yZ2FuaXphdGlvbjk5MTk="), + AvatarURL: new("https://avatars.githubusercontent.com/u/9919?v=4"), + GravatarID: new(""), + URL: new("https://api.github.com/users/github"), + HTMLURL: new("https://github.com/github"), + FollowersURL: new("https://api.github.com/users/github/followers"), + FollowingURL: new("https://api.github.com/users/github/following{/other_user}"), + GistsURL: new("https://api.github.com/users/github/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/github/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/github/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/github/orgs"), + ReposURL: new("https://api.github.com/users/github/repos"), + EventsURL: new("https://api.github.com/users/github/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/github/received_events"), + Type: new("Organization"), + SiteAdmin: new(false), }, }} if !cmp.Equal(packages, want) { @@ -143,13 +143,13 @@ func TestOrganizationsService_GetPackage(t *testing.T) { } want := &Package{ - ID: Ptr(int64(197)), - Name: Ptr("hello/hello_docker"), - PackageType: Ptr("container"), - VersionCount: Ptr(int64(1)), - Visibility: Ptr("private"), - URL: Ptr("https://api.github.com/orgs/github/packages/container/hello%2Fhello_docker"), - HTMLURL: Ptr("https://github.com/orgs/github/packages/container/package/hello%2Fhello_docker"), + ID: new(int64(197)), + Name: new("hello/hello_docker"), + PackageType: new("container"), + VersionCount: new(int64(1)), + Visibility: new("private"), + URL: new("https://api.github.com/orgs/github/packages/container/hello%2Fhello_docker"), + HTMLURL: new("https://github.com/orgs/github/packages/container/package/hello%2Fhello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -263,7 +263,7 @@ func TestOrganizationsService_ListPackagesVersions(t *testing.T) { ctx := t.Context() opts := &PackageListOptions{ - Ptr("internal"), Ptr("container"), Ptr("deleted"), ListOptions{Page: 1, PerPage: 2}, + new("internal"), new("container"), new("deleted"), ListOptions{Page: 1, PerPage: 2}, } packages, _, err := client.Organizations.PackageGetAllVersions(ctx, "o", "container", "hello/hello_docker", opts) if err != nil { @@ -271,13 +271,13 @@ func TestOrganizationsService_ListPackagesVersions(t *testing.T) { } want := []*PackageVersion{{ - ID: Ptr(int64(45763)), - Name: Ptr("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: Ptr("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), - PackageHTMLURL: Ptr("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), + ID: new(int64(45763)), + Name: new("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), + URL: new("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), + PackageHTMLURL: new("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), + HTMLURL: new("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), Metadata: json.RawMessage(m), }} if !cmp.Equal(packages, want) { @@ -338,13 +338,13 @@ func TestOrganizationsService_PackageGetVersion(t *testing.T) { } want := &PackageVersion{ - ID: Ptr(int64(45763)), - Name: Ptr("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: Ptr("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), - PackageHTMLURL: Ptr("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), + ID: new(int64(45763)), + Name: new("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), + URL: new("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), + PackageHTMLURL: new("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), + HTMLURL: new("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), Metadata: json.RawMessage(m), } if !cmp.Equal(packages, want) { diff --git a/github/orgs_personal_access_tokens_test.go b/github/orgs_personal_access_tokens_test.go index b2d82399cbb..f29854b7eba 100644 --- a/github/orgs_personal_access_tokens_test.go +++ b/github/orgs_personal_access_tokens_test.go @@ -84,35 +84,35 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokens(t *testing.T) want := []*PersonalAccessToken{ { - ID: Ptr(int64(25381)), + ID: new(int64(25381)), Owner: &User{ - Login: Ptr("octocat"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VXNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/octocat_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/octocat"), - HTMLURL: Ptr("https://github.com/octocat"), - FollowersURL: Ptr("https://api.github.com/users/octocat/followers"), - FollowingURL: Ptr("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/octocat/orgs"), - ReposURL: Ptr("https://api.github.com/users/octocat/repos"), - EventsURL: Ptr("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/octocat/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("octocat"), + ID: new(int64(1)), + NodeID: new("MDQ6VXNlcjE="), + AvatarURL: new("https://github.com/images/error/octocat_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/octocat"), + HTMLURL: new("https://github.com/octocat"), + FollowersURL: new("https://api.github.com/users/octocat/followers"), + FollowingURL: new("https://api.github.com/users/octocat/following{/other_user}"), + GistsURL: new("https://api.github.com/users/octocat/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/octocat/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/octocat/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/octocat/orgs"), + ReposURL: new("https://api.github.com/users/octocat/repos"), + EventsURL: new("https://api.github.com/users/octocat/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/octocat/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, - RepositorySelection: Ptr("all"), - RepositoriesURL: Ptr("https://api.github.com/organizations/652551/personal-access-tokens/25381/repositories"), + RepositorySelection: new("all"), + RepositoriesURL: new("https://api.github.com/organizations/652551/personal-access-tokens/25381/repositories"), Permissions: &PersonalAccessTokenPermissions{ Org: map[string]string{"members": "read"}, Repo: map[string]string{"metadata": "read"}, }, AccessGrantedAt: refTimestamp(1136178000), - TokenExpired: Ptr(false), + TokenExpired: new(false), TokenExpiresAt: refTimestamp(1136178001), TokenLastUsedAt: nil, }, @@ -237,24 +237,24 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokenRequests(t *test ID: 1848980, Reason: "", Owner: User{ - Login: Ptr("octocat"), - ID: Ptr(int64(1)), - NodeID: Ptr("MDQ6VXNlcjE="), - AvatarURL: Ptr("https://github.com/images/error/octocat_happy.gif"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/octocat"), - HTMLURL: Ptr("https://github.com/octocat"), - FollowersURL: Ptr("https://api.github.com/users/octocat/followers"), - FollowingURL: Ptr("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/octocat/orgs"), - ReposURL: Ptr("https://api.github.com/users/octocat/repos"), - EventsURL: Ptr("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/octocat/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("octocat"), + ID: new(int64(1)), + NodeID: new("MDQ6VXNlcjE="), + AvatarURL: new("https://github.com/images/error/octocat_happy.gif"), + GravatarID: new(""), + URL: new("https://api.github.com/users/octocat"), + HTMLURL: new("https://github.com/octocat"), + FollowersURL: new("https://api.github.com/users/octocat/followers"), + FollowingURL: new("https://api.github.com/users/octocat/following{/other_user}"), + GistsURL: new("https://api.github.com/users/octocat/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/octocat/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/octocat/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/octocat/orgs"), + ReposURL: new("https://api.github.com/users/octocat/repos"), + EventsURL: new("https://api.github.com/users/octocat/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/octocat/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, RepositorySelection: "all", RepositoriesURL: "https://api.github.com/organizations/135028681/personal-access-token-requests/1848980/repositories", @@ -338,7 +338,7 @@ func TestOrganizationsService_ReviewPersonalAccessTokenRequest(t *testing.T) { input := ReviewPersonalAccessTokenRequestOptions{ Action: "a", - Reason: Ptr("r"), + Reason: new("r"), } mux.HandleFunc("/orgs/o/personal-access-token-requests/1", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/orgs_properties_test.go b/github/orgs_properties_test.go index c2e5f8a5201..10de42fe2da 100644 --- a/github/orgs_properties_test.go +++ b/github/orgs_properties_test.go @@ -76,37 +76,37 @@ func TestOrganizationsService_GetAllCustomProperties(t *testing.T) { want := []*CustomProperty{ { - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), }, { - PropertyName: Ptr("test"), + PropertyName: new("test"), ValueType: PropertyValueTypeMultiSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: []any{"foo", "baz"}, - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"foo", "bar", "baz"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), }, { - PropertyName: Ptr("service"), + PropertyName: new("service"), ValueType: PropertyValueTypeString, }, { - PropertyName: Ptr("team"), + PropertyName: new("team"), ValueType: PropertyValueTypeString, - Description: Ptr("Team owning the repository"), + Description: new("Team owning the repository"), }, { - PropertyName: Ptr("documentation"), + PropertyName: new("documentation"), ValueType: PropertyValueTypeURL, - Required: Ptr(true), - Description: Ptr("Link to the documentation"), + Required: new(true), + Description: new("Link to the documentation"), DefaultValue: "https://example.com/docs", }, } @@ -135,12 +135,12 @@ func TestOrganizationsService_CreateOrUpdateCustomProperties(t *testing.T) { }{ Properties: []*CustomProperty{ { - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), }, { - PropertyName: Ptr("service"), + PropertyName: new("service"), ValueType: PropertyValueTypeString, }, }, @@ -170,12 +170,12 @@ func TestOrganizationsService_CreateOrUpdateCustomProperties(t *testing.T) { want := []*CustomProperty{ { - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), }, { - PropertyName: Ptr("service"), + PropertyName: new("service"), ValueType: PropertyValueTypeString, }, } @@ -222,13 +222,13 @@ func TestOrganizationsService_GetCustomProperty(t *testing.T) { } want := &CustomProperty{ - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), } if !cmp.Equal(property, want) { t.Errorf("Organizations.GetCustomProperty returned %+v, want %+v", property, want) @@ -268,24 +268,24 @@ func TestOrganizationsService_CreateOrUpdateCustomProperty(t *testing.T) { ctx := t.Context() property, _, err := client.Organizations.CreateOrUpdateCustomProperty(ctx, "o", "name", &CustomProperty{ ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), }) if err != nil { t.Errorf("Organizations.CreateOrUpdateCustomProperty returned error: %v", err) } want := &CustomProperty{ - PropertyName: Ptr("name"), + PropertyName: new("name"), ValueType: PropertyValueTypeSingleSelect, - Required: Ptr(true), + Required: new(true), DefaultValue: "production", - Description: Ptr("Prod or dev environment"), + Description: new("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: Ptr("org_actors"), + ValuesEditableBy: new("org_actors"), } if !cmp.Equal(property, want) { t.Errorf("Organizations.CreateOrUpdateCustomProperty returned %+v, want %+v", property, want) diff --git a/github/orgs_rules_test.go b/github/orgs_rules_test.go index 8d46b456c33..4b9c601b002 100644 --- a/github/orgs_rules_test.go +++ b/github/orgs_rules_test.go @@ -43,15 +43,15 @@ func TestOrganizationsService_ListAllRepositoryRulesets(t *testing.T) { } want := []*RepositoryRuleset{{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", - NodeID: Ptr("nid"), + NodeID: new("nid"), Links: &RepositoryRulesetLinks{ - Self: &RepositoryRulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/21")}, + Self: &RepositoryRulesetLink{HRef: new("https://api.github.com/orgs/o/rulesets/21")}, }, }} if !cmp.Equal(rulesets, want) { @@ -91,7 +91,7 @@ func TestOrganizationsService_ListAllRepositoryRulesets_ListOptions(t *testing.T } want := []*RepositoryRuleset{{ - ID: Ptr(int64(21)), + ID: new(int64(21)), }} if !cmp.Equal(rulesets, want) { t.Errorf("Organizations.ListAllRepositoryRulesets returned %+v, want %+v", rulesets, want) @@ -271,17 +271,17 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { ctx := t.Context() ruleset, _, err := client.Organizations.CreateRepositoryRuleset(ctx, "o", RepositoryRuleset{ Name: "ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, { - ActorID: Ptr(int64(345)), - ActorType: Ptr(BypassActorTypeTeam), - BypassMode: Ptr(BypassModeExempt), + ActorID: new(int64(345)), + ActorType: new(BypassActorTypeTeam), + BypassMode: new(BypassModeExempt), }, }, Conditions: &RepositoryRulesetConditions{ @@ -292,7 +292,7 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, }, Rules: &RepositoryRulesetRules{ @@ -315,19 +315,19 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -336,20 +336,20 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -369,21 +369,21 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, { - ActorID: Ptr(int64(345)), - ActorType: Ptr(BypassActorTypeTeam), - BypassMode: Ptr(BypassModeExempt), + ActorID: new(int64(345)), + ActorType: new(BypassActorTypeTeam), + BypassMode: new(BypassModeExempt), }, }, Conditions: &RepositoryRulesetConditions{ @@ -394,7 +394,7 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, }, Rules: &RepositoryRulesetRules{ @@ -417,19 +417,19 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -438,20 +438,20 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoNames(t *testing.T) { Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -635,12 +635,12 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) ctx := t.Context() ruleset, _, err := client.Organizations.CreateRepositoryRuleset(ctx, "o", RepositoryRuleset{ Name: "ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -648,7 +648,7 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -680,19 +680,19 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -701,20 +701,20 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -734,16 +734,16 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) } want := &RepositoryRuleset{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -751,7 +751,7 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -783,19 +783,19 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -804,20 +804,20 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoProperty(t *testing.T) Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -994,12 +994,12 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoIDs(t *testing.T) { ctx := t.Context() ruleset, _, err := client.Organizations.CreateRepositoryRuleset(ctx, "o", RepositoryRuleset{ Name: "ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -1031,19 +1031,19 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoIDs(t *testing.T) { RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -1052,20 +1052,20 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoIDs(t *testing.T) { Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -1085,16 +1085,16 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoIDs(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Ptr(int64(234)), - ActorType: Ptr(BypassActorTypeTeam), + ActorID: new(int64(234)), + ActorType: new(BypassActorTypeTeam), }, }, Conditions: &RepositoryRulesetConditions{ @@ -1126,19 +1126,19 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoIDs(t *testing.T) { RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ { Context: "test", - IntegrationID: Ptr(int64(1)), + IntegrationID: new(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("avoid test commits"), - Negate: Ptr(true), + Name: new("avoid test commits"), + Negate: new(true), Operator: "starts_with", Pattern: "[test]", }, @@ -1147,20 +1147,20 @@ func TestOrganizationsService_CreateRepositoryRuleset_RepoIDs(t *testing.T) { Pattern: "github", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("avoid commit emails"), - Negate: Ptr(true), + Name: new("avoid commit emails"), + Negate: new(true), Operator: "ends_with", Pattern: "abc", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid branch names"), - Negate: Ptr(true), + Name: new("avoid branch names"), + Negate: new(true), Operator: "regex", Pattern: "github$", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("avoid tag names"), - Negate: Ptr(true), + Name: new("avoid tag names"), + Negate: new(true), Operator: "contains", Pattern: "github", }, @@ -1246,15 +1246,15 @@ func TestOrganizationsService_GetRepositoryRuleset(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", - NodeID: Ptr("nid"), + NodeID: new("nid"), Links: &RepositoryRulesetLinks{ - Self: &RepositoryRulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/21")}, + Self: &RepositoryRulesetLink{HRef: new("https://api.github.com/orgs/o/rulesets/21")}, }, Conditions: &RepositoryRulesetConditions{ RefName: &RepositoryRulesetRefConditionParameters{ @@ -1264,7 +1264,7 @@ func TestOrganizationsService_GetRepositoryRuleset(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, }, Rules: &RepositoryRulesetRules{Creation: &EmptyRuleParameters{}}, @@ -1333,22 +1333,22 @@ func TestOrganizationsService_GetRepositoryRulesetWithRepoPropCondition(t *testi } want := &RepositoryRuleset{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", - NodeID: Ptr("nid"), + NodeID: new("nid"), Links: &RepositoryRulesetLinks{ - Self: &RepositoryRulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/21")}, + Self: &RepositoryRulesetLink{HRef: new("https://api.github.com/orgs/o/rulesets/21")}, }, Conditions: &RepositoryRulesetConditions{ RepositoryProperty: &RepositoryRulesetRepositoryPropertyConditionParameters{ Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -1424,7 +1424,7 @@ func TestOrganizationsService_UpdateRepositoryRuleset(t *testing.T) { ctx := t.Context() rulesets, _, err := client.Organizations.UpdateRepositoryRuleset(ctx, "o", 21, RepositoryRuleset{ Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", Conditions: &RepositoryRulesetConditions{ RefName: &RepositoryRulesetRefConditionParameters{ @@ -1434,7 +1434,7 @@ func TestOrganizationsService_UpdateRepositoryRuleset(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, }, Rules: &RepositoryRulesetRules{Creation: &EmptyRuleParameters{}}, @@ -1444,15 +1444,15 @@ func TestOrganizationsService_UpdateRepositoryRuleset(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", - NodeID: Ptr("nid"), + NodeID: new("nid"), Links: &RepositoryRulesetLinks{ - Self: &RepositoryRulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/21")}, + Self: &RepositoryRulesetLink{HRef: new("https://api.github.com/orgs/o/rulesets/21")}, }, Conditions: &RepositoryRulesetConditions{ RefName: &RepositoryRulesetRefConditionParameters{ @@ -1462,7 +1462,7 @@ func TestOrganizationsService_UpdateRepositoryRuleset(t *testing.T) { RepositoryName: &RepositoryRulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Ptr(true), + Protected: new(true), }, }, Rules: &RepositoryRulesetRules{Creation: &EmptyRuleParameters{}}, @@ -1527,14 +1527,14 @@ func TestOrganizationsService_UpdateRepositoryRulesetWithRepoProp(t *testing.T) ctx := t.Context() rulesets, _, err := client.Organizations.UpdateRepositoryRuleset(ctx, "o", 21, RepositoryRuleset{ Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), + Target: new(RulesetTargetBranch), Enforcement: "active", Conditions: &RepositoryRulesetConditions{ RepositoryProperty: &RepositoryRulesetRepositoryPropertyConditionParameters{ Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, @@ -1548,22 +1548,22 @@ func TestOrganizationsService_UpdateRepositoryRulesetWithRepoProp(t *testing.T) } want := &RepositoryRuleset{ - ID: Ptr(int64(21)), + ID: new(int64(21)), Name: "test ruleset", - Target: Ptr(RulesetTargetBranch), - SourceType: Ptr(RulesetSourceTypeOrganization), + Target: new(RulesetTargetBranch), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: "active", - NodeID: Ptr("nid"), + NodeID: new("nid"), Links: &RepositoryRulesetLinks{ - Self: &RepositoryRulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/21")}, + Self: &RepositoryRulesetLink{HRef: new("https://api.github.com/orgs/o/rulesets/21")}, }, Conditions: &RepositoryRulesetConditions{ RepositoryProperty: &RepositoryRulesetRepositoryPropertyConditionParameters{ Include: []*RepositoryRulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: Ptr("custom"), + Source: new("custom"), PropertyValues: []string{"true"}, }, }, diff --git a/github/orgs_security_managers_test.go b/github/orgs_security_managers_test.go index 7ddce4b2951..9b018237c14 100644 --- a/github/orgs_security_managers_test.go +++ b/github/orgs_security_managers_test.go @@ -28,7 +28,7 @@ func TestOrganizationsService_ListSecurityManagerTeams(t *testing.T) { t.Errorf("Organizations.ListSecurityManagerTeams returned error: %v", err) } - want := []*Team{{ID: Ptr(int64(1))}} + want := []*Team{{ID: new(int64(1))}} if !cmp.Equal(teams, want) { t.Errorf("Organizations.ListSecurityManagerTeams returned %+v, want %+v", teams, want) } diff --git a/github/orgs_test.go b/github/orgs_test.go index 2ea5ecf05ef..61f9c5834e8 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -30,7 +30,7 @@ func TestOrganizationsService_ListAll(t *testing.T) { t.Errorf("Organizations.ListAll returned error: %v", err) } - want := []*Organization{{ID: Ptr(int64(4314092))}} + want := []*Organization{{ID: new(int64(4314092))}} if !cmp.Equal(orgs, want) { t.Errorf("Organizations.ListAll returned %+v, want %+v", orgs, want) } @@ -60,7 +60,7 @@ func TestOrganizationsService_List_authenticatedUser(t *testing.T) { t.Errorf("Organizations.List returned error: %v", err) } - want := []*Organization{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Organization{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(orgs, want) { t.Errorf("Organizations.List returned %+v, want %+v", orgs, want) } @@ -97,7 +97,7 @@ func TestOrganizationsService_List_specifiedUser(t *testing.T) { t.Errorf("Organizations.List returned error: %v", err) } - want := []*Organization{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Organization{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(orgs, want) { t.Errorf("Organizations.List returned %+v, want %+v", orgs, want) } @@ -142,7 +142,7 @@ func TestOrganizationsService_Get(t *testing.T) { t.Errorf("Organizations.Get returned error: %v", err) } - want := &Organization{ID: Ptr(int64(1)), Login: Ptr("l"), URL: Ptr("u"), AvatarURL: Ptr("a"), Location: Ptr("l")} + want := &Organization{ID: new(int64(1)), Login: new("l"), URL: new("u"), AvatarURL: new("a"), Location: new("l")} if !cmp.Equal(org, want) { t.Errorf("Organizations.Get returned %+v, want %+v", org, want) } @@ -186,7 +186,7 @@ func TestOrganizationsService_GetByID(t *testing.T) { t.Fatalf("Organizations.GetByID returned error: %v", err) } - want := &Organization{ID: Ptr(int64(1)), Login: Ptr("l"), URL: Ptr("u"), AvatarURL: Ptr("a"), Location: Ptr("l")} + want := &Organization{ID: new(int64(1)), Login: new("l"), URL: new("u"), AvatarURL: new("a"), Location: new("l")} if !cmp.Equal(org, want) { t.Errorf("Organizations.GetByID returned %+v, want %+v", org, want) } @@ -210,7 +210,7 @@ func TestOrganizationsService_Edit(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Organization{Login: Ptr("l")} + input := &Organization{Login: new("l")} mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) { testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview) @@ -226,7 +226,7 @@ func TestOrganizationsService_Edit(t *testing.T) { t.Errorf("Organizations.Edit returned error: %v", err) } - want := &Organization{ID: Ptr(int64(1))} + want := &Organization{ID: new(int64(1))} if !cmp.Equal(org, want) { t.Errorf("Organizations.Edit returned %+v, want %+v", org, want) } @@ -295,7 +295,7 @@ func TestOrganizationsService_ListInstallations(t *testing.T) { t.Errorf("Organizations.ListInstallations returned error: %v", err) } - want := &OrganizationInstallations{TotalCount: Ptr(1), Installations: []*Installation{{ID: Ptr(int64(1)), AppID: Ptr(int64(5))}}} + want := &OrganizationInstallations{TotalCount: new(1), Installations: []*Installation{{ID: new(int64(1)), AppID: new(int64(5))}}} if !cmp.Equal(apps, want) { t.Errorf("Organizations.ListInstallations returned %+v, want %+v", apps, want) } @@ -340,7 +340,7 @@ func TestOrganizationsService_ListInstallations_withListOptions(t *testing.T) { t.Errorf("Organizations.ListInstallations returned error: %v", err) } - want := &OrganizationInstallations{TotalCount: Ptr(2), Installations: []*Installation{{ID: Ptr(int64(2)), AppID: Ptr(int64(10))}}} + want := &OrganizationInstallations{TotalCount: new(2), Installations: []*Installation{{ID: new(int64(2)), AppID: new(int64(10))}}} if !cmp.Equal(apps, want) { t.Errorf("Organizations.ListInstallations returned %+v, want %+v", apps, want) } diff --git a/github/orgs_users_blocking_test.go b/github/orgs_users_blocking_test.go index 06165219152..1ac5b6491a1 100644 --- a/github/orgs_users_blocking_test.go +++ b/github/orgs_users_blocking_test.go @@ -33,7 +33,7 @@ func TestOrganizationsService_ListBlockedUsers(t *testing.T) { t.Errorf("Organizations.ListBlockedUsers returned error: %v", err) } - want := []*User{{Login: Ptr("octocat")}} + want := []*User{{Login: new("octocat")}} if !cmp.Equal(blockedUsers, want) { t.Errorf("Organizations.ListBlockedUsers returned %+v, want %+v", blockedUsers, want) } diff --git a/github/packages_test.go b/github/packages_test.go index 3a42ba998a4..67488a56960 100644 --- a/github/packages_test.go +++ b/github/packages_test.go @@ -108,10 +108,10 @@ func TestPackageVersion_GetBodyAsPackageVersionBody(t *testing.T) { }, wantValue: &PackageVersionBody{ Repo: &Repository{ - Name: Ptr("n"), + Name: new("n"), }, Info: &PackageVersionBodyInfo{ - Type: Ptr("t"), + Type: new("t"), }, }, wantOk: true, @@ -168,7 +168,7 @@ func TestPackageVersion_GetMetadata(t *testing.T) { }`), }, wantValue: &PackageMetadata{ - PackageType: Ptr("container"), + PackageType: new("container"), Container: &PackageContainerMetadata{ Tags: []string{"a"}, }, diff --git a/github/private_registries_test.go b/github/private_registries_test.go index ec0500ef7dd..be6081051b8 100644 --- a/github/private_registries_test.go +++ b/github/private_registries_test.go @@ -47,15 +47,15 @@ func TestPrivateRegistriesService_ListOrganizationPrivateRegistries(t *testing.T } want := &PrivateRegistries{ - TotalCount: Ptr(1), + TotalCount: new(1), Configurations: []*PrivateRegistry{ { - Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr(PrivateRegistryTypeMavenRepository), - Username: Ptr("monalisa"), + Name: new("MAVEN_REPOSITORY_SECRET"), + RegistryType: new(PrivateRegistryTypeMavenRepository), + Username: new("monalisa"), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Visibility: Ptr(PrivateRegistryVisibilitySelected), + Visibility: new(PrivateRegistryVisibilitySelected), }, }, } @@ -91,9 +91,9 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T input := &CreateOrganizationPrivateRegistry{ RegistryType: PrivateRegistryTypeMavenRepository, URL: "https://example.com/OWNER/REPOSITORY", - Username: Ptr("monalisa"), - EncryptedValue: Ptr("encrypted_value"), - KeyID: Ptr("key_id"), + Username: new("monalisa"), + EncryptedValue: new("encrypted_value"), + KeyID: new("key_id"), Visibility: PrivateRegistryVisibilitySelected, SelectedRepositoryIDs: []int64{1, 2, 3}, } @@ -121,12 +121,12 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry(t *testing.T } want := &PrivateRegistry{ - Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr(PrivateRegistryTypeMavenRepository), - Username: Ptr("monalisa"), + Name: new("MAVEN_REPOSITORY_SECRET"), + RegistryType: new(PrivateRegistryTypeMavenRepository), + Username: new("monalisa"), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Visibility: Ptr(PrivateRegistryVisibilitySelected), + Visibility: new(PrivateRegistryVisibilitySelected), SelectedRepositoryIDs: []int64{1, 2, 3}, } if diff := cmp.Diff(want, privateRegistry); diff != "" { @@ -155,10 +155,10 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDC(t *test input := &CreateOrganizationPrivateRegistry{ RegistryType: PrivateRegistryTypeMavenRepository, URL: "https://example.com/maven", - AuthType: Ptr("oidc_azure"), - TenantID: Ptr("my-tenant-id"), - ClientID: Ptr("my-client-id"), - ReplacesBase: Ptr(true), + AuthType: new("oidc_azure"), + TenantID: new("my-tenant-id"), + ClientID: new("my-client-id"), + ReplacesBase: new(true), Visibility: PrivateRegistryVisibilitySelected, SelectedRepositoryIDs: []int64{1, 2, 3}, } @@ -185,11 +185,11 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDC(t *test } want := &PrivateRegistry{ - Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr(PrivateRegistryTypeMavenRepository), + Name: new("MAVEN_REPOSITORY_SECRET"), + RegistryType: new(PrivateRegistryTypeMavenRepository), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Visibility: Ptr(PrivateRegistryVisibilitySelected), + Visibility: new(PrivateRegistryVisibilitySelected), SelectedRepositoryIDs: []int64{1, 2, 3}, } if diff := cmp.Diff(want, privateRegistry); diff != "" { @@ -202,14 +202,14 @@ func TestPrivateRegistries_UpdateOrganizationPrivateRegistry_OIDC(t *testing.T) client, mux, _ := setup(t) input := &UpdateOrganizationPrivateRegistry{ - AuthType: Ptr("oidc_aws"), - AWSRegion: Ptr("us-east-1"), - AccountID: Ptr("123456789012"), - RoleName: Ptr("my-role"), - Domain: Ptr("my-domain"), - DomainOwner: Ptr("123456789012"), - Audience: Ptr("example.com"), - Visibility: Ptr(PrivateRegistryVisibilitySelected), + AuthType: new("oidc_aws"), + AWSRegion: new("us-east-1"), + AccountID: new("123456789012"), + RoleName: new("my-role"), + Domain: new("my-domain"), + DomainOwner: new("123456789012"), + Audience: new("example.com"), + Visibility: new(PrivateRegistryVisibilitySelected), } mux.HandleFunc("/orgs/o/private-registries/AWS_REGISTRY_SECRET", func(w http.ResponseWriter, r *http.Request) { @@ -233,10 +233,10 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDCJFrog(t input := &CreateOrganizationPrivateRegistry{ RegistryType: PrivateRegistryTypeNpmRegistry, URL: "https://example.com/npm", - AuthType: Ptr("oidc_jfrog"), - JFrogOIDCProviderName: Ptr("my-jfrog-provider"), - Audience: Ptr("jfrog"), - IdentityMappingName: Ptr("my-identity-mapping"), + AuthType: new("oidc_jfrog"), + JFrogOIDCProviderName: new("my-jfrog-provider"), + Audience: new("jfrog"), + IdentityMappingName: new("my-identity-mapping"), Visibility: PrivateRegistryVisibilityPrivate, } @@ -261,11 +261,11 @@ func TestPrivateRegistriesService_CreateOrganizationPrivateRegistry_OIDCJFrog(t } want := &PrivateRegistry{ - Name: Ptr("NPM_REGISTRY_SECRET"), - RegistryType: Ptr(PrivateRegistryTypeNpmRegistry), + Name: new("NPM_REGISTRY_SECRET"), + RegistryType: new(PrivateRegistryTypeNpmRegistry), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Visibility: Ptr(PrivateRegistryVisibilityPrivate), + Visibility: new(PrivateRegistryVisibilityPrivate), } if diff := cmp.Diff(want, privateRegistry); diff != "" { t.Errorf("PrivateRegistries.CreateOrganizationPrivateRegistry (OIDC JFrog) mismatch (-want +got):\\n%v", diff) @@ -291,8 +291,8 @@ func TestPrivateRegistriesService_GetOrganizationPrivateRegistriesPublicKey(t *t } want := &PublicKey{ - KeyID: Ptr("0123456789"), - Key: Ptr("public_key"), + KeyID: new("0123456789"), + Key: new("public_key"), } if diff := cmp.Diff(want, publicKey); diff != "" { t.Errorf("PrivateRegistries.GetOrganizationPrivateRegistriesPublicKey mismatch (-want +got):\\n%v", diff) @@ -336,12 +336,12 @@ func TestPrivateRegistriesService_GetOrganizationPrivateRegistry(t *testing.T) { } want := &PrivateRegistry{ - Name: Ptr("MAVEN_REPOSITORY_SECRET"), - RegistryType: Ptr(PrivateRegistryTypeMavenRepository), - Username: Ptr("monalisa"), + Name: new("MAVEN_REPOSITORY_SECRET"), + RegistryType: new(PrivateRegistryTypeMavenRepository), + Username: new("monalisa"), CreatedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), - Visibility: Ptr(PrivateRegistryVisibilitySelected), + Visibility: new(PrivateRegistryVisibilitySelected), } if diff := cmp.Diff(want, privateRegistry); diff != "" { t.Errorf("PrivateRegistries.GetOrganizationPrivateRegistry mismatch (-want +got):\\n%v", diff) @@ -366,10 +366,10 @@ func TestPrivateRegistries_UpdateOrganizationPrivateRegistry(t *testing.T) { client, mux, _ := setup(t) input := &UpdateOrganizationPrivateRegistry{ - Username: Ptr("monalisa"), - EncryptedValue: Ptr("encrypted_value"), - KeyID: Ptr("key_id"), - Visibility: Ptr(PrivateRegistryVisibilitySelected), + Username: new("monalisa"), + EncryptedValue: new("encrypted_value"), + KeyID: new("key_id"), + Visibility: new(PrivateRegistryVisibilitySelected), } mux.HandleFunc("/orgs/o/private-registries/MAVEN_REPOSITORY_SECRET", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/projects_test.go b/github/projects_test.go index 129fbfe17f5..80b5b96008a 100644 --- a/github/projects_test.go +++ b/github/projects_test.go @@ -599,7 +599,7 @@ func TestProjectsService_AddOrganizationProjectItem(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &AddProjectItemOptions{Type: Ptr(ProjectV2ItemContentType("Issue")), ID: Ptr(int64(99))} + input := &AddProjectItemOptions{Type: new(ProjectV2ItemContentType("Issue")), ID: new(int64(99))} mux.HandleFunc("/orgs/o/projectsV2/1/items", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -628,7 +628,7 @@ func TestProjectsService_AddProjectItemForOrg_error(t *testing.T) { ctx := t.Context() const methodName = "AddOrganizationProjectItem" testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Projects.AddOrganizationProjectItem(ctx, "o", 1, &AddProjectItemOptions{Type: Ptr(ProjectV2ItemContentType("Issue")), ID: Ptr(int64(1))}) + got, resp, err := client.Projects.AddOrganizationProjectItem(ctx, "o", 1, &AddProjectItemOptions{Type: new(ProjectV2ItemContentType("Issue")), ID: new(int64(1))}) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -717,7 +717,7 @@ func TestProjectsService_GetOrganizationProjectItem_WithFieldsOption(t *testing. func TestProjectsService_UpdateOrganizationProjectItem(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &UpdateProjectItemOptions{Archived: Ptr(true)} + input := &UpdateProjectItemOptions{Archived: new(true)} mux.HandleFunc("/orgs/o/projectsV2/1/items/17", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testJSONBody(t, r, input) @@ -736,7 +736,7 @@ func TestProjectsService_UpdateOrganizationProjectItem(t *testing.T) { func TestProjectsService_UpdateOrganizationProjectItem_error(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &UpdateProjectItemOptions{Archived: Ptr(true)} + input := &UpdateProjectItemOptions{Archived: new(true)} mux.HandleFunc("/orgs/o/projectsV2/1/items/17", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testJSONBody(t, r, input) @@ -861,7 +861,7 @@ func TestProjectsService_ListUserProjectItems_error(t *testing.T) { func TestProjectsService_AddUserProjectItem(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &AddProjectItemOptions{Type: Ptr(ProjectV2ItemContentType("PullRequest")), ID: Ptr(int64(123))} + input := &AddProjectItemOptions{Type: new(ProjectV2ItemContentType("PullRequest")), ID: new(int64(123))} mux.HandleFunc("/users/u/projectsV2/2/items", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testJSONBody(t, r, input) @@ -887,7 +887,7 @@ func TestProjectsService_AddUserProjectItem_error(t *testing.T) { ctx := t.Context() const methodName = "AddUserProjectItem" testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Projects.AddUserProjectItem(ctx, "u", 2, &AddProjectItemOptions{Type: Ptr(ProjectV2ItemContentType("Issue")), ID: Ptr(int64(5))}) + got, resp, err := client.Projects.AddUserProjectItem(ctx, "u", 2, &AddProjectItemOptions{Type: new(ProjectV2ItemContentType("Issue")), ID: new(int64(5))}) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -976,7 +976,7 @@ func TestProjectsService_GetUserProjectItem_WithFieldsOption(t *testing.T) { func TestProjectsService_UpdateUserProjectItem(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &UpdateProjectItemOptions{Archived: Ptr(false)} + input := &UpdateProjectItemOptions{Archived: new(false)} mux.HandleFunc("/users/u/projectsV2/2/items/55", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testJSONBody(t, r, input) @@ -1002,7 +1002,7 @@ func TestProjectsService_UpdateUserProjectItem_error(t *testing.T) { ctx := t.Context() const methodName = "UpdateUserProjectItem" testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Projects.UpdateUserProjectItem(ctx, "u", 2, 55, &UpdateProjectItemOptions{Archived: Ptr(false)}) + got, resp, err := client.Projects.UpdateUserProjectItem(ctx, "u", 2, 55, &UpdateProjectItemOptions{Archived: new(false)}) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -1079,19 +1079,19 @@ func TestProjectV2Item_UnmarshalJSON_Issue(t *testing.T) { t.Parallel() item := ProjectV2Item{ - ID: Ptr(int64(123)), - NodeID: Ptr("PVTI_test"), - ContentType: Ptr(ProjectV2ItemContentTypeIssue), + ID: new(int64(123)), + NodeID: new("PVTI_test"), + ContentType: new(ProjectV2ItemContentTypeIssue), Content: &ProjectV2ItemContent{ Issue: &Issue{ - ID: Ptr(int64(456)), - Number: Ptr(10), - Title: Ptr("Test Issue"), - State: Ptr("open"), - Body: Ptr("Issue body"), + ID: new(int64(456)), + Number: new(10), + Title: new("Test Issue"), + State: new("open"), + Body: new("Issue body"), Repository: &Repository{ - ID: Ptr(int64(789)), - Name: Ptr("test-repo"), + ID: new(int64(789)), + Name: new("test-repo"), }, }, }, @@ -1123,24 +1123,24 @@ func TestProjectV2Item_UnmarshalJSON_PullRequest(t *testing.T) { t.Parallel() item := ProjectV2Item{ - ID: Ptr(int64(124)), - NodeID: Ptr("PVTI_pr"), - ContentType: Ptr(ProjectV2ItemContentTypePullRequest), + ID: new(int64(124)), + NodeID: new("PVTI_pr"), + ContentType: new(ProjectV2ItemContentTypePullRequest), Content: &ProjectV2ItemContent{ PullRequest: &PullRequest{ - ID: Ptr(int64(457)), - Number: Ptr(20), - Title: Ptr("Test PR"), - State: Ptr("closed"), - Merged: Ptr(true), - MergeCommitSHA: Ptr("abc123"), + ID: new(int64(457)), + Number: new(20), + Title: new("Test PR"), + State: new("closed"), + Merged: new(true), + MergeCommitSHA: new("abc123"), Head: &PullRequestBranch{ - Ref: Ptr("feature-branch"), - SHA: Ptr("def456"), + Ref: new("feature-branch"), + SHA: new("def456"), }, Base: &PullRequestBranch{ - Ref: Ptr("main"), - SHA: Ptr("ghi789"), + Ref: new("main"), + SHA: new("ghi789"), }, }, }, @@ -1177,15 +1177,15 @@ func TestProjectV2Item_UnmarshalJSON_DraftIssue(t *testing.T) { t.Parallel() item := ProjectV2Item{ - ID: Ptr(int64(125)), - NodeID: Ptr("PVTI_draft"), - ContentType: Ptr(ProjectV2ItemContentTypeDraftIssue), + ID: new(int64(125)), + NodeID: new("PVTI_draft"), + ContentType: new(ProjectV2ItemContentTypeDraftIssue), Content: &ProjectV2ItemContent{ DraftIssue: &ProjectV2DraftIssue{ - ID: Ptr(int64(458)), - NodeID: Ptr("DI_test"), - Title: Ptr("Draft Issue Title"), - Body: Ptr("Draft issue body content"), + ID: new(int64(458)), + NodeID: new("DI_test"), + Title: new("Draft Issue Title"), + Body: new("Draft issue body content"), }, }, CreatedAt: &referenceTimestamp, @@ -1211,9 +1211,9 @@ func TestProjectV2Item_UnmarshalJSON_NullContent(t *testing.T) { t.Parallel() item := ProjectV2Item{ - ID: Ptr(int64(126)), - NodeID: Ptr("PVTI_null"), - ContentType: Ptr(ProjectV2ItemContentTypeIssue), + ID: new(int64(126)), + NodeID: new("PVTI_null"), + ContentType: new(ProjectV2ItemContentTypeIssue), Content: nil, // Content is null } @@ -1240,8 +1240,8 @@ func TestProjectV2Item_UnmarshalJSON_MissingContentType(t *testing.T) { }` item := ProjectV2Item{ - ID: Ptr(int64(127)), - NodeID: Ptr("PVTI_no_type"), + ID: new(int64(127)), + NodeID: new("PVTI_no_type"), Content: nil, } @@ -1271,15 +1271,15 @@ func TestProjectV2Item_Marshal_Issue(t *testing.T) { testJSONMarshal(t, &ProjectV2Item{}, "{}") item := &ProjectV2Item{ - ContentType: Ptr(ProjectV2ItemContentTypeIssue), + ContentType: new(ProjectV2ItemContentTypeIssue), Content: &ProjectV2ItemContent{ Issue: &Issue{ - Number: Ptr(42), - Title: Ptr("Bug report"), - State: Ptr("open"), + Number: new(42), + Title: new("Bug report"), + State: new("open"), }, }, - ID: Ptr(int64(123)), + ID: new(int64(123)), } want := `{ @@ -1300,15 +1300,15 @@ func TestProjectV2Item_Marshal_PullRequest(t *testing.T) { testJSONMarshal(t, ProjectV2Item{}, "{}") item := ProjectV2Item{ - ContentType: Ptr(ProjectV2ItemContentTypePullRequest), + ContentType: new(ProjectV2ItemContentTypePullRequest), Content: &ProjectV2ItemContent{ PullRequest: &PullRequest{ - Number: Ptr(99), - Title: Ptr("Feature addition"), - State: Ptr("closed"), + Number: new(99), + Title: new("Feature addition"), + State: new("closed"), }, }, - ID: Ptr(int64(456)), + ID: new(int64(456)), } want := `{ @@ -1329,14 +1329,14 @@ func TestProjectV2Item_Marshal_DraftIssue(t *testing.T) { testJSONMarshal(t, &ProjectV2Item{}, "{}") item := &ProjectV2Item{ - ContentType: Ptr(ProjectV2ItemContentTypeDraftIssue), + ContentType: new(ProjectV2ItemContentTypeDraftIssue), Content: &ProjectV2ItemContent{ DraftIssue: &ProjectV2DraftIssue{ - Title: Ptr("Draft task"), - Body: Ptr("Work in progress"), + Title: new("Draft task"), + Body: new("Work in progress"), }, }, - ID: Ptr(int64(789)), + ID: new(int64(789)), } want := `{ @@ -1355,9 +1355,9 @@ func TestProjectV2Item_Marshal_MissingContent(t *testing.T) { t.Parallel() item := &ProjectV2Item{ - ContentType: Ptr(ProjectV2ItemContentTypeIssue), + ContentType: new(ProjectV2ItemContentTypeIssue), Content: &ProjectV2ItemContent{}, - ID: Ptr(int64(789)), + ID: new(int64(789)), } want := `{ @@ -1377,9 +1377,9 @@ func TestProjectV2ItemContent_Marshal(t *testing.T) { content := ProjectV2ItemContent{ Issue: &Issue{ - Number: Ptr(42), - Title: Ptr("Bug report"), - State: Ptr("open"), + Number: new(42), + Title: new("Bug report"), + State: new("open"), }, } @@ -1398,9 +1398,9 @@ func TestProjectV2ItemContent_Marshal(t *testing.T) { content := ProjectV2ItemContent{ PullRequest: &PullRequest{ - Number: Ptr(99), - Title: Ptr("Feature addition"), - State: Ptr("closed"), + Number: new(99), + Title: new("Feature addition"), + State: new("closed"), }, } @@ -1419,8 +1419,8 @@ func TestProjectV2ItemContent_Marshal(t *testing.T) { content := ProjectV2ItemContent{ DraftIssue: &ProjectV2DraftIssue{ - Title: Ptr("Draft task"), - Body: Ptr("Work in progress"), + Title: new("Draft task"), + Body: new("Work in progress"), }, } @@ -1438,7 +1438,7 @@ func TestProjectsService_CreateOrganizationProjectDraftItem(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := CreateProjectV2DraftItemRequest{Title: "My draft", Body: Ptr("Draft body")} + input := CreateProjectV2DraftItemRequest{Title: "My draft", Body: new("Draft body")} mux.HandleFunc("/orgs/o/projectsV2/1/drafts", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -1451,7 +1451,7 @@ func TestProjectsService_CreateOrganizationProjectDraftItem(t *testing.T) { if err != nil { t.Fatalf("Projects.CreateOrganizationProjectDraftItem returned error: %v", err) } - want := &ProjectV2Item{ID: Ptr(int64(42)), NodeID: Ptr("PVTI_draft"), ContentType: Ptr(ProjectV2ItemContentTypeDraftIssue)} + want := &ProjectV2Item{ID: new(int64(42)), NodeID: new("PVTI_draft"), ContentType: new(ProjectV2ItemContentTypeDraftIssue)} if diff := cmp.Diff(want, item); diff != "" { t.Errorf("Projects.CreateOrganizationProjectDraftItem mismatch (-want +got):\n%v", diff) } @@ -1487,7 +1487,7 @@ func TestProjectsService_CreateUserProjectDraftItem(t *testing.T) { if err != nil { t.Fatalf("Projects.CreateUserProjectDraftItem returned error: %v", err) } - want := &ProjectV2Item{ID: Ptr(int64(43)), NodeID: Ptr("PVTI_draft_u"), ContentType: Ptr(ProjectV2ItemContentTypeDraftIssue)} + want := &ProjectV2Item{ID: new(int64(43)), NodeID: new("PVTI_draft_u"), ContentType: new(ProjectV2ItemContentTypeDraftIssue)} if diff := cmp.Diff(want, item); diff != "" { t.Errorf("Projects.CreateUserProjectDraftItem mismatch (-want +got):\n%v", diff) } @@ -1507,11 +1507,11 @@ func TestProjectsService_AddOrganizationProjectField(t *testing.T) { client, mux, _ := setup(t) input := AddProjectV2FieldRequest{ - Name: Ptr("Priority"), - DataType: Ptr("single_select"), + Name: new("Priority"), + DataType: new("single_select"), SingleSelectOptions: []*ProjectV2FieldSingleSelectOption{ - {Name: "High", Color: Ptr("RED"), Description: Ptr("Urgent")}, - {Name: "Low", Color: Ptr("GRAY")}, + {Name: "High", Color: new("RED"), Description: new("Urgent")}, + {Name: "Low", Color: new("GRAY")}, }, } @@ -1526,7 +1526,7 @@ func TestProjectsService_AddOrganizationProjectField(t *testing.T) { if err != nil { t.Fatalf("Projects.AddOrganizationProjectField returned error: %v", err) } - want := &ProjectV2Field{ID: Ptr(int64(7)), Name: Ptr("Priority"), DataType: Ptr("single_select")} + want := &ProjectV2Field{ID: new(int64(7)), Name: new("Priority"), DataType: new("single_select")} if diff := cmp.Diff(want, field); diff != "" { t.Errorf("Projects.AddOrganizationProjectField mismatch (-want +got):\n%v", diff) } @@ -1550,13 +1550,13 @@ func TestProjectsService_AddUserProjectField(t *testing.T) { client, mux, _ := setup(t) input := AddProjectV2FieldRequest{ - Name: Ptr("Sprint"), - DataType: Ptr("iteration"), + Name: new("Sprint"), + DataType: new("iteration"), IterationConfiguration: &ProjectV2FieldIterationConfiguration{ - StartDate: Ptr("2026-01-01"), - Duration: Ptr(14), + StartDate: new("2026-01-01"), + Duration: new(14), Iterations: []*ProjectV2FieldIterationConfigurationIteration{ - {Title: Ptr("Sprint 1"), StartDate: Ptr("2026-01-01"), Duration: Ptr(14)}, + {Title: new("Sprint 1"), StartDate: new("2026-01-01"), Duration: new(14)}, }, }, } @@ -1572,7 +1572,7 @@ func TestProjectsService_AddUserProjectField(t *testing.T) { if err != nil { t.Fatalf("Projects.AddUserProjectField returned error: %v", err) } - want := &ProjectV2Field{ID: Ptr(int64(8)), Name: Ptr("Sprint"), DataType: Ptr("iteration")} + want := &ProjectV2Field{ID: new(int64(8)), Name: new("Sprint"), DataType: new("iteration")} if diff := cmp.Diff(want, field); diff != "" { t.Errorf("Projects.AddUserProjectField mismatch (-want +got):\n%v", diff) } @@ -1598,7 +1598,7 @@ func TestProjectsService_CreateOrganizationProjectView(t *testing.T) { input := CreateProjectV2ViewRequest{ Name: "My board", Layout: "board", - Filter: Ptr("is:open"), + Filter: new("is:open"), VisibleFields: []int64{1, 2, 3}, } @@ -1621,8 +1621,8 @@ func TestProjectsService_CreateOrganizationProjectView(t *testing.T) { Name: "My board", Layout: "board", SortBy: []*ProjectV2ViewSortBy{ - {FieldID: Ptr(int64(9007199254740993)), Direction: Ptr("asc")}, - {FieldID: Ptr(int64(456)), Direction: Ptr("desc")}, + {FieldID: new(int64(9007199254740993)), Direction: new("asc")}, + {FieldID: new(int64(456)), Direction: new("desc")}, }, } if diff := cmp.Diff(want, view); diff != "" { @@ -1691,7 +1691,7 @@ func TestProjectsService_ListOrganizationProjectViewItems(t *testing.T) { if err != nil { t.Fatalf("Projects.ListOrganizationProjectViewItems returned error: %v", err) } - want := []*ProjectV2Item{{ID: Ptr(int64(21)), NodeID: Ptr("PVTI_view_item")}} + want := []*ProjectV2Item{{ID: new(int64(21)), NodeID: new("PVTI_view_item")}} if diff := cmp.Diff(want, items); diff != "" { t.Errorf("Projects.ListOrganizationProjectViewItems mismatch (-want +got):\n%v", diff) } @@ -1726,7 +1726,7 @@ func TestProjectsService_ListUserProjectViewItems(t *testing.T) { if err != nil { t.Fatalf("Projects.ListUserProjectViewItems returned error: %v", err) } - want := []*ProjectV2Item{{ID: Ptr(int64(22)), NodeID: Ptr("PVTI_view_item_u")}} + want := []*ProjectV2Item{{ID: new(int64(22)), NodeID: new("PVTI_view_item_u")}} if diff := cmp.Diff(want, items); diff != "" { t.Errorf("Projects.ListUserProjectViewItems mismatch (-want +got):\n%v", diff) } @@ -1753,8 +1753,8 @@ func TestProjectV2ViewSortBy_UnmarshalJSON(t *testing.T) { // The second element uses a string field_id, which the OpenAPI schema // permits. The first exceeds 2^53 to confirm int64 (not float64) decoding. want := []*ProjectV2ViewSortBy{ - {FieldID: Ptr(int64(9007199254740993)), Direction: Ptr("asc")}, - {FieldID: Ptr(int64(456)), Direction: Ptr("desc")}, + {FieldID: new(int64(9007199254740993)), Direction: new("asc")}, + {FieldID: new(int64(456)), Direction: new("desc")}, } testJSONUnmarshalOnly(t, want, `[[9007199254740993,"asc"],["456","desc"]]`) }) @@ -1801,7 +1801,7 @@ func TestProjectV2ViewSortBy_UnmarshalJSON(t *testing.T) { t.Run("round trips through MarshalJSON", func(t *testing.T) { t.Parallel() - in := &ProjectV2ViewSortBy{FieldID: Ptr(int64(9007199254740993)), Direction: Ptr("asc")} + in := &ProjectV2ViewSortBy{FieldID: new(int64(9007199254740993)), Direction: new("asc")} testJSONMarshal(t, in, `[9007199254740993,"asc"]`) }) } diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go index 1171b6bf2d7..a8d18ebf590 100644 --- a/github/pulls_comments_test.go +++ b/github/pulls_comments_test.go @@ -43,7 +43,7 @@ func TestPullRequestsService_ListComments_allPulls(t *testing.T) { t.Errorf("PullRequests.ListComments returned error: %v", err) } - want := []*PullRequestComment{{ID: Ptr(int64(1))}} + want := []*PullRequestComment{{ID: new(int64(1))}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want) } @@ -80,7 +80,7 @@ func TestPullRequestsService_ListComments_specificPull(t *testing.T) { t.Errorf("PullRequests.ListComments returned error: %v", err) } - want := []*PullRequestComment{{ID: Ptr(int64(1)), PullRequestReviewID: Ptr(int64(42))}} + want := []*PullRequestComment{{ID: new(int64(1)), PullRequestReviewID: new(int64(42))}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want) } @@ -112,7 +112,7 @@ func TestPullRequestsService_GetComment(t *testing.T) { t.Errorf("PullRequests.GetComment returned error: %v", err) } - want := &PullRequestComment{ID: Ptr(int64(1))} + want := &PullRequestComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("PullRequests.GetComment returned %+v, want %+v", comment, want) } @@ -145,7 +145,7 @@ func TestPullRequestsService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &PullRequestComment{Body: Ptr("b")} + input := &PullRequestComment{Body: new("b")} wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { @@ -161,7 +161,7 @@ func TestPullRequestsService_CreateComment(t *testing.T) { t.Errorf("PullRequests.CreateComment returned error: %v", err) } - want := &PullRequestComment{ID: Ptr(int64(1))} + want := &PullRequestComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("PullRequests.CreateComment returned %+v, want %+v", comment, want) } @@ -194,7 +194,7 @@ func TestPullRequestsService_CreateCommentInReplyTo(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &PullRequestComment{Body: Ptr("b")} + input := &PullRequestComment{Body: new("b")} mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -208,7 +208,7 @@ func TestPullRequestsService_CreateCommentInReplyTo(t *testing.T) { t.Errorf("PullRequests.CreateCommentInReplyTo returned error: %v", err) } - want := &PullRequestComment{ID: Ptr(int64(1))} + want := &PullRequestComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("PullRequests.CreateCommentInReplyTo returned %+v, want %+v", comment, want) } @@ -232,7 +232,7 @@ func TestPullRequestsService_EditComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &PullRequestComment{Body: Ptr("b")} + input := &PullRequestComment{Body: new("b")} mux.HandleFunc("/repos/o/r/pulls/comments/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -246,7 +246,7 @@ func TestPullRequestsService_EditComment(t *testing.T) { t.Errorf("PullRequests.EditComment returned error: %v", err) } - want := &PullRequestComment{ID: Ptr(int64(1))} + want := &PullRequestComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("PullRequests.EditComment returned %+v, want %+v", comment, want) } diff --git a/github/pulls_reviewers_test.go b/github/pulls_reviewers_test.go index 8feaefd309c..23f05a4acca 100644 --- a/github/pulls_reviewers_test.go +++ b/github/pulls_reviewers_test.go @@ -31,7 +31,7 @@ func TestRequestReviewers(t *testing.T) { if err != nil { t.Errorf("PullRequests.RequestReviewers returned error: %v", err) } - want := &PullRequest{Number: Ptr(1)} + want := &PullRequest{Number: new(1)} if !cmp.Equal(got, want) { t.Errorf("PullRequests.RequestReviewers returned %+v, want %+v", got, want) } @@ -115,14 +115,14 @@ func TestListReviewers(t *testing.T) { want := &Reviewers{ Users: []*User{ { - Login: Ptr("octocat"), - ID: Ptr(int64(1)), + Login: new("octocat"), + ID: new(int64(1)), }, }, Teams: []*Team{ { - ID: Ptr(int64(1)), - Name: Ptr("Justice League"), + ID: new(int64(1)), + Name: new("Justice League"), }, }, } diff --git a/github/pulls_reviews_test.go b/github/pulls_reviews_test.go index 8133bc5ca14..439d7f0f41b 100644 --- a/github/pulls_reviews_test.go +++ b/github/pulls_reviews_test.go @@ -34,8 +34,8 @@ func TestPullRequestsService_ListReviews(t *testing.T) { } want := []*PullRequestReview{ - {ID: Ptr(int64(1))}, - {ID: Ptr(int64(2))}, + {ID: new(int64(1))}, + {ID: new(int64(2))}, } if !cmp.Equal(reviews, want) { t.Errorf("PullRequests.ListReviews returned %+v, want %+v", reviews, want) @@ -80,7 +80,7 @@ func TestPullRequestsService_GetReview(t *testing.T) { t.Errorf("PullRequests.GetReview returned error: %v", err) } - want := &PullRequestReview{ID: Ptr(int64(1))} + want := &PullRequestReview{ID: new(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.GetReview returned %+v, want %+v", review, want) } @@ -124,7 +124,7 @@ func TestPullRequestsService_DeletePendingReview(t *testing.T) { t.Errorf("PullRequests.DeletePendingReview returned error: %v", err) } - want := &PullRequestReview{ID: Ptr(int64(1))} + want := &PullRequestReview{ID: new(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.DeletePendingReview returned %+v, want %+v", review, want) } @@ -169,8 +169,8 @@ func TestPullRequestsService_ListReviewComments(t *testing.T) { } want := []*PullRequestComment{ - {ID: Ptr(int64(1))}, - {ID: Ptr(int64(2))}, + {ID: new(int64(1))}, + {ID: new(int64(2))}, } if !cmp.Equal(comments, want) { t.Errorf("PullRequests.ListReviewComments returned %+v, want %+v", comments, want) @@ -359,9 +359,9 @@ func TestPullRequestsService_CreateReview(t *testing.T) { client, mux, _ := setup(t) input := &PullRequestReviewRequest{ - CommitID: Ptr("commit_id"), - Body: Ptr("b"), - Event: Ptr("APPROVE"), + CommitID: new("commit_id"), + Body: new("b"), + Event: new("APPROVE"), } mux.HandleFunc("/repos/o/r/pulls/1/reviews", func(w http.ResponseWriter, r *http.Request) { @@ -376,7 +376,7 @@ func TestPullRequestsService_CreateReview(t *testing.T) { t.Errorf("PullRequests.CreateReview returned error: %v", err) } - want := &PullRequestReview{ID: Ptr(int64(1))} + want := &PullRequestReview{ID: new(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.CreateReview returned %+v, want %+v", review, want) } @@ -417,12 +417,12 @@ func TestPullRequestsService_CreateReview_badReview(t *testing.T) { Comments: []*DraftReviewComment{{ Path: &path, Body: &body, - Side: Ptr("RIGHT"), - Line: Ptr(11), + Side: new("RIGHT"), + Line: new(11), }, { Path: &path, Body: &body, - Position: Ptr(1), + Position: new(1), }}, } @@ -488,7 +488,7 @@ func TestPullRequestsService_UpdateReview(t *testing.T) { t.Errorf("PullRequests.UpdateReview returned error: %v", err) } - want := &PullRequestReview{ID: Ptr(int64(1))} + want := &PullRequestReview{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("PullRequests.UpdateReview = %+v, want %+v", got, want) } @@ -513,7 +513,7 @@ func TestPullRequestsService_SubmitReview(t *testing.T) { client, mux, _ := setup(t) input := PullRequestSubmitReviewRequest{ - Body: Ptr("b"), + Body: new("b"), Event: "APPROVE", } @@ -529,7 +529,7 @@ func TestPullRequestsService_SubmitReview(t *testing.T) { t.Errorf("PullRequests.SubmitReview returned error: %v", err) } - want := &PullRequestReview{ID: Ptr(int64(1))} + want := &PullRequestReview{ID: new(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.SubmitReview returned %+v, want %+v", review, want) } @@ -562,7 +562,7 @@ func TestPullRequestsService_DismissReview(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := PullRequestDismissReviewRequest{Message: "m", Event: Ptr("DISMISS")} + input := PullRequestDismissReviewRequest{Message: "m", Event: new("DISMISS")} mux.HandleFunc("/repos/o/r/pulls/1/reviews/1/dismissals", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -576,7 +576,7 @@ func TestPullRequestsService_DismissReview(t *testing.T) { t.Errorf("PullRequests.DismissReview returned error: %v", err) } - want := &PullRequestReview{ID: Ptr(int64(1))} + want := &PullRequestReview{ID: new(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.DismissReview returned %+v, want %+v", review, want) } diff --git a/github/pulls_test.go b/github/pulls_test.go index 926e0d17866..824eff8ac61 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -39,7 +39,7 @@ func TestPullRequestsService_List(t *testing.T) { t.Errorf("PullRequests.List returned error: %v", err) } - want := []*PullRequest{{Number: Ptr(1)}} + want := []*PullRequest{{Number: new(1)}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.List returned %+v, want %+v", pulls, want) } @@ -79,7 +79,7 @@ func TestPullRequestsService_ListPullRequestsWithCommit(t *testing.T) { t.Errorf("PullRequests.ListPullRequestsWithCommit returned error: %v", err) } - want := []*PullRequest{{Number: Ptr(1)}} + want := []*PullRequest{{Number: new(1)}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.ListPullRequestsWithCommit returned %+v, want %+v", pulls, want) } @@ -123,7 +123,7 @@ func TestPullRequestsService_Get(t *testing.T) { t.Errorf("PullRequests.Get returned error: %v", err) } - want := &PullRequest{Number: Ptr(1)} + want := &PullRequest{Number: new(1)} if !cmp.Equal(pull, want) { t.Errorf("PullRequests.Get returned %+v, want %+v", pull, want) } @@ -245,24 +245,24 @@ func TestPullRequestsService_Get_links(t *testing.T) { } want := &PullRequest{ - Number: Ptr(1), + Number: new(1), Links: &PRLinks{ Self: &PRLink{ - HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347"), + HRef: new("https://api.github.com/repos/octocat/Hello-World/pulls/1347"), }, HTML: &PRLink{ - HRef: Ptr("https://github.com/octocat/Hello-World/pull/1347"), + HRef: new("https://github.com/octocat/Hello-World/pull/1347"), }, Issue: &PRLink{ - HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/issues/1347"), + HRef: new("https://api.github.com/repos/octocat/Hello-World/issues/1347"), }, Comments: &PRLink{ - HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"), + HRef: new("https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"), }, ReviewComments: &PRLink{ - HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"), + HRef: new("https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"), }, ReviewComment: &PRLink{ - HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"), + HRef: new("https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"), }, Commits: &PRLink{ - HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"), + HRef: new("https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"), }, Statuses: &PRLink{ - HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"), + HRef: new("https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"), }, }, } @@ -287,14 +287,14 @@ func TestPullRequestsService_Get_headAndBase(t *testing.T) { } want := &PullRequest{ - Number: Ptr(1), + Number: new(1), Head: &PullRequestBranch{ - Ref: Ptr("r2"), - Repo: &Repository{ID: Ptr(int64(2))}, + Ref: new("r2"), + Repo: &Repository{ID: new(int64(2))}, }, Base: &PullRequestBranch{ - Ref: Ptr("r1"), - Repo: &Repository{ID: Ptr(int64(1))}, + Ref: new("r1"), + Repo: &Repository{ID: new(int64(1))}, }, } if !cmp.Equal(pull, want) { @@ -326,15 +326,15 @@ func TestPullRequestsService_Get_urlFields(t *testing.T) { } want := &PullRequest{ - Number: Ptr(1), - URL: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/pull/1347"), - IssueURL: Ptr("https://api.github.com/repos/octocat/Hello-World/issues/1347"), - StatusesURL: Ptr("https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"), - DiffURL: Ptr("https://github.com/octocat/Hello-World/pull/1347.diff"), - PatchURL: Ptr("https://github.com/octocat/Hello-World/pull/1347.patch"), - ReviewCommentsURL: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"), - ReviewCommentURL: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"), + Number: new(1), + URL: new("https://api.github.com/repos/octocat/Hello-World/pulls/1347"), + HTMLURL: new("https://github.com/octocat/Hello-World/pull/1347"), + IssueURL: new("https://api.github.com/repos/octocat/Hello-World/issues/1347"), + StatusesURL: new("https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"), + DiffURL: new("https://github.com/octocat/Hello-World/pull/1347.diff"), + PatchURL: new("https://github.com/octocat/Hello-World/pull/1347.patch"), + ReviewCommentsURL: new("https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"), + ReviewCommentURL: new("https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"), } if !cmp.Equal(pull, want) { @@ -355,7 +355,7 @@ func TestPullRequestsService_Create(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := CreatePullRequest{Title: Ptr("t")} + input := CreatePullRequest{Title: new("t")} mux.HandleFunc("/repos/o/r/pulls", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -370,7 +370,7 @@ func TestPullRequestsService_Create(t *testing.T) { t.Errorf("PullRequests.Create returned error: %v", err) } - want := &PullRequest{Number: Ptr(1)} + want := &PullRequest{Number: new(1)} if !cmp.Equal(pull, want) { t.Errorf("PullRequests.Create returned %+v, want %+v", pull, want) } @@ -414,7 +414,7 @@ func TestPullRequestsService_UpdateBranch(t *testing.T) { }) opts := &PullRequestBranchUpdateOptions{ - ExpectedHeadSHA: Ptr("s"), + ExpectedHeadSHA: new("s"), } ctx := t.Context() @@ -424,8 +424,8 @@ func TestPullRequestsService_UpdateBranch(t *testing.T) { } want := &PullRequestBranchUpdateResponse{ - Message: Ptr("Updating pull request branch."), - URL: Ptr("https://github.com/repos/o/r/pulls/1"), + Message: new("Updating pull request branch."), + URL: new("https://github.com/repos/o/r/pulls/1"), } if !cmp.Equal(pull, want) { @@ -458,23 +458,23 @@ func TestPullRequestsService_Edit(t *testing.T) { wantUpdate *pullRequestUpdate }{ { - input: &PullRequest{Title: Ptr("t")}, + input: &PullRequest{Title: new("t")}, sendResponse: `{"number":1}`, - want: &PullRequest{Number: Ptr(1)}, + want: &PullRequest{Number: new(1)}, wantUpdate: &pullRequestUpdate{ - Title: Ptr("t"), + Title: new("t"), }, }, { // base update - input: &PullRequest{Base: &PullRequestBranch{Ref: Ptr("master")}}, + input: &PullRequest{Base: &PullRequestBranch{Ref: new("master")}}, sendResponse: `{"number":1,"base":{"ref":"master"}}`, want: &PullRequest{ - Number: Ptr(1), - Base: &PullRequestBranch{Ref: Ptr("master")}, + Number: new(1), + Base: &PullRequestBranch{Ref: new("master")}, }, wantUpdate: &pullRequestUpdate{ - Base: Ptr("master"), + Base: new("master"), }, }, } @@ -564,18 +564,18 @@ func TestPullRequestsService_ListCommits(t *testing.T) { want := []*RepositoryCommit{ { - SHA: Ptr("3"), + SHA: new("3"), Parents: []*Commit{ { - SHA: Ptr("2"), + SHA: new("2"), }, }, }, { - SHA: Ptr("2"), + SHA: new("2"), Parents: []*Commit{ { - SHA: Ptr("1"), + SHA: new("1"), }, }, }, @@ -638,22 +638,22 @@ func TestPullRequestsService_ListFiles(t *testing.T) { want := []*CommitFile{ { - SHA: Ptr("6dcb09b5b57875f334f61aebed695e2e4193db5e"), - Filename: Ptr("file1.txt"), - Additions: Ptr(103), - Deletions: Ptr(21), - Changes: Ptr(124), - Status: Ptr("added"), - Patch: Ptr("@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"), + SHA: new("6dcb09b5b57875f334f61aebed695e2e4193db5e"), + Filename: new("file1.txt"), + Additions: new(103), + Deletions: new(21), + Changes: new(124), + Status: new("added"), + Patch: new("@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"), }, { - SHA: Ptr("f61aebed695e2e4193db5e6dcb09b5b57875f334"), - Filename: Ptr("file2.txt"), - Additions: Ptr(5), - Deletions: Ptr(3), - Changes: Ptr(103), - Status: Ptr("modified"), - Patch: Ptr("@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"), + SHA: new("f61aebed695e2e4193db5e6dcb09b5b57875f334"), + Filename: new("file2.txt"), + Additions: new(5), + Deletions: new(3), + Changes: new(103), + Status: new("modified"), + Patch: new("@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"), }, } @@ -733,9 +733,9 @@ func TestPullRequestsService_Merge(t *testing.T) { } want := &PullRequestMergeResult{ - SHA: Ptr("6dcb09b5b57875f334f61aebed695e2e4193db5e"), - Merged: Ptr(true), - Message: Ptr("Pull Request successfully merged"), + SHA: new("6dcb09b5b57875f334f61aebed695e2e4193db5e"), + Merged: new(true), + Message: new("Pull Request successfully merged"), } if !cmp.Equal(merge, want) { t.Errorf("PullRequests.Merge returned %+v, want %+v", merge, want) @@ -768,26 +768,26 @@ func TestPullRequestsService_Merge_options(t *testing.T) { { options: nil, want: pullRequestMergeRequest{ - CommitMessage: Ptr("merging pull request"), + CommitMessage: new("merging pull request"), }, }, { options: &PullRequestOptions{}, want: pullRequestMergeRequest{ - CommitMessage: Ptr("merging pull request"), + CommitMessage: new("merging pull request"), }, }, { options: &PullRequestOptions{MergeMethod: "rebase"}, want: pullRequestMergeRequest{ - CommitMessage: Ptr("merging pull request"), + CommitMessage: new("merging pull request"), MergeMethod: "rebase", }, }, { options: &PullRequestOptions{SHA: "6dcb09b5b57875f334f61aebed695e2e4193db5e"}, want: pullRequestMergeRequest{ - CommitMessage: Ptr("merging pull request"), + CommitMessage: new("merging pull request"), SHA: "6dcb09b5b57875f334f61aebed695e2e4193db5e", }, }, @@ -798,7 +798,7 @@ func TestPullRequestsService_Merge_options(t *testing.T) { MergeMethod: "squash", }, want: pullRequestMergeRequest{ - CommitMessage: Ptr("merging pull request"), + CommitMessage: new("merging pull request"), SHA: "6dcb09b5b57875f334f61aebed695e2e4193db5e", CommitTitle: "Extra detail", MergeMethod: "squash", @@ -809,7 +809,7 @@ func TestPullRequestsService_Merge_options(t *testing.T) { DontDefaultIfBlank: true, }, want: pullRequestMergeRequest{ - CommitMessage: Ptr("merging pull request"), + CommitMessage: new("merging pull request"), }, }, } @@ -852,7 +852,7 @@ func TestPullRequestsService_Merge_Blank_Message(t *testing.T) { DontDefaultIfBlank: true, } want = &pullRequestMergeRequest{ - CommitMessage: Ptr(""), + CommitMessage: new(""), } _, _, _ = client.PullRequests.Merge(ctx, "o", "r", 1, "", &opts) if !madeRequest { diff --git a/github/reactions_test.go b/github/reactions_test.go index cd3a32b8d35..15f7fea9b21 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -31,7 +31,7 @@ func TestReactionsService_ListCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} + want := []*Reaction{{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")}} if !cmp.Equal(reactions, want) { t.Errorf("ListCommentReactions = %+v, want %+v", reactions, want) } @@ -68,7 +68,7 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateCommentReaction returned error: %v", err) } - want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} + want := &Reaction{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateCommentReaction = %+v, want %+v", got, want) } @@ -107,7 +107,7 @@ func TestReactionsService_ListIssueReactions(t *testing.T) { if err != nil { t.Errorf("ListIssueReactions returned error: %v", err) } - want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} + want := []*Reaction{{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListIssueReactions = %+v, want %+v", got, want) } @@ -151,7 +151,7 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) { if err != nil { t.Errorf("CreateIssueReaction returned error: %v", err) } - want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} + want := &Reaction{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateIssueReaction = %+v, want %+v", got, want) } @@ -190,7 +190,7 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListIssueCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} + want := []*Reaction{{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListIssueCommentReactions = %+v, want %+v", got, want) } @@ -234,7 +234,7 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateIssueCommentReaction returned error: %v", err) } - want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} + want := &Reaction{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateIssueCommentReaction = %+v, want %+v", got, want) } @@ -273,7 +273,7 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListPullRequestCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} + want := []*Reaction{{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListPullRequestCommentReactions = %+v, want %+v", got, want) } @@ -317,7 +317,7 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreatePullRequestCommentReaction returned error: %v", err) } - want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} + want := &Reaction{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")} if !cmp.Equal(got, want) { t.Errorf("CreatePullRequestCommentReaction = %+v, want %+v", got, want) } @@ -356,7 +356,7 @@ func TestReactionsService_ListTeamDiscussionReactions(t *testing.T) { if err != nil { t.Errorf("ListTeamDiscussionReactions returned error: %v", err) } - want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} + want := []*Reaction{{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListTeamDiscussionReactions = %+v, want %+v", got, want) } @@ -400,7 +400,7 @@ func TestReactionsService_CreateTeamDiscussionReaction(t *testing.T) { if err != nil { t.Errorf("CreateTeamDiscussionReaction returned error: %v", err) } - want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} + want := &Reaction{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateTeamDiscussionReaction = %+v, want %+v", got, want) } @@ -439,7 +439,7 @@ func TestReactionService_ListTeamDiscussionCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListTeamDiscussionCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} + want := []*Reaction{{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListTeamDiscussionCommentReactions = %+v, want %+v", got, want) } @@ -483,7 +483,7 @@ func TestReactionService_CreateTeamDiscussionCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateTeamDiscussionCommentReaction returned error: %v", err) } - want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} + want := &Reaction{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateTeamDiscussionCommentReaction = %+v, want %+v", got, want) } @@ -846,7 +846,7 @@ func TestReactionService_CreateReleaseReaction(t *testing.T) { t.Errorf("%v returned error: %v", methodName, err) } - want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("rocket")} + want := &Reaction{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("rocket")} if !cmp.Equal(got, want) { t.Errorf("%v = %+v, want %+v", methodName, got, want) } @@ -884,7 +884,7 @@ func TestReactionsService_ListReleaseReactions(t *testing.T) { if err != nil { t.Errorf("ListReleaseReactions returned error: %v", err) } - want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} + want := []*Reaction{{ID: new(int64(1)), User: &User{Login: new("l"), ID: new(int64(2))}, Content: new("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListReleaseReactions = %+v, want %+v", got, want) } diff --git a/github/repos_actions_access_test.go b/github/repos_actions_access_test.go index 7f35de5188f..63c408d711f 100644 --- a/github/repos_actions_access_test.go +++ b/github/repos_actions_access_test.go @@ -27,7 +27,7 @@ func TestRepositoriesService_GetActionsAccessLevel(t *testing.T) { if err != nil { t.Errorf("Repositories.GetActionsAccessLevel returned error: %v", err) } - want := &RepositoryActionsAccessLevel{AccessLevel: Ptr("none")} + want := &RepositoryActionsAccessLevel{AccessLevel: new("none")} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetActionsAccessLevel returned %+v, want %+v", org, want) } @@ -51,7 +51,7 @@ func TestRepositoriesService_EditActionsAccessLevel(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &RepositoryActionsAccessLevel{AccessLevel: Ptr("organization")} + input := &RepositoryActionsAccessLevel{AccessLevel: new("organization")} mux.HandleFunc("/repos/o/r/actions/permissions/access", func(_ http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") diff --git a/github/repos_actions_allowed_test.go b/github/repos_actions_allowed_test.go index 0882ea95335..76484211e6a 100644 --- a/github/repos_actions_allowed_test.go +++ b/github/repos_actions_allowed_test.go @@ -27,7 +27,7 @@ func TestRepositoryService_GetActionsAllowed(t *testing.T) { if err != nil { t.Errorf("Repositories.GetActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetActionsAllowed returned %+v, want %+v", org, want) } @@ -51,7 +51,7 @@ func TestRepositoriesService_EditActionsAllowed(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/repos/o/r/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -65,7 +65,7 @@ func TestRepositoriesService_EditActionsAllowed(t *testing.T) { t.Errorf("Repositories.EditActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Repositories.EditActionsAllowed returned %+v, want %+v", org, want) } diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index f32ed1dd2b3..8d8d3aa7b36 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -27,7 +27,7 @@ func TestRepositoriesService_GetActionsPermissions(t *testing.T) { if err != nil { t.Errorf("Repositories.GetActionsPermissions returned error: %v", err) } - want := &ActionsPermissionsRepository{Enabled: Ptr(true), AllowedActions: Ptr("all"), SHAPinningRequired: Ptr(true)} + want := &ActionsPermissionsRepository{Enabled: new(true), AllowedActions: new("all"), SHAPinningRequired: new(true)} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetActionsPermissions returned %+v, want %+v", org, want) } @@ -51,7 +51,7 @@ func TestRepositoriesService_UpdateActionsPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissionsRepository{Enabled: Ptr(true), AllowedActions: Ptr("selected"), SHAPinningRequired: Ptr(true)} + input := &ActionsPermissionsRepository{Enabled: new(true), AllowedActions: new("selected"), SHAPinningRequired: new(true)} mux.HandleFunc("/repos/o/r/actions/permissions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -65,7 +65,7 @@ func TestRepositoriesService_UpdateActionsPermissions(t *testing.T) { t.Errorf("Repositories.UpdateActionsPermissions returned error: %v", err) } - want := &ActionsPermissionsRepository{Enabled: Ptr(true), AllowedActions: Ptr("selected"), SHAPinningRequired: Ptr(true)} + want := &ActionsPermissionsRepository{Enabled: new(true), AllowedActions: new("selected"), SHAPinningRequired: new(true)} if !cmp.Equal(org, want) { t.Errorf("Repositories.UpdateActionsPermissions returned %+v, want %+v", org, want) } @@ -99,7 +99,7 @@ func TestRepositoriesService_GetDefaultWorkflowPermissions(t *testing.T) { if err != nil { t.Errorf("Repositories.GetDefaultWorkflowPermissions returned error: %v", err) } - want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetDefaultWorkflowPermissions returned %+v, want %+v", org, want) } @@ -123,7 +123,7 @@ func TestRepositoriesService_UpdateDefaultWorkflowPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + input := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} mux.HandleFunc("/repos/o/r/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -137,7 +137,7 @@ func TestRepositoriesService_UpdateDefaultWorkflowPermissions(t *testing.T) { t.Errorf("Repositories.UpdateDefaultWorkflowPermissions returned error: %v", err) } - want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} + want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: new("read"), CanApprovePullRequestReviews: new(true)} if !cmp.Equal(org, want) { t.Errorf("Repositories.UpdateDefaultWorkflowPermissions returned %+v, want %+v", org, want) } @@ -173,8 +173,8 @@ func TestRepositoriesService_GetArtifactAndLogRetentionPeriod(t *testing.T) { } want := &ArtifactPeriod{ - Days: Ptr(90), - MaximumAllowedDays: Ptr(365), + Days: new(90), + MaximumAllowedDays: new(365), } if !cmp.Equal(period, want) { t.Errorf("Repositories.GetArtifactAndLogRetentionPeriod = %+v, want %+v", period, want) @@ -199,7 +199,7 @@ func TestRepositoriesService_UpdateArtifactAndLogRetentionPeriod(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ArtifactPeriodOpt{Days: Ptr(90)} + input := &ArtifactPeriodOpt{Days: new(90)} mux.HandleFunc("/repos/o/r/actions/permissions/artifact-and-log-retention", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") @@ -243,10 +243,10 @@ func TestRepositoriesService_GetPrivateRepoForkPRWorkflowSettings(t *testing.T) t.Errorf("Repositories.GetPrivateRepoForkPRWorkflowSettings returned error: %v", err) } want := &WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: Ptr(true), - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), - RequireApprovalForForkPRWorkflows: Ptr(false), + RunWorkflowsFromForkPullRequests: new(true), + SendWriteTokensToWorkflows: new(false), + SendSecretsAndVariables: new(true), + RequireApprovalForForkPRWorkflows: new(false), } if !cmp.Equal(permissions, want) { t.Errorf("Repositories.GetPrivateRepoForkPRWorkflowSettings returned %+v, want %+v", permissions, want) @@ -273,8 +273,8 @@ func TestRepositoriesService_UpdatePrivateRepoForkPRWorkflowSettings(t *testing. input := &WorkflowsPermissionsOpt{ RunWorkflowsFromForkPullRequests: true, - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(true), + SendWriteTokensToWorkflows: new(false), + SendSecretsAndVariables: new(true), } mux.HandleFunc("/repos/o/r/actions/permissions/fork-pr-workflows-private-repos", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/repos_autolinks_test.go b/github/repos_autolinks_test.go index a5fb2b12a80..2d419ad3000 100644 --- a/github/repos_autolinks_test.go +++ b/github/repos_autolinks_test.go @@ -29,8 +29,8 @@ func TestRepositoriesService_ListAutolinks(t *testing.T) { } want := []*Autolink{ - {ID: Ptr(int64(1)), KeyPrefix: Ptr("TICKET-"), URLTemplate: Ptr("https://example.com/TICKET?query=")}, - {ID: Ptr(int64(2)), KeyPrefix: Ptr("STORY-"), URLTemplate: Ptr("https://example.com/STORY?query=")}, + {ID: new(int64(1)), KeyPrefix: new("TICKET-"), URLTemplate: new("https://example.com/TICKET?query=")}, + {ID: new(int64(2)), KeyPrefix: new("STORY-"), URLTemplate: new("https://example.com/STORY?query=")}, } if !cmp.Equal(autolinks, want) { @@ -59,7 +59,7 @@ func TestRepositoriesService_CreateAutolink(t *testing.T) { body := CreateAutolinkRequest{ KeyPrefix: "TICKET-", URLTemplate: "https://example.com/TICKET?query=", - IsAlphanumeric: Ptr(true), + IsAlphanumeric: new(true), } mux.HandleFunc("/repos/o/r/autolinks", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -79,9 +79,9 @@ func TestRepositoriesService_CreateAutolink(t *testing.T) { t.Errorf("Repositories.CreateAutolink returned error: %v", err) } want := &Autolink{ - KeyPrefix: Ptr("TICKET-"), - URLTemplate: Ptr("https://example.com/TICKET?query="), - IsAlphanumeric: Ptr(true), + KeyPrefix: new("TICKET-"), + URLTemplate: new("https://example.com/TICKET?query="), + IsAlphanumeric: new(true), } if !cmp.Equal(autolink, want) { @@ -118,7 +118,7 @@ func TestRepositoriesService_GetAutolink(t *testing.T) { t.Errorf("Repositories.GetAutolink returned error: %v", err) } - want := &Autolink{ID: Ptr(int64(1)), KeyPrefix: Ptr("TICKET-"), URLTemplate: Ptr("https://example.com/TICKET?query=")} + want := &Autolink{ID: new(int64(1)), KeyPrefix: new("TICKET-"), URLTemplate: new("https://example.com/TICKET?query=")} if !cmp.Equal(autolink, want) { t.Errorf("Repositories.GetAutolink returned %+v, want %+v", autolink, want) } diff --git a/github/repos_codeowners_test.go b/github/repos_codeowners_test.go index 87b2a7a12aa..0927cf4281c 100644 --- a/github/repos_codeowners_test.go +++ b/github/repos_codeowners_test.go @@ -49,7 +49,7 @@ func TestRepositoriesService_GetCodeownersErrors_noRef(t *testing.T) { Column: 1, Kind: "Invalid pattern", Source: "***/*.rb @monalisa", - Suggestion: Ptr("Did you mean **/*.rb?"), + Suggestion: new("Did you mean **/*.rb?"), Message: "Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", Path: ".github/CODEOWNERS", }, @@ -112,7 +112,7 @@ func TestRepositoriesService_GetCodeownersErrors_specificRef(t *testing.T) { Column: 1, Kind: "Invalid pattern", Source: "***/*.rb @monalisa", - Suggestion: Ptr("Did you mean **/*.rb?"), + Suggestion: new("Did you mean **/*.rb?"), Message: "Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", Path: ".github/CODEOWNERS", }, diff --git a/github/repos_collaborators_test.go b/github/repos_collaborators_test.go index 7c3d9cab0dd..d69929da266 100644 --- a/github/repos_collaborators_test.go +++ b/github/repos_collaborators_test.go @@ -32,7 +32,7 @@ func TestRepositoriesService_ListCollaborators(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*User{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want) } @@ -72,7 +72,7 @@ func TestRepositoriesService_ListCollaborators_withAffiliation(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*User{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want) } @@ -112,7 +112,7 @@ func TestRepositoriesService_ListCollaborators_withPermission(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*User{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want) } @@ -234,9 +234,9 @@ func TestRepositoryService_GetPermissionLevel(t *testing.T) { } want := &RepositoryPermissionLevel{ - Permission: Ptr("admin"), + Permission: new("admin"), User: &User{ - Login: Ptr("u"), + Login: new("u"), }, } @@ -276,21 +276,21 @@ func TestRepositoriesService_AddCollaborator(t *testing.T) { t.Errorf("Repositories.AddCollaborator returned error: %v", err) } want := &CollaboratorInvitation{ - ID: Ptr(int64(1)), + ID: new(int64(1)), Repo: &Repository{ - ID: Ptr(int64(1)), - URL: Ptr("s"), - Name: Ptr("r"), + ID: new(int64(1)), + URL: new("s"), + Name: new("r"), }, Invitee: &User{ - Login: Ptr("u"), + Login: new("u"), }, Inviter: &User{ - Login: Ptr("o"), + Login: new("o"), }, - Permissions: Ptr("write"), - URL: Ptr("https://api.github.com/user/repository_invitations/1296269"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/invitations"), + Permissions: new("write"), + URL: new("https://api.github.com/user/repository_invitations/1296269"), + HTMLURL: new("https://github.com/octocat/Hello-World/invitations"), } if !cmp.Equal(collaboratorInvitation, want) { diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go index 7cebb99dad9..aaf63a9279a 100644 --- a/github/repos_comments_test.go +++ b/github/repos_comments_test.go @@ -31,7 +31,7 @@ func TestRepositoriesService_ListComments(t *testing.T) { t.Errorf("Repositories.ListComments returned error: %v", err) } - want := []*RepositoryComment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*RepositoryComment{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(comments, want) { t.Errorf("Repositories.ListComments returned %+v, want %+v", comments, want) } @@ -78,7 +78,7 @@ func TestRepositoriesService_ListCommitComments(t *testing.T) { t.Errorf("Repositories.ListCommitComments returned error: %v", err) } - want := []*RepositoryComment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*RepositoryComment{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(comments, want) { t.Errorf("Repositories.ListCommitComments returned %+v, want %+v", comments, want) } @@ -111,7 +111,7 @@ func TestRepositoriesService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &RepositoryComment{Body: Ptr("b")} + input := &RepositoryComment{Body: new("b")} mux.HandleFunc("/repos/o/r/commits/s/comments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -125,7 +125,7 @@ func TestRepositoriesService_CreateComment(t *testing.T) { t.Errorf("Repositories.CreateComment returned error: %v", err) } - want := &RepositoryComment{ID: Ptr(int64(1))} + want := &RepositoryComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Repositories.CreateComment returned %+v, want %+v", comment, want) } @@ -170,7 +170,7 @@ func TestRepositoriesService_GetComment(t *testing.T) { t.Errorf("Repositories.GetComment returned error: %v", err) } - want := &RepositoryComment{ID: Ptr(int64(1))} + want := &RepositoryComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Repositories.GetComment returned %+v, want %+v", comment, want) } @@ -203,7 +203,7 @@ func TestRepositoriesService_UpdateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &RepositoryComment{Body: Ptr("b")} + input := &RepositoryComment{Body: new("b")} mux.HandleFunc("/repos/o/r/comments/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -218,7 +218,7 @@ func TestRepositoriesService_UpdateComment(t *testing.T) { t.Errorf("Repositories.UpdateComment returned error: %v", err) } - want := &RepositoryComment{ID: Ptr(int64(1))} + want := &RepositoryComment{ID: new(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Repositories.UpdateComment returned %+v, want %+v", comment, want) } diff --git a/github/repos_commits_test.go b/github/repos_commits_test.go index 1ca3c1f4338..2d5997e577a 100644 --- a/github/repos_commits_test.go +++ b/github/repos_commits_test.go @@ -47,7 +47,7 @@ func TestRepositoriesService_ListCommits(t *testing.T) { t.Errorf("Repositories.ListCommits returned error: %v", err) } - want := []*RepositoryCommit{{SHA: Ptr("s")}} + want := []*RepositoryCommit{{SHA: new("s")}} if !cmp.Equal(commits, want) { t.Errorf("Repositories.ListCommits returned %+v, want %+v", commits, want) } @@ -105,37 +105,37 @@ func TestRepositoriesService_GetCommit(t *testing.T) { } want := &RepositoryCommit{ - SHA: Ptr("s"), + SHA: new("s"), Commit: &Commit{ - Message: Ptr("m"), + Message: new("m"), }, Author: &User{ - Login: Ptr("l"), + Login: new("l"), }, Committer: &User{ - Login: Ptr("l"), + Login: new("l"), }, Parents: []*Commit{ { - SHA: Ptr("s"), + SHA: new("s"), }, }, Stats: &CommitStats{ - Additions: Ptr(104), - Deletions: Ptr(4), - Total: Ptr(108), + Additions: new(104), + Deletions: new(4), + Total: new(108), }, Files: []*CommitFile{ { - Filename: Ptr("f"), - Additions: Ptr(10), - Deletions: Ptr(2), - Changes: Ptr(12), - Status: Ptr("s"), - Patch: Ptr("p"), - BlobURL: Ptr("b"), - RawURL: Ptr("r"), - ContentsURL: Ptr("c"), + Filename: new("f"), + Additions: new(10), + Deletions: new(2), + Changes: new(12), + Status: new("s"), + Patch: new("p"), + BlobURL: new("b"), + RawURL: new("r"), + ContentsURL: new("c"), }, }, } @@ -445,50 +445,50 @@ func TestRepositoriesService_CompareCommits(t *testing.T) { want := &CommitsComparison{ BaseCommit: &RepositoryCommit{ - SHA: Ptr("s"), + SHA: new("s"), Commit: &Commit{ - Author: &CommitAuthor{Name: Ptr("n")}, - Committer: &CommitAuthor{Name: Ptr("n")}, - Message: Ptr("m"), - Tree: &Tree{SHA: Ptr("t")}, + Author: &CommitAuthor{Name: new("n")}, + Committer: &CommitAuthor{Name: new("n")}, + Message: new("m"), + Tree: &Tree{SHA: new("t")}, }, - Author: &User{Login: Ptr("l")}, - Committer: &User{Login: Ptr("l")}, + Author: &User{Login: new("l")}, + Committer: &User{Login: new("l")}, Parents: []*Commit{ { - SHA: Ptr("s"), + SHA: new("s"), }, }, }, - Status: Ptr("s"), - AheadBy: Ptr(1), - BehindBy: Ptr(2), - TotalCommits: Ptr(1), + Status: new("s"), + AheadBy: new(1), + BehindBy: new(2), + TotalCommits: new(1), Commits: []*RepositoryCommit{ { - SHA: Ptr("s"), + SHA: new("s"), Commit: &Commit{ - Author: &CommitAuthor{Name: Ptr("n")}, + Author: &CommitAuthor{Name: new("n")}, }, - Author: &User{Login: Ptr("l")}, - Committer: &User{Login: Ptr("l")}, + Author: &User{Login: new("l")}, + Committer: &User{Login: new("l")}, Parents: []*Commit{ { - SHA: Ptr("s"), + SHA: new("s"), }, }, }, }, Files: []*CommitFile{ { - Filename: Ptr("f"), + Filename: new("f"), }, }, - HTMLURL: Ptr(fmt.Sprintf("https://github.com/o/r/compare/%v...%v", escapedBase, escapedHead)), - PermalinkURL: Ptr("https://github.com/o/r/compare/o:bbcd538c8e72b8c175046e27cc8f907076331401...o:0328041d1152db8ae77652d1618a02e57f745f17"), - DiffURL: Ptr(fmt.Sprintf("https://github.com/o/r/compare/%v...%v.diff", escapedBase, escapedHead)), - PatchURL: Ptr(fmt.Sprintf("https://github.com/o/r/compare/%v...%v.patch", escapedBase, escapedHead)), - URL: Ptr(fmt.Sprintf("https://api.github.com/repos/o/r/compare/%v...%v", escapedBase, escapedHead)), + HTMLURL: new(fmt.Sprintf("https://github.com/o/r/compare/%v...%v", escapedBase, escapedHead)), + PermalinkURL: new("https://github.com/o/r/compare/o:bbcd538c8e72b8c175046e27cc8f907076331401...o:0328041d1152db8ae77652d1618a02e57f745f17"), + DiffURL: new(fmt.Sprintf("https://github.com/o/r/compare/%v...%v.diff", escapedBase, escapedHead)), + PatchURL: new(fmt.Sprintf("https://github.com/o/r/compare/%v...%v.patch", escapedBase, escapedHead)), + URL: new(fmt.Sprintf("https://api.github.com/repos/o/r/compare/%v...%v", escapedBase, escapedHead)), } if !cmp.Equal(got, want) { @@ -659,12 +659,12 @@ func TestRepositoriesService_ListBranchesHeadCommit(t *testing.T) { want := []*BranchCommit{ { - Name: Ptr("b"), + Name: new("b"), Commit: &Commit{ - SHA: Ptr("2e90302801c870f17b6152327d9b9a03c8eca0e2"), - URL: Ptr("https://api.github.com/repos/google/go-github/commits/2e90302801c870f17b6152327d9b9a03c8eca0e2"), + SHA: new("2e90302801c870f17b6152327d9b9a03c8eca0e2"), + URL: new("https://api.github.com/repos/google/go-github/commits/2e90302801c870f17b6152327d9b9a03c8eca0e2"), }, - Protected: Ptr(true), + Protected: new(true), }, } if !cmp.Equal(branches, want) { diff --git a/github/repos_community_health_test.go b/github/repos_community_health_test.go index 19705d5ee6c..219ef482cdf 100644 --- a/github/repos_community_health_test.go +++ b/github/repos_community_health_test.go @@ -71,43 +71,43 @@ func TestRepositoriesService_GetCommunityHealthMetrics(t *testing.T) { } want := &CommunityHealthMetrics{ - HealthPercentage: Ptr(100), - Description: Ptr("My first repository on GitHub!"), + HealthPercentage: new(100), + Description: new("My first repository on GitHub!"), UpdatedAt: &referenceTimestamp, - ContentReportsEnabled: Ptr(true), + ContentReportsEnabled: new(true), Files: &CommunityHealthFiles{ CodeOfConduct: &Metric{ - Name: Ptr("Contributor Covenant"), - Key: Ptr("contributor_covenant"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"), + Name: new("Contributor Covenant"), + Key: new("contributor_covenant"), + HTMLURL: new("https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"), }, CodeOfConductFile: &Metric{ - URL: Ptr("https://api.github.com/repos/octocat/Hello-World/contents/CODE_OF_CONDUCT.md"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"), + URL: new("https://api.github.com/repos/octocat/Hello-World/contents/CODE_OF_CONDUCT.md"), + HTMLURL: new("https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"), }, Contributing: &Metric{ - URL: Ptr("https://api.github.com/repos/octocat/Hello-World/contents/CONTRIBUTING"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/CONTRIBUTING"), + URL: new("https://api.github.com/repos/octocat/Hello-World/contents/CONTRIBUTING"), + HTMLURL: new("https://github.com/octocat/Hello-World/blob/master/CONTRIBUTING"), }, IssueTemplate: &Metric{ - URL: Ptr("https://api.github.com/repos/octocat/Hello-World/contents/ISSUE_TEMPLATE"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/ISSUE_TEMPLATE"), + URL: new("https://api.github.com/repos/octocat/Hello-World/contents/ISSUE_TEMPLATE"), + HTMLURL: new("https://github.com/octocat/Hello-World/blob/master/ISSUE_TEMPLATE"), }, PullRequestTemplate: &Metric{ - URL: Ptr("https://api.github.com/repos/octocat/Hello-World/contents/PULL_REQUEST_TEMPLATE"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/PULL_REQUEST_TEMPLATE"), + URL: new("https://api.github.com/repos/octocat/Hello-World/contents/PULL_REQUEST_TEMPLATE"), + HTMLURL: new("https://github.com/octocat/Hello-World/blob/master/PULL_REQUEST_TEMPLATE"), }, License: &Metric{ - Name: Ptr("MIT License"), - Key: Ptr("mit"), - SPDXID: Ptr("MIT"), - URL: Ptr("https://api.github.com/licenses/mit"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/LICENSE"), - NodeID: Ptr("MDc6TGljZW5zZW1pdA=="), + Name: new("MIT License"), + Key: new("mit"), + SPDXID: new("MIT"), + URL: new("https://api.github.com/licenses/mit"), + HTMLURL: new("https://github.com/octocat/Hello-World/blob/master/LICENSE"), + NodeID: new("MDc6TGljZW5zZW1pdA=="), }, Readme: &Metric{ - URL: Ptr("https://api.github.com/repos/octocat/Hello-World/contents/README.md"), - HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/README.md"), + URL: new("https://api.github.com/repos/octocat/Hello-World/contents/README.md"), + HTMLURL: new("https://github.com/octocat/Hello-World/blob/master/README.md"), }, }, } diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index b2890684a4d..e59dff65310 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -24,14 +24,14 @@ func TestRepositoryContent_GetContent(t *testing.T) { wantErr bool // whether an error is expected }{ { - encoding: Ptr(""), - content: Ptr("hello"), + encoding: new(""), + content: new("hello"), want: "hello", wantErr: false, }, { encoding: nil, - content: Ptr("hello"), + content: new("hello"), want: "hello", wantErr: false, }, @@ -42,19 +42,19 @@ func TestRepositoryContent_GetContent(t *testing.T) { wantErr: false, }, { - encoding: Ptr("base64"), - content: Ptr("aGVsbG8="), + encoding: new("base64"), + content: new("aGVsbG8="), want: "hello", wantErr: false, }, { - encoding: Ptr("bad"), - content: Ptr("aGVsbG8="), + encoding: new("bad"), + content: new("aGVsbG8="), want: "", wantErr: true, }, { - encoding: Ptr("none"), + encoding: new("none"), content: nil, want: "", wantErr: true, @@ -106,7 +106,7 @@ func TestRepositoriesService_GetReadme(t *testing.T) { if err != nil { t.Errorf("Repositories.GetReadme returned error: %v", err) } - want := &RepositoryContent{Type: Ptr("file"), Name: Ptr("README.md"), Size: Ptr(5362), Encoding: Ptr("base64"), Path: Ptr("README.md")} + want := &RepositoryContent{Type: new("file"), Name: new("README.md"), Size: new(5362), Encoding: new("base64"), Path: new("README.md")} if !cmp.Equal(readme, want) { t.Errorf("Repositories.GetReadme returned %+v, want %+v", readme, want) } @@ -678,7 +678,7 @@ func TestRepositoriesService_GetContents_File(t *testing.T) { if err != nil { t.Errorf("Repositories.GetContents returned error: %v", err) } - want := &RepositoryContent{Type: Ptr("file"), Name: Ptr("LICENSE"), Size: Ptr(20678), Encoding: Ptr("base64"), Path: Ptr("LICENSE")} + want := &RepositoryContent{Type: new("file"), Name: new("LICENSE"), Size: new(20678), Encoding: new("base64"), Path: new("LICENSE")} if !cmp.Equal(fileContents, want) { t.Errorf("Repositories.GetContents returned %+v, want %+v", fileContents, want) } @@ -782,8 +782,8 @@ func TestRepositoriesService_GetContents_Directory(t *testing.T) { t.Errorf("Repositories.GetContents returned error: %v", err) } want := []*RepositoryContent{ - {Type: Ptr("dir"), Name: Ptr("lib"), Path: Ptr("lib")}, - {Type: Ptr("file"), Name: Ptr("LICENSE"), Size: Ptr(20678), Path: Ptr("LICENSE")}, + {Type: new("dir"), Name: new("lib"), Path: new("lib")}, + {Type: new("file"), Name: new("LICENSE"), Size: new(20678), Path: new("LICENSE")}, } if !cmp.Equal(directoryContents, want) { t.Errorf("Repositories.GetContents_Directory returned %+v, want %+v", directoryContents, want) @@ -807,9 +807,9 @@ func TestRepositoriesService_CreateFile(t *testing.T) { }`) }) repositoryContentsOptions := &RepositoryContentFileOptions{ - Message: Ptr("m"), + Message: new("m"), Content: []byte("c"), - Committer: &CommitAuthor{Name: Ptr("n"), Email: Ptr("e")}, + Committer: &CommitAuthor{Name: new("n"), Email: new("e")}, } ctx := t.Context() createResponse, _, err := client.Repositories.CreateFile(ctx, "o", "r", "p", repositoryContentsOptions) @@ -817,10 +817,10 @@ func TestRepositoriesService_CreateFile(t *testing.T) { t.Errorf("Repositories.CreateFile returned error: %v", err) } want := &RepositoryContentResponse{ - Content: &RepositoryContent{Name: Ptr("p")}, + Content: &RepositoryContent{Name: new("p")}, Commit: Commit{ - Message: Ptr("m"), - SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), + Message: new("m"), + SHA: new("f5f369044773ff9c6383c087466d12adb6fa0828"), }, } if !cmp.Equal(createResponse, want) { @@ -859,10 +859,10 @@ func TestRepositoriesService_UpdateFile(t *testing.T) { }`) }) repositoryContentsOptions := &RepositoryContentFileOptions{ - Message: Ptr("m"), + Message: new("m"), Content: []byte("c"), - SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), - Committer: &CommitAuthor{Name: Ptr("n"), Email: Ptr("e")}, + SHA: new("f5f369044773ff9c6383c087466d12adb6fa0828"), + Committer: &CommitAuthor{Name: new("n"), Email: new("e")}, } ctx := t.Context() updateResponse, _, err := client.Repositories.UpdateFile(ctx, "o", "r", "p", repositoryContentsOptions) @@ -870,10 +870,10 @@ func TestRepositoriesService_UpdateFile(t *testing.T) { t.Errorf("Repositories.UpdateFile returned error: %v", err) } want := &RepositoryContentResponse{ - Content: &RepositoryContent{Name: Ptr("p")}, + Content: &RepositoryContent{Name: new("p")}, Commit: Commit{ - Message: Ptr("m"), - SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), + Message: new("m"), + SHA: new("f5f369044773ff9c6383c087466d12adb6fa0828"), }, } if !cmp.Equal(updateResponse, want) { @@ -910,9 +910,9 @@ func TestRepositoriesService_DeleteFile(t *testing.T) { }`) }) repositoryContentsOptions := &RepositoryContentFileOptions{ - Message: Ptr("m"), - SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), - Committer: &CommitAuthor{Name: Ptr("n"), Email: Ptr("e")}, + Message: new("m"), + SHA: new("f5f369044773ff9c6383c087466d12adb6fa0828"), + Committer: &CommitAuthor{Name: new("n"), Email: new("e")}, } ctx := t.Context() deleteResponse, _, err := client.Repositories.DeleteFile(ctx, "o", "r", "p", repositoryContentsOptions) @@ -922,8 +922,8 @@ func TestRepositoriesService_DeleteFile(t *testing.T) { want := &RepositoryContentResponse{ Content: nil, Commit: Commit{ - Message: Ptr("m"), - SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), + Message: new("m"), + SHA: new("f5f369044773ff9c6383c087466d12adb6fa0828"), }, } if !cmp.Equal(deleteResponse, want) { diff --git a/github/repos_deployment_branch_policies_test.go b/github/repos_deployment_branch_policies_test.go index 2da27aa5b42..cf4b3898f30 100644 --- a/github/repos_deployment_branch_policies_test.go +++ b/github/repos_deployment_branch_policies_test.go @@ -34,10 +34,10 @@ func TestRepositoriesService_ListDeploymentBranchPolicies(t *testing.T) { want := &DeploymentBranchPolicyResponse{ BranchPolicies: []*DeploymentBranchPolicy{ - {ID: Ptr(int64(1))}, - {ID: Ptr(int64(2))}, + {ID: new(int64(1))}, + {ID: new(int64(2))}, }, - TotalCount: Ptr(2), + TotalCount: new(2), } if !cmp.Equal(got, want) { t.Errorf("Repositories.ListDeploymentBranchPolicies = %+v, want %+v", got, want) @@ -72,7 +72,7 @@ func TestRepositoriesService_GetDeploymentBranchPolicy(t *testing.T) { t.Errorf("Repositories.GetDeploymentBranchPolicy returned error: %v", err) } - want := &DeploymentBranchPolicy{ID: Ptr(int64(1))} + want := &DeploymentBranchPolicy{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.GetDeploymentBranchPolicy = %+v, want %+v", got, want) } @@ -97,12 +97,12 @@ func TestRepositoriesService_CreateDeploymentBranchPolicy(t *testing.T) { }) ctx := t.Context() - got, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", CreateDeploymentBranchPolicyRequest{Name: "n", Type: Ptr("branch")}) + got, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", CreateDeploymentBranchPolicyRequest{Name: "n", Type: new("branch")}) if err != nil { t.Errorf("Repositories.CreateDeploymentBranchPolicy returned error: %v", err) } - want := &DeploymentBranchPolicy{ID: Ptr(int64(1)), Type: Ptr("branch")} + want := &DeploymentBranchPolicy{ID: new(int64(1)), Type: new("branch")} if !cmp.Equal(got, want) { t.Errorf("Repositories.CreateDeploymentBranchPolicy = %+v, want %+v", got, want) } @@ -132,7 +132,7 @@ func TestRepositoriesService_UpdateDeploymentBranchPolicy(t *testing.T) { t.Errorf("Repositories.UpdateDeploymentBranchPolicy returned error: %v", err) } - want := &DeploymentBranchPolicy{ID: Ptr(int64(1))} + want := &DeploymentBranchPolicy{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.UpdateDeploymentBranchPolicy = %+v, want %+v", got, want) } diff --git a/github/repos_deployment_protection_rules_test.go b/github/repos_deployment_protection_rules_test.go index d3179bc69df..adee3357f80 100644 --- a/github/repos_deployment_protection_rules_test.go +++ b/github/repos_deployment_protection_rules_test.go @@ -30,10 +30,10 @@ func TestRepositoriesService_GetAllDeploymentProtectionRules(t *testing.T) { want := &ListDeploymentProtectionRuleResponse{ ProtectionRules: []*CustomDeploymentProtectionRule{ - {ID: Ptr(int64(3)), NodeID: Ptr("IEH37kRlcGxveW1lbnRTdGF0ddiv"), Enabled: Ptr(true), App: &CustomDeploymentProtectionRuleApp{ID: Ptr(int64(1)), NodeID: Ptr("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: Ptr("a-custom-app"), IntegrationURL: Ptr("https://api.github.com/apps/a-custom-app")}}, - {ID: Ptr(int64(4)), NodeID: Ptr("MDE2OkRlcGxveW1lbnRTdHJ41128"), Enabled: Ptr(true), App: &CustomDeploymentProtectionRuleApp{ID: Ptr(int64(1)), NodeID: Ptr("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: Ptr("another-custom-app"), IntegrationURL: Ptr("https://api.github.com/apps/another-custom-app")}}, + {ID: new(int64(3)), NodeID: new("IEH37kRlcGxveW1lbnRTdGF0ddiv"), Enabled: new(true), App: &CustomDeploymentProtectionRuleApp{ID: new(int64(1)), NodeID: new("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: new("a-custom-app"), IntegrationURL: new("https://api.github.com/apps/a-custom-app")}}, + {ID: new(int64(4)), NodeID: new("MDE2OkRlcGxveW1lbnRTdHJ41128"), Enabled: new(true), App: &CustomDeploymentProtectionRuleApp{ID: new(int64(1)), NodeID: new("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: new("another-custom-app"), IntegrationURL: new("https://api.github.com/apps/another-custom-app")}}, }, - TotalCount: Ptr(2), + TotalCount: new(2), } if !cmp.Equal(got, want) { t.Errorf("Repositories.GetAllDeploymentProtectionRules = %+v, want %+v", got, want) @@ -54,7 +54,7 @@ func TestRepositoriesService_CreateCustomDeploymentProtectionRule(t *testing.T) client, mux, _ := setup(t) input := &CustomDeploymentProtectionRuleRequest{ - IntegrationID: Ptr(int64(5)), + IntegrationID: new(int64(5)), } mux.HandleFunc("/repos/o/r/environments/e/deployment_protection_rules", func(w http.ResponseWriter, r *http.Request) { @@ -70,14 +70,14 @@ func TestRepositoriesService_CreateCustomDeploymentProtectionRule(t *testing.T) } want := &CustomDeploymentProtectionRule{ - ID: Ptr(int64(3)), - NodeID: Ptr("IEH37kRlcGxveW1lbnRTdGF0ddiv"), - Enabled: Ptr(true), + ID: new(int64(3)), + NodeID: new("IEH37kRlcGxveW1lbnRTdGF0ddiv"), + Enabled: new(true), App: &CustomDeploymentProtectionRuleApp{ - ID: Ptr(int64(1)), - NodeID: Ptr("GHT58kRlcGxveW1lbnRTdTY!bbcy"), - Slug: Ptr("a-custom-app"), - IntegrationURL: Ptr("https://api.github.com/apps/a-custom-app"), + ID: new(int64(1)), + NodeID: new("GHT58kRlcGxveW1lbnRTdTY!bbcy"), + Slug: new("a-custom-app"), + IntegrationURL: new("https://api.github.com/apps/a-custom-app"), }, } if !cmp.Equal(got, want) { @@ -120,10 +120,10 @@ func TestRepositoriesService_ListCustomDeploymentRuleIntegrations(t *testing.T) } want := &ListCustomDeploymentRuleIntegrationsResponse{ - TotalCount: Ptr(2), + TotalCount: new(2), AvailableIntegrations: []*CustomDeploymentProtectionRuleApp{ - {ID: Ptr(int64(1)), NodeID: Ptr("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: Ptr("a-custom-app"), IntegrationURL: Ptr("https://api.github.com/apps/a-custom-app")}, - {ID: Ptr(int64(2)), NodeID: Ptr("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: Ptr("another-custom-app"), IntegrationURL: Ptr("https://api.github.com/apps/another-custom-app")}, + {ID: new(int64(1)), NodeID: new("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: new("a-custom-app"), IntegrationURL: new("https://api.github.com/apps/a-custom-app")}, + {ID: new(int64(2)), NodeID: new("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: new("another-custom-app"), IntegrationURL: new("https://api.github.com/apps/another-custom-app")}, }, } if !cmp.Equal(got, want) { @@ -160,14 +160,14 @@ func TestRepositoriesService_GetCustomDeploymentProtectionRule(t *testing.T) { } want := &CustomDeploymentProtectionRule{ - ID: Ptr(int64(1)), - NodeID: Ptr("IEH37kRlcGxveW1lbnRTdGF0ddiv"), - Enabled: Ptr(true), + ID: new(int64(1)), + NodeID: new("IEH37kRlcGxveW1lbnRTdGF0ddiv"), + Enabled: new(true), App: &CustomDeploymentProtectionRuleApp{ - ID: Ptr(int64(1)), - NodeID: Ptr("GHT58kRlcGxveW1lbnRTdTY!bbcy"), - Slug: Ptr("a-custom-app"), - IntegrationURL: Ptr("https://api.github.com/apps/a-custom-app"), + ID: new(int64(1)), + NodeID: new("GHT58kRlcGxveW1lbnRTdTY!bbcy"), + Slug: new("a-custom-app"), + IntegrationURL: new("https://api.github.com/apps/a-custom-app"), }, } diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index f1fda8c9258..8d11d3e1d3e 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -31,7 +31,7 @@ func TestRepositoriesService_ListDeployments(t *testing.T) { t.Errorf("Repositories.ListDeployments returned error: %v", err) } - want := []*Deployment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Deployment{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(deployments, want) { t.Errorf("Repositories.ListDeployments returned %+v, want %+v", deployments, want) } @@ -66,7 +66,7 @@ func TestRepositoriesService_GetDeployment(t *testing.T) { t.Errorf("Repositories.GetDeployment returned error: %v", err) } - want := &Deployment{ID: Ptr(int64(3))} + want := &Deployment{ID: new(int64(3))} if !cmp.Equal(deployment, want) { t.Errorf("Repositories.GetDeployment returned %+v, want %+v", deployment, want) @@ -91,7 +91,7 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := DeploymentRequest{Ref: "1111", Task: Ptr("deploy"), TransientEnvironment: Ptr(true)} + input := DeploymentRequest{Ref: "1111", Task: new("deploy"), TransientEnvironment: new(true)} mux.HandleFunc("/repos/o/r/deployments", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -107,7 +107,7 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { t.Errorf("Repositories.CreateDeployment returned error: %v", err) } - want := &Deployment{Ref: Ptr("1111"), Task: Ptr("deploy")} + want := &Deployment{Ref: new("1111"), Task: new("deploy")} if !cmp.Equal(deployment, want) { t.Errorf("Repositories.CreateDeployment returned %+v, want %+v", deployment, want) } @@ -183,7 +183,7 @@ func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) { t.Errorf("Repositories.ListDeploymentStatuses returned error: %v", err) } - want := []*DeploymentStatus{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*DeploymentStatus{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(statuses, want) { t.Errorf("Repositories.ListDeploymentStatuses returned %+v, want %+v", statuses, want) } @@ -220,7 +220,7 @@ func TestRepositoriesService_GetDeploymentStatus(t *testing.T) { t.Errorf("Repositories.GetDeploymentStatus returned error: %v", err) } - want := &DeploymentStatus{ID: Ptr(int64(4))} + want := &DeploymentStatus{ID: new(int64(4))} if !cmp.Equal(deploymentStatus, want) { t.Errorf("Repositories.GetDeploymentStatus returned %+v, want %+v", deploymentStatus, want) } @@ -244,7 +244,7 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := DeploymentStatusRequest{State: "inactive", Description: Ptr("deploy"), AutoInactive: Ptr(false)} + input := DeploymentStatusRequest{State: "inactive", Description: new("deploy"), AutoInactive: new(false)} mux.HandleFunc("/repos/o/r/deployments/1/statuses", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -260,7 +260,7 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) { t.Errorf("Repositories.CreateDeploymentStatus returned error: %v", err) } - want := &DeploymentStatus{State: Ptr("inactive"), Description: Ptr("deploy")} + want := &DeploymentStatus{State: new("inactive"), Description: new("deploy")} if !cmp.Equal(deploymentStatus, want) { t.Errorf("Repositories.CreateDeploymentStatus returned %+v, want %+v", deploymentStatus, want) } diff --git a/github/repos_environments.go b/github/repos_environments.go index 5e892e5f59c..59b749d7c81 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -161,10 +161,10 @@ func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, n func (c CreateUpdateEnvironment) MarshalJSON() ([]byte, error) { type alias CreateUpdateEnvironment if c.WaitTimer == nil { - c.WaitTimer = Ptr(0) + c.WaitTimer = new(0) } if c.CanAdminsBypass == nil { - c.CanAdminsBypass = Ptr(true) + c.CanAdminsBypass = new(true) } return json.Marshal(&struct { alias diff --git a/github/repos_environments_test.go b/github/repos_environments_test.go index 2dddb226bad..0ee2ef38bea 100644 --- a/github/repos_environments_test.go +++ b/github/repos_environments_test.go @@ -23,17 +23,17 @@ func TestRequiredReviewer_UnmarshalJSON(t *testing.T) { }{ "User Reviewer": { data: []byte(`[{"type": "User", "reviewer": {"id": 1,"login": "octocat"}}]`), - wantRule: []*RequiredReviewer{{Type: Ptr("User"), Reviewer: &User{ID: Ptr(int64(1)), Login: Ptr("octocat")}}}, + wantRule: []*RequiredReviewer{{Type: new("User"), Reviewer: &User{ID: new(int64(1)), Login: new("octocat")}}}, wantError: false, }, "Team Reviewer": { data: []byte(`[{"type": "Team", "reviewer": {"id": 1, "name": "Justice League"}}]`), - wantRule: []*RequiredReviewer{{Type: Ptr("Team"), Reviewer: &Team{ID: Ptr(int64(1)), Name: Ptr("Justice League")}}}, + wantRule: []*RequiredReviewer{{Type: new("Team"), Reviewer: &Team{ID: new(int64(1)), Name: new("Justice League")}}}, wantError: false, }, "Both Types Reviewer": { data: []byte(`[{"type": "User", "reviewer": {"id": 1,"login": "octocat"}},{"type": "Team", "reviewer": {"id": 1, "name": "Justice League"}}]`), - wantRule: []*RequiredReviewer{{Type: Ptr("User"), Reviewer: &User{ID: Ptr(int64(1)), Login: Ptr("octocat")}}, {Type: Ptr("Team"), Reviewer: &Team{ID: Ptr(int64(1)), Name: Ptr("Justice League")}}}, + wantRule: []*RequiredReviewer{{Type: new("User"), Reviewer: &User{ID: new(int64(1)), Login: new("octocat")}}, {Type: new("Team"), Reviewer: &Team{ID: new(int64(1)), Name: new("Justice League")}}}, wantError: false, }, "Empty JSON Object": { @@ -63,12 +63,12 @@ func TestRequiredReviewer_UnmarshalJSON(t *testing.T) { }, "Wrong ID Type in User Object": { data: []byte(`[{"type": "User", "reviewer": {"id": "string"}}]`), - wantRule: []*RequiredReviewer{{Type: Ptr("User"), Reviewer: nil}}, + wantRule: []*RequiredReviewer{{Type: new("User"), Reviewer: nil}}, wantError: true, }, "Wrong ID Type in Team Object": { data: []byte(`[{"type": "Team", "reviewer": {"id": "string"}}]`), - wantRule: []*RequiredReviewer{{Type: Ptr("Team"), Reviewer: nil}}, + wantRule: []*RequiredReviewer{{Type: new("Team"), Reviewer: nil}}, wantError: true, }, "Wrong Type of Reviewer": { @@ -125,7 +125,7 @@ func TestRepositoriesService_ListEnvironments(t *testing.T) { if err != nil { t.Errorf("Repositories.ListEnvironments returned error: %v", err) } - want := &EnvResponse{TotalCount: Ptr(1), Environments: []*Environment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}} + want := &EnvResponse{TotalCount: new(1), Environments: []*Environment{{ID: new(int64(1))}, {ID: new(int64(2))}}} if !cmp.Equal(environments, want) { t.Errorf("Repositories.ListEnvironments returned %+v, want %+v", environments, want) } @@ -160,7 +160,7 @@ func TestRepositoriesService_GetEnvironment(t *testing.T) { t.Errorf("Repositories.GetEnvironment returned error: %v\n%v", err, resp.Body) } - want := &Environment{ID: Ptr(int64(1)), Name: Ptr("staging"), DeploymentBranchPolicy: &BranchPolicy{ProtectedBranches: Ptr(true), CustomBranchPolicies: Ptr(false)}, CanAdminsBypass: Ptr(false)} + want := &Environment{ID: new(int64(1)), Name: new("staging"), DeploymentBranchPolicy: &BranchPolicy{ProtectedBranches: new(true), CustomBranchPolicies: new(false)}, CanAdminsBypass: new(false)} if !cmp.Equal(release, want) { t.Errorf("Repositories.GetEnvironment returned %+v, want %+v", release, want) } @@ -185,12 +185,12 @@ func TestRepositoriesService_CreateEnvironment(t *testing.T) { client, mux, _ := setup(t) input := &CreateUpdateEnvironment{ - WaitTimer: Ptr(30), + WaitTimer: new(30), } mux.HandleFunc("/repos/o/r/environments/e", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - want := &CreateUpdateEnvironment{WaitTimer: Ptr(30), CanAdminsBypass: Ptr(true)} + want := &CreateUpdateEnvironment{WaitTimer: new(30), CanAdminsBypass: new(true)} testJSONBody(t, r, want) fmt.Fprint(w, `{"id": 1, "name": "staging", "protection_rules": [{"id": 1, "type": "wait_timer", "wait_timer": 30}]}`) }) @@ -201,7 +201,7 @@ func TestRepositoriesService_CreateEnvironment(t *testing.T) { t.Errorf("Repositories.CreateUpdateEnvironment returned error: %v", err) } - want := &Environment{ID: Ptr(int64(1)), Name: Ptr("staging"), ProtectionRules: []*ProtectionRule{{ID: Ptr(int64(1)), Type: Ptr("wait_timer"), WaitTimer: Ptr(30)}}} + want := &Environment{ID: new(int64(1)), Name: new("staging"), ProtectionRules: []*ProtectionRule{{ID: new(int64(1)), Type: new("wait_timer"), WaitTimer: new(30)}}} if !cmp.Equal(release, want) { t.Errorf("Repositories.CreateUpdateEnvironment returned %+v, want %+v", release, want) } @@ -246,7 +246,7 @@ func TestRepositoriesService_CreateEnvironment_noEnterprise(t *testing.T) { t.Errorf("Repositories.CreateUpdateEnvironment returned error: %v", err) } - want := &Environment{ID: Ptr(int64(1)), Name: Ptr("staging"), ProtectionRules: []*ProtectionRule{}} + want := &Environment{ID: new(int64(1)), Name: new("staging"), ProtectionRules: []*ProtectionRule{}} if !cmp.Equal(release, want) { t.Errorf("Repositories.CreateUpdateEnvironment returned %+v, want %+v", release, want) } @@ -258,8 +258,8 @@ func TestRepositoriesService_createNewEnvNoEnterprise(t *testing.T) { input := &CreateUpdateEnvironment{ DeploymentBranchPolicy: &BranchPolicy{ - ProtectedBranches: Ptr(true), - CustomBranchPolicies: Ptr(false), + ProtectedBranches: new(true), + CustomBranchPolicies: new(false), }, } @@ -276,18 +276,18 @@ func TestRepositoriesService_createNewEnvNoEnterprise(t *testing.T) { } want := &Environment{ - ID: Ptr(int64(1)), - Name: Ptr("staging"), + ID: new(int64(1)), + Name: new("staging"), ProtectionRules: []*ProtectionRule{ { - ID: Ptr(int64(1)), - NodeID: Ptr("id"), - Type: Ptr("branch_policy"), + ID: new(int64(1)), + NodeID: new("id"), + Type: new("branch_policy"), }, }, DeploymentBranchPolicy: &BranchPolicy{ - ProtectedBranches: Ptr(true), - CustomBranchPolicies: Ptr(false), + ProtectedBranches: new(true), + CustomBranchPolicies: new(false), }, } if !cmp.Equal(release, want) { diff --git a/github/repos_forks_test.go b/github/repos_forks_test.go index 393e4d669b6..bfcb9cdaada 100644 --- a/github/repos_forks_test.go +++ b/github/repos_forks_test.go @@ -38,7 +38,7 @@ func TestRepositoriesService_ListForks(t *testing.T) { t.Errorf("Repositories.ListForks returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Repository{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(repos, want) { t.Errorf("Repositories.ListForks returned %+v, want %+v", repos, want) } @@ -85,7 +85,7 @@ func TestRepositoriesService_CreateFork(t *testing.T) { t.Errorf("Repositories.CreateFork returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Repositories.CreateFork returned %+v, want %+v", repo, want) } @@ -125,7 +125,7 @@ func TestRepositoriesService_CreateFork_deferred(t *testing.T) { t.Errorf("Repositories.CreateFork returned error: %v (want AcceptedError)", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Repositories.CreateFork returned %+v, want %+v", repo, want) } diff --git a/github/repos_hooks_configuration_test.go b/github/repos_hooks_configuration_test.go index 81bae011c3b..abd7baf9c88 100644 --- a/github/repos_hooks_configuration_test.go +++ b/github/repos_hooks_configuration_test.go @@ -29,10 +29,10 @@ func TestRepositoriesService_GetHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: Ptr("json"), - InsecureSSL: Ptr("0"), - Secret: Ptr("********"), - URL: Ptr("https://example.com/webhook"), + ContentType: new("json"), + InsecureSSL: new("0"), + Secret: new("********"), + URL: new("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Repositories.GetHookConfiguration returned %+v, want %+v", config, want) @@ -81,10 +81,10 @@ func TestRepositoriesService_UpdateHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: Ptr("json"), - InsecureSSL: Ptr("0"), - Secret: Ptr("********"), - URL: Ptr("https://example.com/webhook"), + ContentType: new("json"), + InsecureSSL: new("0"), + Secret: new("********"), + URL: new("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Repositories.UpdateHookConfiguration returned %+v, want %+v", config, want) diff --git a/github/repos_hooks_deliveries_test.go b/github/repos_hooks_deliveries_test.go index df72de213f3..4e8853d8808 100644 --- a/github/repos_hooks_deliveries_test.go +++ b/github/repos_hooks_deliveries_test.go @@ -33,7 +33,7 @@ func TestRepositoriesService_ListHookDeliveries(t *testing.T) { t.Errorf("Repositories.ListHookDeliveries returned error: %v", err) } - want := []*HookDelivery{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*HookDelivery{{ID: new(int64(1))}, {ID: new(int64(2))}} if d := cmp.Diff(hooks, want); d != "" { t.Errorf("Repositories.ListHooks want (-), got (+):\n%v", d) } @@ -77,7 +77,7 @@ func TestRepositoriesService_GetHookDelivery(t *testing.T) { t.Errorf("Repositories.GetHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Ptr(int64(1))} + want := &HookDelivery{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.GetHookDelivery returned %+v, want %+v", hook, want) } @@ -121,7 +121,7 @@ func TestRepositoriesService_RedeliverHookDelivery(t *testing.T) { t.Errorf("Repositories.RedeliverHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Ptr(int64(1))} + want := &HookDelivery{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.RedeliverHookDelivery returned %+v, want %+v", hook, want) } @@ -238,7 +238,7 @@ func TestHookDelivery_ParsePayload_invalidEvent(t *testing.T) { p := json.RawMessage(nil) d := &HookDelivery{ - Event: Ptr("some_invalid_event"), + Event: new("some_invalid_event"), Request: &HookRequest{ RawPayload: &p, }, @@ -255,7 +255,7 @@ func TestHookDelivery_ParsePayload_invalidPayload(t *testing.T) { p := json.RawMessage([]byte(`{"check_run":{"id":"invalid"}}`)) d := &HookDelivery{ - Event: Ptr("check_run"), + Event: new("check_run"), Request: &HookRequest{ RawPayload: &p, }, diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index b35294fb5dc..29ec04efe3c 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -32,7 +32,7 @@ func TestRepositoriesService_CreateHook(t *testing.T) { t.Errorf("Repositories.CreateHook returned error: %v", err) } - want := &Hook{ID: Ptr(int64(1))} + want := &Hook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.CreateHook returned %+v, want %+v", hook, want) } @@ -74,7 +74,7 @@ func TestRepositoriesService_ListHooks(t *testing.T) { t.Errorf("Repositories.ListHooks returned error: %v", err) } - want := []*Hook{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Hook{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(hooks, want) { t.Errorf("Repositories.ListHooks returned %+v, want %+v", hooks, want) } @@ -128,7 +128,7 @@ func TestRepositoriesService_GetHook(t *testing.T) { t.Errorf("Repositories.GetHook returned error: %v", err) } - want := &Hook{ID: Ptr(int64(1))} + want := &Hook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.GetHook returned %+v, want %+v", hook, want) } @@ -176,7 +176,7 @@ func TestRepositoriesService_EditHook(t *testing.T) { t.Errorf("Repositories.EditHook returned error: %v", err) } - want := &Hook{ID: Ptr(int64(1))} + want := &Hook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.EditHook returned %+v, want %+v", hook, want) } diff --git a/github/repos_immutable_releases_test.go b/github/repos_immutable_releases_test.go index 9a5d352ba88..a6a23fa494e 100644 --- a/github/repos_immutable_releases_test.go +++ b/github/repos_immutable_releases_test.go @@ -79,7 +79,7 @@ func TestRepositoriesService_AreImmutableReleasesEnabled(t *testing.T) { if err != nil { t.Errorf("Repositories.AreImmutableReleasesEnabled returned error: %v", err) } - want := &RepoImmutableReleasesStatus{Enabled: Ptr(true), EnforcedByOwner: Ptr(false)} + want := &RepoImmutableReleasesStatus{Enabled: new(true), EnforcedByOwner: new(false)} if !cmp.Equal(status, want) { t.Errorf("Repositories.AreImmutableReleasesEnabled returned %+v, want %+v", status, want) } diff --git a/github/repos_invitations_test.go b/github/repos_invitations_test.go index 07d022a1f5c..6c78a8124c9 100644 --- a/github/repos_invitations_test.go +++ b/github/repos_invitations_test.go @@ -30,7 +30,7 @@ func TestRepositoriesService_ListInvitations(t *testing.T) { t.Errorf("Repositories.ListInvitations returned error: %v", err) } - want := []*RepositoryInvitation{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*RepositoryInvitation{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListInvitations = %+v, want %+v", got, want) } @@ -91,7 +91,7 @@ func TestRepositoriesService_UpdateInvitation(t *testing.T) { t.Errorf("Repositories.UpdateInvitation returned error: %v", err) } - want := &RepositoryInvitation{ID: Ptr(int64(1))} + want := &RepositoryInvitation{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.UpdateInvitation = %+v, want %+v", got, want) } diff --git a/github/repos_keys_test.go b/github/repos_keys_test.go index cee855a828e..c340113a235 100644 --- a/github/repos_keys_test.go +++ b/github/repos_keys_test.go @@ -30,7 +30,7 @@ func TestRepositoriesService_ListKeys(t *testing.T) { t.Errorf("Repositories.ListKeys returned error: %v", err) } - want := []*Key{{ID: Ptr(int64(1))}} + want := []*Key{{ID: new(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Repositories.ListKeys returned %+v, want %+v", keys, want) } @@ -74,7 +74,7 @@ func TestRepositoriesService_GetKey(t *testing.T) { t.Errorf("Repositories.GetKey returned error: %v", err) } - want := &Key{ID: Ptr(int64(1))} + want := &Key{ID: new(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Repositories.GetKey returned %+v, want %+v", key, want) } @@ -107,7 +107,7 @@ func TestRepositoriesService_CreateKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Key{Key: Ptr("k"), Title: Ptr("t")} + input := &Key{Key: new("k"), Title: new("t")} mux.HandleFunc("/repos/o/r/keys", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -121,7 +121,7 @@ func TestRepositoriesService_CreateKey(t *testing.T) { t.Errorf("Repositories.CreateKey returned error: %v", err) } - want := &Key{ID: Ptr(int64(1))} + want := &Key{ID: new(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Repositories.CreateKey returned %+v, want %+v", key, want) } diff --git a/github/repos_merging_test.go b/github/repos_merging_test.go index f71a65741d6..09c1e2d0dd8 100644 --- a/github/repos_merging_test.go +++ b/github/repos_merging_test.go @@ -20,7 +20,7 @@ func TestRepositoriesService_Merge(t *testing.T) { input := RepositoryMergeRequest{ Base: "b", Head: "h", - CommitMessage: Ptr("c"), + CommitMessage: new("c"), } mux.HandleFunc("/repos/o/r/merges", func(w http.ResponseWriter, r *http.Request) { @@ -35,7 +35,7 @@ func TestRepositoriesService_Merge(t *testing.T) { t.Errorf("Repositories.Merge returned error: %v", err) } - want := &RepositoryCommit{SHA: Ptr("s")} + want := &RepositoryCommit{SHA: new("s")} if !cmp.Equal(commit, want) { t.Errorf("Repositories.Merge returned %+v, want %+v", commit, want) } @@ -75,7 +75,7 @@ func TestRepositoriesService_MergeUpstream(t *testing.T) { t.Errorf("Repositories.MergeUpstream returned error: %v", err) } - want := &RepoMergeUpstreamResult{MergeType: Ptr("m")} + want := &RepoMergeUpstreamResult{MergeType: new("m")} if !cmp.Equal(result, want) { t.Errorf("Repositories.MergeUpstream returned %+v, want %+v", result, want) } diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 227cbcb688b..2b404ff5d35 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -18,18 +18,18 @@ func TestRepositoriesService_EnablePagesLegacy(t *testing.T) { client, mux, _ := setup(t) input := &Pages{ - BuildType: Ptr("legacy"), + BuildType: new("legacy"), Source: &PagesSource{ - Branch: Ptr("master"), - Path: Ptr("/"), + Branch: new("master"), + Path: new("/"), }, - CNAME: Ptr("www.example.com"), // not passed along. + CNAME: new("www.example.com"), // not passed along. } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) - want := &createPagesRequest{BuildType: Ptr("legacy"), Source: &PagesSource{Branch: Ptr("master"), Path: Ptr("/")}} + want := &createPagesRequest{BuildType: new("legacy"), Source: &PagesSource{Branch: new("master"), Path: new("/")}} testJSONBody(t, r, want) fmt.Fprint(w, `{"url":"u","status":"s","cname":"c","custom_404":false,"html_url":"h","build_type": "legacy","source": {"branch":"master", "path":"/"}}`) @@ -41,7 +41,7 @@ func TestRepositoriesService_EnablePagesLegacy(t *testing.T) { t.Errorf("Repositories.EnablePages returned error: %v", err) } - want := &Pages{URL: Ptr("u"), Status: Ptr("s"), CNAME: Ptr("c"), Custom404: Ptr(false), HTMLURL: Ptr("h"), BuildType: Ptr("legacy"), Source: &PagesSource{Branch: Ptr("master"), Path: Ptr("/")}} + want := &Pages{URL: new("u"), Status: new("s"), CNAME: new("c"), Custom404: new(false), HTMLURL: new("h"), BuildType: new("legacy"), Source: &PagesSource{Branch: new("master"), Path: new("/")}} if !cmp.Equal(page, want) { t.Errorf("Repositories.EnablePages returned %v, want %v", page, want) @@ -71,14 +71,14 @@ func TestRepositoriesService_EnablePagesWorkflow(t *testing.T) { client, mux, _ := setup(t) input := &Pages{ - BuildType: Ptr("workflow"), - CNAME: Ptr("www.example.com"), // not passed along. + BuildType: new("workflow"), + CNAME: new("www.example.com"), // not passed along. } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) - want := &createPagesRequest{BuildType: Ptr("workflow")} + want := &createPagesRequest{BuildType: new("workflow")} testJSONBody(t, r, want) fmt.Fprint(w, `{"url":"u","status":"s","cname":"c","custom_404":false,"html_url":"h","build_type": "workflow"}`) }) @@ -89,7 +89,7 @@ func TestRepositoriesService_EnablePagesWorkflow(t *testing.T) { t.Errorf("Repositories.EnablePages returned error: %v", err) } - want := &Pages{URL: Ptr("u"), Status: Ptr("s"), CNAME: Ptr("c"), Custom404: Ptr(false), HTMLURL: Ptr("h"), BuildType: Ptr("workflow")} + want := &Pages{URL: new("u"), Status: new("s"), CNAME: new("c"), Custom404: new(false), HTMLURL: new("h"), BuildType: new("workflow")} if !cmp.Equal(page, want) { t.Errorf("Repositories.EnablePages returned %v, want %v", page, want) @@ -115,9 +115,9 @@ func TestRepositoriesService_UpdatePagesLegacy(t *testing.T) { client, mux, _ := setup(t) input := &PagesUpdate{ - CNAME: Ptr("www.example.com"), - BuildType: Ptr("legacy"), - Source: &PagesSource{Branch: Ptr("gh-pages")}, + CNAME: new("www.example.com"), + BuildType: new("legacy"), + Source: &PagesSource{Branch: new("gh-pages")}, } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -148,8 +148,8 @@ func TestRepositoriesService_UpdatePagesWorkflow(t *testing.T) { client, mux, _ := setup(t) input := &PagesUpdate{ - CNAME: Ptr("www.example.com"), - BuildType: Ptr("workflow"), + CNAME: new("www.example.com"), + BuildType: new("workflow"), } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -180,7 +180,7 @@ func TestRepositoriesService_UpdatePagesGHES(t *testing.T) { client, mux, _ := setup(t) input := &PagesUpdateWithoutCNAME{ - BuildType: Ptr("workflow"), + BuildType: new("workflow"), } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -211,7 +211,7 @@ func TestRepositoriesService_UpdatePages_NullCNAME(t *testing.T) { client, mux, _ := setup(t) input := &PagesUpdate{ - Source: &PagesSource{Branch: Ptr("gh-pages")}, + Source: &PagesSource{Branch: new("gh-pages")}, } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -268,7 +268,7 @@ func TestRepositoriesService_GetPagesInfo(t *testing.T) { t.Errorf("Repositories.GetPagesInfo returned error: %v", err) } - want := &Pages{URL: Ptr("u"), Status: Ptr("s"), CNAME: Ptr("c"), Custom404: Ptr(false), HTMLURL: Ptr("h"), Public: Ptr(true), HTTPSCertificate: &PagesHTTPSCertificate{State: Ptr("approved"), Description: Ptr("Certificate is approved"), Domains: []string{"developer.github.com"}, ExpiresAt: Ptr("2021-05-22")}, HTTPSEnforced: Ptr(true)} + want := &Pages{URL: new("u"), Status: new("s"), CNAME: new("c"), Custom404: new(false), HTMLURL: new("h"), Public: new(true), HTTPSCertificate: &PagesHTTPSCertificate{State: new("approved"), Description: new("Certificate is approved"), Domains: []string{"developer.github.com"}, ExpiresAt: new("2021-05-22")}, HTTPSEnforced: new(true)} if !cmp.Equal(page, want) { t.Errorf("Repositories.GetPagesInfo returned %+v, want %+v", page, want) } @@ -303,7 +303,7 @@ func TestRepositoriesService_ListPagesBuilds(t *testing.T) { t.Errorf("Repositories.ListPagesBuilds returned error: %v", err) } - want := []*PagesBuild{{URL: Ptr("u"), Status: Ptr("s"), Commit: Ptr("c")}} + want := []*PagesBuild{{URL: new("u"), Status: new("s"), Commit: new("c")}} if !cmp.Equal(pages, want) { t.Errorf("Repositories.ListPagesBuilds returned %+v, want %+v", pages, want) } @@ -357,7 +357,7 @@ func TestRepositoriesService_GetLatestPagesBuild(t *testing.T) { t.Errorf("Repositories.GetLatestPagesBuild returned error: %v", err) } - want := &PagesBuild{URL: Ptr("u"), Status: Ptr("s"), Commit: Ptr("c")} + want := &PagesBuild{URL: new("u"), Status: new("s"), Commit: new("c")} if !cmp.Equal(build, want) { t.Errorf("Repositories.GetLatestPagesBuild returned %+v, want %+v", build, want) } @@ -392,7 +392,7 @@ func TestRepositoriesService_GetPageBuild(t *testing.T) { t.Errorf("Repositories.GetPageBuild returned error: %v", err) } - want := &PagesBuild{URL: Ptr("u"), Status: Ptr("s"), Commit: Ptr("c")} + want := &PagesBuild{URL: new("u"), Status: new("s"), Commit: new("c")} if !cmp.Equal(build, want) { t.Errorf("Repositories.GetPageBuild returned %+v, want %+v", build, want) } @@ -427,7 +427,7 @@ func TestRepositoriesService_RequestPageBuild(t *testing.T) { t.Errorf("Repositories.RequestPageBuild returned error: %v", err) } - want := &PagesBuild{URL: Ptr("u"), Status: Ptr("s")} + want := &PagesBuild{URL: new("u"), Status: new("s")} if !cmp.Equal(build, want) { t.Errorf("Repositories.RequestPageBuild returned %+v, want %+v", build, want) } @@ -464,16 +464,16 @@ func TestRepositoriesService_GetPageHealthCheck(t *testing.T) { want := &PagesHealthCheckResponse{ Domain: &PagesDomain{ - Host: Ptr("example.com"), - URI: Ptr("http://example.com/"), - Nameservers: Ptr("default"), - DNSResolves: Ptr(true), + Host: new("example.com"), + URI: new("http://example.com/"), + Nameservers: new("default"), + DNSResolves: new(true), }, AltDomain: &PagesDomain{ - Host: Ptr("www.example.com"), - URI: Ptr("http://www.example.com/"), - Nameservers: Ptr("default"), - DNSResolves: Ptr(true), + Host: new("www.example.com"), + URI: new("http://www.example.com/"), + Nameservers: new("default"), + DNSResolves: new(true), }, } if !cmp.Equal(healthCheckResponse, want) { diff --git a/github/repos_prereceive_hooks_test.go b/github/repos_prereceive_hooks_test.go index 15ee94702aa..9b34b67aa7e 100644 --- a/github/repos_prereceive_hooks_test.go +++ b/github/repos_prereceive_hooks_test.go @@ -32,7 +32,7 @@ func TestRepositoriesService_ListPreReceiveHooks(t *testing.T) { t.Errorf("Repositories.ListPreReceiveHooks returned error: %v", err) } - want := []*PreReceiveHook{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*PreReceiveHook{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(hooks, want) { t.Errorf("Repositories.ListPreReceiveHooks returned %+v, want %+v", hooks, want) } @@ -77,7 +77,7 @@ func TestRepositoriesService_GetPreReceiveHook(t *testing.T) { t.Errorf("Repositories.GetPreReceiveHook returned error: %v", err) } - want := &PreReceiveHook{ID: Ptr(int64(1))} + want := &PreReceiveHook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.GetPreReceiveHook returned %+v, want %+v", hook, want) } @@ -110,7 +110,7 @@ func TestRepositoriesService_UpdatePreReceiveHook(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdatePreReceiveHookRequest{Enforcement: Ptr("enabled")} + input := UpdatePreReceiveHookRequest{Enforcement: new("enabled")} mux.HandleFunc("/repos/o/r/pre-receive-hooks/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -124,7 +124,7 @@ func TestRepositoriesService_UpdatePreReceiveHook(t *testing.T) { t.Errorf("Repositories.UpdatePreReceiveHook returned error: %v", err) } - want := &PreReceiveHook{ID: Ptr(int64(1))} + want := &PreReceiveHook{ID: new(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.UpdatePreReceiveHook returned %+v, want %+v", hook, want) } diff --git a/github/repos_releases_test.go b/github/repos_releases_test.go index 1a0b9d3aabd..9363aaa081f 100644 --- a/github/repos_releases_test.go +++ b/github/repos_releases_test.go @@ -109,7 +109,7 @@ func TestRepositoriesService_GetRelease(t *testing.T) { t.Errorf("Repositories.GetRelease returned error: %v\n%v", err, resp.Body) } - want := &RepositoryRelease{ID: 1, Author: &User{Login: Ptr("l")}} + want := &RepositoryRelease{ID: 1, Author: &User{Login: new("l")}} if !cmp.Equal(release, want) { t.Errorf("Repositories.GetRelease returned %+v, want %+v", release, want) } @@ -205,9 +205,9 @@ func TestRepositoriesService_CreateRelease(t *testing.T) { input := CreateReleaseRequest{ TagName: "v1.0", - Name: Ptr("v1.0"), - DiscussionCategoryName: Ptr("General"), - GenerateReleaseNotes: Ptr(true), + Name: new("v1.0"), + DiscussionCategoryName: new("General"), + GenerateReleaseNotes: new(true), } mux.HandleFunc("/repos/o/r/releases", func(w http.ResponseWriter, r *http.Request) { @@ -247,8 +247,8 @@ func TestRepositoriesService_UpdateRelease(t *testing.T) { client, mux, _ := setup(t) input := UpdateReleaseRequest{ - Name: Ptr("n"), - DiscussionCategoryName: Ptr("General"), + Name: new("n"), + DiscussionCategoryName: new("General"), } mux.HandleFunc("/repos/o/r/releases/1", func(w http.ResponseWriter, r *http.Request) { @@ -323,7 +323,7 @@ func TestRepositoriesService_ListReleaseAssets(t *testing.T) { if err != nil { t.Errorf("Repositories.ListReleaseAssets returned error: %v", err) } - want := []*ReleaseAsset{{ID: Ptr(int64(1))}} + want := []*ReleaseAsset{{ID: new(int64(1))}} if !cmp.Equal(assets, want) { t.Errorf("Repositories.ListReleaseAssets returned %+v, want %+v", assets, want) } @@ -357,7 +357,7 @@ func TestRepositoriesService_GetReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.GetReleaseAsset returned error: %v", err) } - want := &ReleaseAsset{ID: Ptr(int64(1))} + want := &ReleaseAsset{ID: new(int64(1))} if !cmp.Equal(asset, want) { t.Errorf("Repositories.GetReleaseAsset returned %+v, want %+v", asset, want) } @@ -568,7 +568,7 @@ func TestRepositoriesService_UpdateReleaseAsset(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateReleaseAssetRequest{Name: Ptr("n")} + input := UpdateReleaseAssetRequest{Name: new("n")} mux.HandleFunc("/repos/o/r/releases/assets/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -581,7 +581,7 @@ func TestRepositoriesService_UpdateReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.UpdateReleaseAsset returned error: %v", err) } - want := &ReleaseAsset{ID: Ptr(int64(1))} + want := &ReleaseAsset{ID: new(int64(1))} if !cmp.Equal(asset, want) { t.Errorf("Repositories.UpdateReleaseAsset returned = %+v, want %+v", asset, want) } @@ -704,7 +704,7 @@ func TestRepositoriesService_UploadReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.UploadReleaseAsset returned error: %v", err) } - want := &ReleaseAsset{ID: Ptr(int64(1))} + want := &ReleaseAsset{ID: new(int64(1))} if !cmp.Equal(asset, want) { t.Errorf("Repositories.UploadReleaseAsset returned %+v, want %+v", asset, want) } @@ -764,7 +764,7 @@ func TestRepositoriesService_UploadReleaseAssetFromRelease(t *testing.T) { if err != nil { t.Fatalf("Repositories.UploadReleaseAssetFromRelease returned error: %v", err) } - want := &ReleaseAsset{ID: Ptr(int64(1))} + want := &ReleaseAsset{ID: new(int64(1))} if !cmp.Equal(asset, want) { t.Fatalf("Repositories.UploadReleaseAssetFromRelease returned %+v, want %+v", asset, want) } @@ -794,7 +794,7 @@ func TestRepositoriesService_UploadReleaseAssetFromRelease_AbsoluteTemplate(t *t if err != nil { t.Fatalf("UploadReleaseAssetFromRelease returned error: %v", err) } - want := &ReleaseAsset{ID: Ptr(int64(1))} + want := &ReleaseAsset{ID: new(int64(1))} if !cmp.Equal(asset, want) { t.Fatalf("UploadReleaseAssetFromRelease returned %+v, want %+v", asset, want) } @@ -878,7 +878,7 @@ func TestRepositoriesService_UploadReleaseAssetFromRelease_NoOpts(t *testing.T) if err != nil { t.Fatalf("unexpected error: %v", err) } - want := &ReleaseAsset{ID: Ptr(int64(1))} + want := &ReleaseAsset{ID: new(int64(1))} if !cmp.Equal(asset, want) { t.Fatalf("Repositories.UploadReleaseAssetFromRelease returned %+v, want %+v", asset, want) } @@ -917,7 +917,7 @@ func TestRepositoriesService_UploadReleaseAssetFromRelease_WithMediaType(t *test if err != nil { t.Fatalf("unexpected error: %v", err) } - want := &ReleaseAsset{ID: Ptr(int64(1))} + want := &ReleaseAsset{ID: new(int64(1))} if !cmp.Equal(asset, want) { t.Fatalf("UploadReleaseAssetFromRelease returned %+v, want %+v", asset, want) } diff --git a/github/repos_rules.go b/github/repos_rules.go index 3baf0f64992..22c555313ef 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -49,7 +49,7 @@ func (s *RepositoriesService) ListRulesForBranchIter(ctx context.Context, owner, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { diff --git a/github/repos_rules_test.go b/github/repos_rules_test.go index 33df6ab4857..bae001a69f7 100644 --- a/github/repos_rules_test.go +++ b/github/repos_rules_test.go @@ -278,18 +278,18 @@ func TestRepositoriesService_GetAllRulesets(t *testing.T) { want := []*RepositoryRuleset{ { - ID: Ptr(int64(42)), + ID: new(int64(42)), Name: "ruleset", - SourceType: Ptr(RulesetSourceTypeRepository), + SourceType: new(RulesetSourceTypeRepository), Source: "o/repo", Enforcement: RulesetEnforcementActive, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, { - ID: Ptr(int64(314)), + ID: new(int64(314)), Name: "Another ruleset", - SourceType: Ptr(RulesetSourceTypeRepository), + SourceType: new(RulesetSourceTypeRepository), Source: "o/repo", Enforcement: RulesetEnforcementActive, CreatedAt: &Timestamp{referenceTime}, @@ -329,7 +329,7 @@ func TestRepositoriesService_GetAllRulesets_ListOptions(t *testing.T) { }) opts := &RepositoryListRulesetsOptions{ - IncludesParents: Ptr(false), + IncludesParents: new(false), ListOptions: ListOptions{ Page: 2, PerPage: 35, @@ -343,7 +343,7 @@ func TestRepositoriesService_GetAllRulesets_ListOptions(t *testing.T) { want := []*RepositoryRuleset{ { - ID: Ptr(int64(42)), + ID: new(int64(42)), }, } if !cmp.Equal(ruleSet, want) { @@ -390,9 +390,9 @@ func TestRepositoriesService_CreateRuleset(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(42)), + ID: new(int64(42)), Name: "ruleset", - SourceType: Ptr(RulesetSourceTypeRepository), + SourceType: new(RulesetSourceTypeRepository), Source: "o/repo", Enforcement: RulesetEnforcementActive, } @@ -463,11 +463,11 @@ func TestRepositoriesService_CreateRulesetWithPushRules(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(42)), + ID: new(int64(42)), Name: "ruleset", - SourceType: Ptr(RulesetSourceTypeRepository), + SourceType: new(RulesetSourceTypeRepository), Source: "o/repo", - Target: Ptr(RulesetTargetPush), + Target: new(RulesetTargetPush), Enforcement: RulesetEnforcementActive, Rules: &RepositoryRulesetRules{ FilePathRestriction: &FilePathRestrictionRuleParameters{RestrictedFilePaths: []string{"/a/file"}}, @@ -515,9 +515,9 @@ func TestRepositoriesService_GetRuleset(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(42)), + ID: new(int64(42)), Name: "ruleset", - SourceType: Ptr(RulesetSourceTypeOrganization), + SourceType: new(RulesetSourceTypeOrganization), Source: "o", Enforcement: RulesetEnforcementActive, CreatedAt: &Timestamp{referenceTime}, @@ -563,9 +563,9 @@ func TestRepositoriesService_UpdateRuleset(t *testing.T) { } want := &RepositoryRuleset{ - ID: Ptr(int64(42)), + ID: new(int64(42)), Name: "ruleset", - SourceType: Ptr(RulesetSourceTypeRepository), + SourceType: new(RulesetSourceTypeRepository), Source: "o/repo", Enforcement: "active", } diff --git a/github/repos_stats.go b/github/repos_stats.go index 8234886f0ad..32156a34c56 100644 --- a/github/repos_stats.go +++ b/github/repos_stats.go @@ -139,8 +139,8 @@ func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo } stat := &WeeklyStats{ Week: &Timestamp{time.Unix(int64(week[0]), 0)}, - Additions: Ptr(week[1]), - Deletions: Ptr(week[2]), + Additions: new(week[1]), + Deletions: new(week[2]), } stats = append(stats, stat) } @@ -231,9 +231,9 @@ func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo str continue } card := &PunchCard{ - Day: Ptr(result[0]), - Hour: Ptr(result[1]), - Commits: Ptr(result[2]), + Day: new(result[0]), + Hour: new(result[1]), + Commits: new(result[2]), } cards = append(cards, card) } diff --git a/github/repos_stats_test.go b/github/repos_stats_test.go index 77eb5e23d2b..525ca868a27 100644 --- a/github/repos_stats_test.go +++ b/github/repos_stats_test.go @@ -51,16 +51,16 @@ func TestRepositoriesService_ListContributorsStats(t *testing.T) { want := []*ContributorStats{ { Author: &Contributor{ - ID: Ptr(int64(1)), - NodeID: Ptr("nodeid-1"), + ID: new(int64(1)), + NodeID: new("nodeid-1"), }, - Total: Ptr(135), + Total: new(135), Weeks: []*WeeklyStats{ { Week: &referenceTimestamp, - Additions: Ptr(6898), - Deletions: Ptr(77), - Commits: Ptr(10), + Additions: new(6898), + Deletions: new(77), + Commits: new(10), }, }, }, @@ -112,7 +112,7 @@ func TestRepositoriesService_ListCommitActivity(t *testing.T) { want := []*WeeklyCommitActivity{ { Days: []int{0, 3, 26, 20, 39, 1, 0}, - Total: Ptr(89), + Total: new(89), Week: &referenceTimestamp, }, } @@ -154,8 +154,8 @@ func TestRepositoriesService_ListCodeFrequency(t *testing.T) { want := []*WeeklyStats{{ Week: &referenceTimestamp, - Additions: Ptr(1124), - Deletions: Ptr(-435), + Additions: new(1124), + Deletions: new(-435), }} if !cmp.Equal(code, want) { @@ -263,9 +263,9 @@ func TestRepositoriesService_ListPunchCard(t *testing.T) { } want := []*PunchCard{ - {Day: Ptr(0), Hour: Ptr(0), Commits: Ptr(5)}, - {Day: Ptr(0), Hour: Ptr(1), Commits: Ptr(43)}, - {Day: Ptr(0), Hour: Ptr(2), Commits: Ptr(21)}, + {Day: new(0), Hour: new(0), Commits: new(5)}, + {Day: new(0), Hour: new(1), Commits: new(43)}, + {Day: new(0), Hour: new(2), Commits: new(21)}, } if !cmp.Equal(card, want) { diff --git a/github/repos_statuses_test.go b/github/repos_statuses_test.go index a48e5229d2d..25dc44496c8 100644 --- a/github/repos_statuses_test.go +++ b/github/repos_statuses_test.go @@ -30,7 +30,7 @@ func TestRepositoriesService_ListStatuses(t *testing.T) { t.Errorf("Repositories.ListStatuses returned error: %v", err) } - want := []*RepoStatus{{ID: Ptr(int64(1))}} + want := []*RepoStatus{{ID: new(int64(1))}} if !cmp.Equal(statuses, want) { t.Errorf("Repositories.ListStatuses returned %+v, want %+v", statuses, want) } @@ -63,7 +63,7 @@ func TestRepositoriesService_CreateStatus(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := RepoStatus{State: Ptr("s"), TargetURL: Ptr("t"), Description: Ptr("d")} + input := RepoStatus{State: new("s"), TargetURL: new("t"), Description: new("d")} mux.HandleFunc("/repos/o/r/statuses/r", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -77,7 +77,7 @@ func TestRepositoriesService_CreateStatus(t *testing.T) { t.Errorf("Repositories.CreateStatus returned error: %v", err) } - want := &RepoStatus{ID: Ptr(int64(1))} + want := &RepoStatus{ID: new(int64(1))} if !cmp.Equal(status, want) { t.Errorf("Repositories.CreateStatus returned %+v, want %+v", status, want) } @@ -123,7 +123,7 @@ func TestRepositoriesService_GetCombinedStatus(t *testing.T) { t.Errorf("Repositories.GetCombinedStatus returned error: %v", err) } - want := &CombinedStatus{State: Ptr("success"), Statuses: []*RepoStatus{{ID: Ptr(int64(1))}}} + want := &CombinedStatus{State: new("success"), Statuses: []*RepoStatus{{ID: new(int64(1))}}} if !cmp.Equal(status, want) { t.Errorf("Repositories.GetCombinedStatus returned %+v, want %+v", status, want) } diff --git a/github/repos_tags_test.go b/github/repos_tags_test.go index c92f3ff3c9d..fa6316fd1a3 100644 --- a/github/repos_tags_test.go +++ b/github/repos_tags_test.go @@ -29,7 +29,7 @@ func TestRepositoriesService_ListTagProtection(t *testing.T) { t.Errorf("Repositories.ListTagProtection returned error: %v", err) } - want := []*TagProtection{{ID: Ptr(int64(1)), Pattern: Ptr("tag1")}, {ID: Ptr(int64(2)), Pattern: Ptr("tag2")}} + want := []*TagProtection{{ID: new(int64(1)), Pattern: new("tag1")}, {ID: new(int64(2)), Pattern: new("tag2")}} if !cmp.Equal(tagProtections, want) { t.Errorf("Repositories.ListTagProtection returned %+v, want %+v", tagProtections, want) } @@ -77,7 +77,7 @@ func TestRepositoriesService_CreateTagProtection(t *testing.T) { t.Errorf("Repositories.CreateTagProtection returned error: %v", err) } - want := &TagProtection{ID: Ptr(int64(1)), Pattern: Ptr("tag*")} + want := &TagProtection{ID: new(int64(1)), Pattern: new("tag*")} if !cmp.Equal(got, want) { t.Errorf("Repositories.CreateTagProtection returned %+v, want %+v", got, want) } diff --git a/github/repos_test.go b/github/repos_test.go index 8b4c558a0a5..7d66533bfa1 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -32,7 +32,7 @@ func TestRepositoriesService_ListByAuthenticatedUser(t *testing.T) { t.Errorf("Repositories.ListByAuthenticatedUser returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*Repository{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListByAuthenticatedUser returned %+v, want %+v", got, want) } @@ -73,7 +73,7 @@ func TestRepositoriesService_ListByUser(t *testing.T) { t.Errorf("Repositories.ListByUser returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(repos, want) { t.Errorf("Repositories.ListByUser returned %+v, want %+v", repos, want) } @@ -114,7 +114,7 @@ func TestRepositoriesService_ListByUser_type(t *testing.T) { t.Errorf("Repositories.ListByUser returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(repos, want) { t.Errorf("Repositories.ListByUser returned %+v, want %+v", repos, want) } @@ -154,7 +154,7 @@ func TestRepositoriesService_ListByOrg(t *testing.T) { t.Errorf("Repositories.ListByOrg returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListByOrg returned %+v, want %+v", got, want) } @@ -202,7 +202,7 @@ func TestRepositoriesService_ListAll(t *testing.T) { t.Errorf("Repositories.ListAll returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListAll returned %+v, want %+v", got, want) } @@ -222,15 +222,15 @@ func TestRepositoriesService_Create_user(t *testing.T) { client, mux, _ := setup(t) input := &Repository{ - Name: Ptr("n"), - Archived: Ptr(true), // not passed along. + Name: new("n"), + Archived: new(true), // not passed along. } wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) - want := &createRepoRequest{Name: Ptr("n")} + want := &createRepoRequest{Name: new("n")} testJSONBody(t, r, want) fmt.Fprint(w, `{"id":1}`) @@ -242,7 +242,7 @@ func TestRepositoriesService_Create_user(t *testing.T) { t.Errorf("Repositories.Create returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.Create returned %+v, want %+v", got, want) } @@ -271,15 +271,15 @@ func TestRepositoriesService_Create_org(t *testing.T) { client, mux, _ := setup(t) input := &Repository{ - Name: Ptr("n"), - Archived: Ptr(true), // not passed along. + Name: new("n"), + Archived: new(true), // not passed along. } wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) - want := &createRepoRequest{Name: Ptr("n")} + want := &createRepoRequest{Name: new("n")} testJSONBody(t, r, want) fmt.Fprint(w, `{"id":1}`) }) @@ -290,7 +290,7 @@ func TestRepositoriesService_Create_org(t *testing.T) { t.Errorf("Repositories.Create returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Repositories.Create returned %+v, want %+v", repo, want) } @@ -301,7 +301,7 @@ func TestRepositoriesService_Create_withCustomProperties(t *testing.T) { client, mux, _ := setup(t) input := &Repository{ - Name: Ptr("n"), + Name: new("n"), CustomProperties: map[string]any{ "environment": "production", "team": "backend", @@ -314,7 +314,7 @@ func TestRepositoriesService_Create_withCustomProperties(t *testing.T) { testMethod(t, r, "POST") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) want := &createRepoRequest{ - Name: Ptr("n"), + Name: new("n"), CustomProperties: map[string]any{ "environment": "production", "team": "backend", @@ -331,7 +331,7 @@ func TestRepositoriesService_Create_withCustomProperties(t *testing.T) { t.Errorf("Repositories.Create returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Repositories.Create returned %+v, want %+v", repo, want) } @@ -358,7 +358,7 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) { t.Errorf("Repositories.CreateFromTemplate returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n")} + want := &Repository{ID: new(int64(1)), Name: new("n")} if !cmp.Equal(got, want) { t.Errorf("Repositories.CreateFromTemplate returned %+v, want %+v", got, want) } @@ -395,7 +395,7 @@ func TestRepositoriesService_Get(t *testing.T) { t.Errorf("Repositories.Get returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), Owner: &User{Login: Ptr("l")}, License: &License{Key: Ptr("mit")}, SecurityAndAnalysis: &SecurityAndAnalysis{AdvancedSecurity: &AdvancedSecurity{Status: Ptr("enabled")}, SecretScanning: &SecretScanning{Ptr("enabled")}, SecretScanningPushProtection: &SecretScanningPushProtection{Ptr("enabled")}, DependabotSecurityUpdates: &DependabotSecurityUpdates{Ptr("enabled")}, SecretScanningValidityChecks: &SecretScanningValidityChecks{Ptr("enabled")}, CodeSecurity: &CodeSecurity{Ptr("enabled")}}} + want := &Repository{ID: new(int64(1)), Name: new("n"), Description: new("d"), Owner: &User{Login: new("l")}, License: &License{Key: new("mit")}, SecurityAndAnalysis: &SecurityAndAnalysis{AdvancedSecurity: &AdvancedSecurity{Status: new("enabled")}, SecretScanning: &SecretScanning{new("enabled")}, SecretScanningPushProtection: &SecretScanningPushProtection{new("enabled")}, DependabotSecurityUpdates: &DependabotSecurityUpdates{new("enabled")}, SecretScanningValidityChecks: &SecretScanningValidityChecks{new("enabled")}, CodeSecurity: &CodeSecurity{new("enabled")}}} if !cmp.Equal(got, want) { t.Errorf("Repositories.Get returned %+v, want %+v", got, want) } @@ -439,10 +439,10 @@ func TestRepositoriesService_GetCodeOfConduct(t *testing.T) { } want := &CodeOfConduct{ - Key: Ptr("key"), - Name: Ptr("name"), - URL: Ptr("url"), - Body: Ptr("body"), + Key: new("key"), + Name: new("name"), + URL: new("url"), + Body: new("body"), } if !cmp.Equal(got, want) { @@ -479,7 +479,7 @@ func TestRepositoriesService_GetByID(t *testing.T) { t.Fatalf("Repositories.GetByID returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), Owner: &User{Login: Ptr("l")}, License: &License{Key: Ptr("mit")}} + want := &Repository{ID: new(int64(1)), Name: new("n"), Description: new("d"), Owner: &User{Login: new("l")}, License: &License{Key: new("mit")}} if !cmp.Equal(got, want) { t.Errorf("Repositories.GetByID returned %+v, want %+v", got, want) } @@ -498,7 +498,7 @@ func TestRepositoriesService_Edit(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Repository{HasIssues: Ptr(true)} + input := &Repository{HasIssues: new(true)} wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) { @@ -514,7 +514,7 @@ func TestRepositoriesService_Edit(t *testing.T) { t.Errorf("Repositories.Edit returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.Edit returned %+v, want %+v", got, want) } @@ -699,8 +699,8 @@ func TestRepositoriesService_GetAutomatedSecurityFixes(t *testing.T) { } want := &AutomatedSecurityFixes{ - Enabled: Ptr(true), - Paused: Ptr(false), + Enabled: new(true), + Paused: new(false), } if !cmp.Equal(fixes, want) { t.Errorf("Repositories.GetAutomatedSecurityFixes returned %#v, want %#v", fixes, want) @@ -756,7 +756,7 @@ func TestRepositoriesService_ListContributors(t *testing.T) { t.Errorf("Repositories.ListContributors returned error: %v", err) } - want := []*Contributor{{Contributions: Ptr(42)}} + want := []*Contributor{{Contributions: new(42)}} if !cmp.Equal(contributors, want) { t.Errorf("Repositories.ListContributors returned %+v, want %+v", contributors, want) } @@ -828,7 +828,7 @@ func TestRepositoriesService_ListTeams(t *testing.T) { t.Errorf("Repositories.ListTeams returned error: %v", err) } - want := []*Team{{ID: Ptr(int64(1))}} + want := []*Team{{ID: new(int64(1))}} if !cmp.Equal(teams, want) { t.Errorf("Repositories.ListTeams returned %+v, want %+v", teams, want) } @@ -867,13 +867,13 @@ func TestRepositoriesService_ListTags(t *testing.T) { want := []*RepositoryTag{ { - Name: Ptr("n"), + Name: new("n"), Commit: &Commit{ - SHA: Ptr("s"), - URL: Ptr("u"), + SHA: new("s"), + URL: new("u"), }, - ZipballURL: Ptr("z"), - TarballURL: Ptr("t"), + ZipballURL: new("z"), + TarballURL: new("t"), }, } if !cmp.Equal(tags, want) { @@ -915,7 +915,7 @@ func TestRepositoriesService_ListBranches(t *testing.T) { t.Errorf("Repositories.ListBranches returned error: %v", err) } - want := []*Branch{{Name: Ptr("master"), Commit: &RepositoryCommit{SHA: Ptr("a57781"), URL: Ptr("https://api.github.com/repos/o/r/commits/a57781")}}} + want := []*Branch{{Name: new("master"), Commit: &RepositoryCommit{SHA: new("a57781"), URL: new("https://api.github.com/repos/o/r/commits/a57781")}}} if !cmp.Equal(branches, want) { t.Errorf("Repositories.ListBranches returned %+v, want %+v", branches, want) } @@ -960,14 +960,14 @@ func TestRepositoriesService_GetBranch(t *testing.T) { } want := &Branch{ - Name: Ptr("n"), + Name: new("n"), Commit: &RepositoryCommit{ - SHA: Ptr("s"), + SHA: new("s"), Commit: &Commit{ - Message: Ptr("m"), + Message: new("m"), }, }, - Protected: Ptr(true), + Protected: new(true), Protection: &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Contexts: &[]string{"c"}, @@ -1038,14 +1038,14 @@ func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t } want := &Branch{ - Name: Ptr("n"), + Name: new("n"), Commit: &RepositoryCommit{ - SHA: Ptr("s"), + SHA: new("s"), Commit: &Commit{ - Message: Ptr("m"), + Message: new("m"), }, }, - Protected: Ptr(true), + Protected: new(true), Protection: &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Contexts: &[]string{"c"}, @@ -1129,7 +1129,7 @@ func TestRepositoriesService_RenameBranch(t *testing.T) { t.Errorf("Repositories.RenameBranch returned error: %v", err) } - want := &Branch{Name: Ptr("nn"), Protected: Ptr(true)} + want := &Branch{Name: new("nn"), Protected: new(true)} if !cmp.Equal(got, want) { t.Errorf("Repositories.RenameBranch returned %+v, want %+v", got, want) } @@ -1245,13 +1245,13 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(3))}, + {Login: new("u"), ID: new(int64(3))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(4))}, + {Slug: new("t"), ID: new(int64(4))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(5))}, + {Slug: new("a"), ID: new(int64(5))}, }, }, RequireCodeOwnerReviews: true, @@ -1264,26 +1264,26 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, RequiredConversationResolution: &RequiredConversationResolution{ Enabled: true, }, BlockCreations: &BlockCreations{ - Enabled: Ptr(false), + Enabled: new(false), }, LockBranch: &LockBranch{ - Enabled: Ptr(false), + Enabled: new(false), }, AllowForkSyncing: &AllowForkSyncing{ - Enabled: Ptr(false), + Enabled: new(false), }, } if !cmp.Equal(protection, want) { @@ -1379,10 +1379,10 @@ func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *test }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, }, } @@ -1469,9 +1469,9 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { Teams: []string{"t"}, Apps: []string{"a"}, }, - BlockCreations: Ptr(true), - LockBranch: Ptr(true), - AllowForkSyncing: Ptr(true), + BlockCreations: new(true), + LockBranch: new(true), + AllowForkSyncing: new(true), } mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { @@ -1550,47 +1550,47 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("uu"), ID: Ptr(int64(3))}, + {Login: new("uu"), ID: new(int64(3))}, }, Teams: []*Team{ - {Slug: Ptr("tt"), ID: Ptr(int64(4))}, + {Slug: new("tt"), ID: new(int64(4))}, }, Apps: []*App{ - {Slug: Ptr("aa"), ID: Ptr(int64(5))}, + {Slug: new("aa"), ID: new(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: Ptr("uuu"), ID: Ptr(int64(10))}, + {Login: new("uuu"), ID: new(int64(10))}, }, Teams: []*Team{ - {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, + {Slug: new("ttt"), ID: new(int64(20))}, }, Apps: []*App{ - {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, + {Slug: new("aaa"), ID: new(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, BlockCreations: &BlockCreations{ - Enabled: Ptr(true), + Enabled: new(true), }, LockBranch: &LockBranch{ - Enabled: Ptr(true), + Enabled: new(true), }, AllowForkSyncing: &AllowForkSyncing{ - Enabled: Ptr(true), + Enabled: new(true), }, } if !cmp.Equal(protection, want) { @@ -1652,9 +1652,9 @@ func TestRepositoriesService_UpdateBranchProtection_EmptyContexts(t *testing.T) Teams: []string{"t"}, Apps: []string{"a"}, }, - BlockCreations: Ptr(true), - LockBranch: Ptr(true), - AllowForkSyncing: Ptr(true), + BlockCreations: new(true), + LockBranch: new(true), + AllowForkSyncing: new(true), } mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { @@ -1723,47 +1723,47 @@ func TestRepositoriesService_UpdateBranchProtection_EmptyContexts(t *testing.T) DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("uu"), ID: Ptr(int64(3))}, + {Login: new("uu"), ID: new(int64(3))}, }, Teams: []*Team{ - {Slug: Ptr("tt"), ID: Ptr(int64(4))}, + {Slug: new("tt"), ID: new(int64(4))}, }, Apps: []*App{ - {Slug: Ptr("aa"), ID: Ptr(int64(5))}, + {Slug: new("aa"), ID: new(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: Ptr("uuu"), ID: Ptr(int64(10))}, + {Login: new("uuu"), ID: new(int64(10))}, }, Teams: []*Team{ - {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, + {Slug: new("ttt"), ID: new(int64(20))}, }, Apps: []*App{ - {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, + {Slug: new("aaa"), ID: new(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, BlockCreations: &BlockCreations{ - Enabled: Ptr(true), + Enabled: new(true), }, LockBranch: &LockBranch{ - Enabled: Ptr(true), + Enabled: new(true), }, AllowForkSyncing: &AllowForkSyncing{ - Enabled: Ptr(true), + Enabled: new(true), }, } if !cmp.Equal(protection, want) { @@ -1898,37 +1898,37 @@ func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("uu"), ID: Ptr(int64(3))}, + {Login: new("uu"), ID: new(int64(3))}, }, Teams: []*Team{ - {Slug: Ptr("tt"), ID: Ptr(int64(4))}, + {Slug: new("tt"), ID: new(int64(4))}, }, Apps: []*App{ - {Slug: Ptr("aa"), ID: Ptr(int64(5))}, + {Slug: new("aa"), ID: new(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: Ptr("uuu"), ID: Ptr(int64(10))}, + {Login: new("uuu"), ID: new(int64(10))}, }, Teams: []*Team{ - {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, + {Slug: new("ttt"), ID: new(int64(20))}, }, Apps: []*App{ - {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, + {Slug: new("aaa"), ID: new(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, } @@ -2036,37 +2036,37 @@ func TestRepositoriesService_UpdateBranchProtection_EmptyChecks(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("uu"), ID: Ptr(int64(3))}, + {Login: new("uu"), ID: new(int64(3))}, }, Teams: []*Team{ - {Slug: Ptr("tt"), ID: Ptr(int64(4))}, + {Slug: new("tt"), ID: new(int64(4))}, }, Apps: []*App{ - {Slug: Ptr("aa"), ID: Ptr(int64(5))}, + {Slug: new("aa"), ID: new(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: Ptr("uuu"), ID: Ptr(int64(10))}, + {Login: new("uuu"), ID: new(int64(10))}, }, Teams: []*Team{ - {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, + {Slug: new("ttt"), ID: new(int64(20))}, }, Apps: []*App{ - {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, + {Slug: new("aaa"), ID: new(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, } @@ -2172,37 +2172,37 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("uu"), ID: Ptr(int64(3))}, + {Login: new("uu"), ID: new(int64(3))}, }, Teams: []*Team{ - {Slug: Ptr("tt"), ID: Ptr(int64(4))}, + {Slug: new("tt"), ID: new(int64(4))}, }, Apps: []*App{ - {Slug: Ptr("aa"), ID: Ptr(int64(5))}, + {Slug: new("aa"), ID: new(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: Ptr("uuu"), ID: Ptr(int64(10))}, + {Login: new("uuu"), ID: new(int64(10))}, }, Teams: []*Team{ - {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, + {Slug: new("ttt"), ID: new(int64(20))}, }, Apps: []*App{ - {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, + {Slug: new("aaa"), ID: new(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, } @@ -2230,7 +2230,7 @@ func TestRepositoriesService_UpdateBranchProtection_RequireLastPushApproval(t *t input := &ProtectionRequest{ RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ - RequireLastPushApproval: Ptr(true), + RequireLastPushApproval: new(true), }, } @@ -2326,14 +2326,14 @@ func TestRepositoriesService_License(t *testing.T) { } want := &RepositoryLicense{ - Name: Ptr("LICENSE"), - Path: Ptr("LICENSE"), + Name: new("LICENSE"), + Path: new("LICENSE"), License: &License{ - Name: Ptr("MIT License"), - Key: Ptr("mit"), - SPDXID: Ptr("MIT"), - URL: Ptr("https://api.github.com/licenses/mit"), - Featured: Ptr(true), + Name: new("MIT License"), + Key: new("mit"), + SPDXID: new("MIT"), + URL: new("https://api.github.com/licenses/mit"), + Featured: new(true), }, } @@ -2490,7 +2490,7 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Contexts(t *testing.T) { client, mux, _ := setup(t) input := &RequiredStatusChecksRequest{ - Strict: Ptr(true), + Strict: new(true), Contexts: []string{"continuous-integration"}, } @@ -2564,7 +2564,7 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Checks(t *testing.T) { appID := int64(123) noAppID := int64(-1) input := &RequiredStatusChecksRequest{ - Strict: Ptr(true), + Strict: new(true), Checks: []*RequiredStatusCheck{ { Context: "continuous-integration", @@ -2800,13 +2800,13 @@ func TestRepositoriesService_GetPullRequestReviewEnforcement(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, RequireCodeOwnerReviews: true, @@ -2883,13 +2883,13 @@ func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: Ptr("u"), ID: Ptr(int64(1))}, + {Login: new("u"), ID: new(int64(1))}, }, Teams: []*Team{ - {Slug: Ptr("t"), ID: Ptr(int64(2))}, + {Slug: new("t"), ID: new(int64(2))}, }, Apps: []*App{ - {Slug: Ptr("a"), ID: Ptr(int64(3))}, + {Slug: new("a"), ID: new(int64(3))}, }, }, RequireCodeOwnerReviews: true, @@ -3041,7 +3041,7 @@ func TestRepositoriesService_GetAdminEnforcement(t *testing.T) { } want := &AdminEnforcement{ - URL: Ptr("/repos/o/r/branches/b/protection/enforce_admins"), + URL: new("/repos/o/r/branches/b/protection/enforce_admins"), Enabled: true, } @@ -3093,7 +3093,7 @@ func TestRepositoriesService_AddAdminEnforcement(t *testing.T) { } want := &AdminEnforcement{ - URL: Ptr("/repos/o/r/branches/b/protection/enforce_admins"), + URL: new("/repos/o/r/branches/b/protection/enforce_admins"), Enabled: true, } if !cmp.Equal(enforcement, want) { @@ -3184,8 +3184,8 @@ func TestRepositoriesService_GetSignaturesProtectedBranch(t *testing.T) { } want := &SignaturesProtectedBranch{ - URL: Ptr("/repos/o/r/branches/b/protection/required_signatures"), - Enabled: Ptr(false), + URL: new("/repos/o/r/branches/b/protection/required_signatures"), + Enabled: new(false), } if !cmp.Equal(signature, want) { @@ -3276,8 +3276,8 @@ func TestRepositoriesService_RequireSignaturesOnProtectedBranch(t *testing.T) { } want := &SignaturesProtectedBranch{ - URL: Ptr("/repos/o/r/branches/b/protection/required_signatures"), - Enabled: Ptr(true), + URL: new("/repos/o/r/branches/b/protection/required_signatures"), + Enabled: new(true), } if !cmp.Equal(signature, want) { @@ -3564,7 +3564,7 @@ func TestRepositoriesService_ReplaceAppRestrictions(t *testing.T) { t.Errorf("Repositories.ReplaceAppRestrictions returned error: %v", err) } want := []*App{ - {Name: Ptr("octocat")}, + {Name: new("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.ReplaceAppRestrictions returned %+v, want %+v", got, want) @@ -3615,7 +3615,7 @@ func TestRepositoriesService_AddAppRestrictions(t *testing.T) { t.Errorf("Repositories.AddAppRestrictions returned error: %v", err) } want := []*App{ - {Name: Ptr("octocat")}, + {Name: new("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.AddAppRestrictions returned %+v, want %+v", got, want) @@ -3755,7 +3755,7 @@ func TestRepositoriesService_ReplaceTeamRestrictions(t *testing.T) { t.Errorf("Repositories.ReplaceTeamRestrictions returned error: %v", err) } want := []*Team{ - {Name: Ptr("octocat")}, + {Name: new("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.ReplaceTeamRestrictions returned %+v, want %+v", got, want) @@ -3806,7 +3806,7 @@ func TestRepositoriesService_AddTeamRestrictions(t *testing.T) { t.Errorf("Repositories.AddTeamRestrictions returned error: %v", err) } want := []*Team{ - {Name: Ptr("octocat")}, + {Name: new("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.AddTeamRestrictions returned %+v, want %+v", got, want) @@ -3946,7 +3946,7 @@ func TestRepositoriesService_ReplaceUserRestrictions(t *testing.T) { t.Errorf("Repositories.ReplaceUserRestrictions returned error: %v", err) } want := []*User{ - {Name: Ptr("octocat")}, + {Name: new("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.ReplaceUserRestrictions returned %+v, want %+v", got, want) @@ -3997,7 +3997,7 @@ func TestRepositoriesService_AddUserRestrictions(t *testing.T) { t.Errorf("Repositories.AddUserRestrictions returned error: %v", err) } want := []*User{ - {Name: Ptr("octocat")}, + {Name: new("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.AddUserRestrictions returned %+v, want %+v", got, want) @@ -4071,7 +4071,7 @@ func TestRepositoriesService_Transfer(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TransferRequest{NewOwner: "a", NewName: Ptr("b"), TeamID: []int64{123}} + input := TransferRequest{NewOwner: "a", NewName: new("b"), TeamID: []int64{123}} mux.HandleFunc("/repos/o/r/transfer", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -4085,7 +4085,7 @@ func TestRepositoriesService_Transfer(t *testing.T) { t.Errorf("Repositories.Transfer returned error: %v", err) } - want := &Repository{Owner: &User{Login: Ptr("a")}} + want := &Repository{Owner: &User{Login: new("a")}} if !cmp.Equal(got, want) { t.Errorf("Repositories.Transfer returned %+v, want %+v", got, want) } @@ -4156,7 +4156,7 @@ func TestRepositoriesService_Dispatch(t *testing.T) { t.Errorf("Repositories.Dispatch returned error: %v", err) } - want := &Repository{Owner: &User{Login: Ptr("a")}} + want := &Repository{Owner: &User{Login: new("a")}} if !cmp.Equal(got, want) { t.Errorf("Repositories.Dispatch returned %+v, want %+v", got, want) } @@ -4352,25 +4352,25 @@ func TestRepositoriesService_ListRepositoryActivities(t *testing.T) { Timestamp: &referenceTimestamp, ActivityType: "push", Actor: &RepositoryActor{ - Login: Ptr("testuser1"), - ID: Ptr(int64(111111)), - NodeID: Ptr("MDQ6VXNlcjExMTExMQ=="), - AvatarURL: Ptr("https://avatars.githubusercontent.com/u/111111?v=4"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/testuser1"), - HTMLURL: Ptr("https://github.com/testuser1"), - FollowersURL: Ptr("https://api.github.com/users/testuser1/followers"), - FollowingURL: Ptr("https://api.github.com/users/testuser1/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/testuser1/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/testuser1/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/testuser1/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/testuser1/orgs"), - ReposURL: Ptr("https://api.github.com/users/testuser1/repos"), - EventsURL: Ptr("https://api.github.com/users/testuser1/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/testuser1/received_events"), - Type: Ptr("User"), - UserViewType: Ptr("public"), - SiteAdmin: Ptr(false), + Login: new("testuser1"), + ID: new(int64(111111)), + NodeID: new("MDQ6VXNlcjExMTExMQ=="), + AvatarURL: new("https://avatars.githubusercontent.com/u/111111?v=4"), + GravatarID: new(""), + URL: new("https://api.github.com/users/testuser1"), + HTMLURL: new("https://github.com/testuser1"), + FollowersURL: new("https://api.github.com/users/testuser1/followers"), + FollowingURL: new("https://api.github.com/users/testuser1/following{/other_user}"), + GistsURL: new("https://api.github.com/users/testuser1/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/testuser1/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/testuser1/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/testuser1/orgs"), + ReposURL: new("https://api.github.com/users/testuser1/repos"), + EventsURL: new("https://api.github.com/users/testuser1/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/testuser1/received_events"), + Type: new("User"), + UserViewType: new("public"), + SiteAdmin: new(false), }, }, { @@ -4382,25 +4382,25 @@ func TestRepositoriesService_ListRepositoryActivities(t *testing.T) { Timestamp: &referenceTimestamp, ActivityType: "branch_deletion", Actor: &RepositoryActor{ - Login: Ptr("testuser2"), - ID: Ptr(int64(222222)), - NodeID: Ptr("MDQ6VXNlcjIyMjIyMg=="), - AvatarURL: Ptr("https://avatars.githubusercontent.com/u/222222?v=4"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/testuser2"), - HTMLURL: Ptr("https://github.com/testuser2"), - FollowersURL: Ptr("https://api.github.com/users/testuser2/followers"), - FollowingURL: Ptr("https://api.github.com/users/testuser2/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/testuser2/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/testuser2/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/testuser2/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/testuser2/orgs"), - ReposURL: Ptr("https://api.github.com/users/testuser2/repos"), - EventsURL: Ptr("https://api.github.com/users/testuser2/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/testuser2/received_events"), - Type: Ptr("User"), - UserViewType: Ptr("public"), - SiteAdmin: Ptr(false), + Login: new("testuser2"), + ID: new(int64(222222)), + NodeID: new("MDQ6VXNlcjIyMjIyMg=="), + AvatarURL: new("https://avatars.githubusercontent.com/u/222222?v=4"), + GravatarID: new(""), + URL: new("https://api.github.com/users/testuser2"), + HTMLURL: new("https://github.com/testuser2"), + FollowersURL: new("https://api.github.com/users/testuser2/followers"), + FollowingURL: new("https://api.github.com/users/testuser2/following{/other_user}"), + GistsURL: new("https://api.github.com/users/testuser2/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/testuser2/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/testuser2/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/testuser2/orgs"), + ReposURL: new("https://api.github.com/users/testuser2/repos"), + EventsURL: new("https://api.github.com/users/testuser2/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/testuser2/received_events"), + Type: new("User"), + UserViewType: new("public"), + SiteAdmin: new(false), }, }, } @@ -4500,25 +4500,25 @@ func TestRepositoriesService_ListRepositoryActivities_withOptions(t *testing.T) Timestamp: &referenceTimestamp, ActivityType: "push", Actor: &RepositoryActor{ - Login: Ptr("testuser1"), - ID: Ptr(int64(111111)), - NodeID: Ptr("MDQ6VXNlcjExMTExMQ=="), - AvatarURL: Ptr("https://avatars.githubusercontent.com/u/111111?v=4"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/testuser1"), - HTMLURL: Ptr("https://github.com/testuser1"), - FollowersURL: Ptr("https://api.github.com/users/testuser1/followers"), - FollowingURL: Ptr("https://api.github.com/users/testuser1/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/testuser1/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/testuser1/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/testuser1/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/testuser1/orgs"), - ReposURL: Ptr("https://api.github.com/users/testuser1/repos"), - EventsURL: Ptr("https://api.github.com/users/testuser1/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/testuser1/received_events"), - Type: Ptr("User"), - UserViewType: Ptr("public"), - SiteAdmin: Ptr(false), + Login: new("testuser1"), + ID: new(int64(111111)), + NodeID: new("MDQ6VXNlcjExMTExMQ=="), + AvatarURL: new("https://avatars.githubusercontent.com/u/111111?v=4"), + GravatarID: new(""), + URL: new("https://api.github.com/users/testuser1"), + HTMLURL: new("https://github.com/testuser1"), + FollowersURL: new("https://api.github.com/users/testuser1/followers"), + FollowingURL: new("https://api.github.com/users/testuser1/following{/other_user}"), + GistsURL: new("https://api.github.com/users/testuser1/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/testuser1/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/testuser1/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/testuser1/orgs"), + ReposURL: new("https://api.github.com/users/testuser1/repos"), + EventsURL: new("https://api.github.com/users/testuser1/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/testuser1/received_events"), + Type: new("User"), + UserViewType: new("public"), + SiteAdmin: new(false), }, }, } diff --git a/github/repos_traffic_test.go b/github/repos_traffic_test.go index 3578739fbe3..17c2d2ec10f 100644 --- a/github/repos_traffic_test.go +++ b/github/repos_traffic_test.go @@ -32,9 +32,9 @@ func TestRepositoriesService_ListTrafficReferrers(t *testing.T) { } want := []*TrafficReferrer{{ - Referrer: Ptr("Google"), - Count: Ptr(4), - Uniques: Ptr(3), + Referrer: new("Google"), + Count: new(4), + Uniques: new(3), }} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListTrafficReferrers returned %+v, want %+v", got, want) @@ -75,10 +75,10 @@ func TestRepositoriesService_ListTrafficPaths(t *testing.T) { } want := []*TrafficPath{{ - Path: Ptr("/github/hubot"), - Title: Ptr("github/hubot: A customizable life embetterment robot."), - Count: Ptr(3542), - Uniques: Ptr(2225), + Path: new("/github/hubot"), + Title: new("github/hubot: A customizable life embetterment robot."), + Count: new(3542), + Uniques: new(2225), }} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListTrafficPaths returned %+v, want %+v", got, want) @@ -123,11 +123,11 @@ func TestRepositoriesService_ListTrafficViews(t *testing.T) { want := &TrafficViews{ Views: []*TrafficData{{ Timestamp: &referenceTimestamp, - Count: Ptr(7), - Uniques: Ptr(6), + Count: new(7), + Uniques: new(6), }}, - Count: Ptr(7), - Uniques: Ptr(6), + Count: new(7), + Uniques: new(6), } if !cmp.Equal(got, want) { @@ -173,11 +173,11 @@ func TestRepositoriesService_ListTrafficClones(t *testing.T) { want := &TrafficClones{ Clones: []*TrafficData{{ Timestamp: &referenceTimestamp, - Count: Ptr(7), - Uniques: Ptr(6), + Count: new(7), + Uniques: new(6), }}, - Count: Ptr(7), - Uniques: Ptr(6), + Count: new(7), + Uniques: new(6), } if !cmp.Equal(got, want) { diff --git a/github/rules.go b/github/rules.go index e6f48618a49..9d2230a5a2c 100644 --- a/github/rules.go +++ b/github/rules.go @@ -503,7 +503,7 @@ func (r *RulesetReviewer) UnmarshalJSON(data []byte) error { if aux.ID != nil { switch id := aux.ID.(type) { case float64: - r.ID = Ptr(int64(id)) + r.ID = new(int64(id)) case string: i, err := strconv.ParseInt(id, 10, 64) if err != nil { diff --git a/github/rules_test.go b/github/rules_test.go index ff0c69efc2c..56ad4077313 100644 --- a/github/rules_test.go +++ b/github/rules_test.go @@ -161,41 +161,41 @@ func TestRepositoryRulesetRules(t *testing.T) { RequiredReviewThreadResolution: true, }, RequiredStatusChecks: &RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ - {Context: "test1", IntegrationID: Ptr(int64(1))}, - {Context: "test2", IntegrationID: Ptr(int64(2))}, + {Context: "test1", IntegrationID: new(int64(1))}, + {Context: "test2", IntegrationID: new(int64(2))}, }, StrictRequiredStatusChecksPolicy: true, }, NonFastForward: &EmptyRuleParameters{}, CommitMessagePattern: &PatternRuleParameters{ - Name: Ptr("cmp"), - Negate: Ptr(false), + Name: new("cmp"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, CommitAuthorEmailPattern: &PatternRuleParameters{ - Name: Ptr("caep"), - Negate: Ptr(false), + Name: new("caep"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, CommitterEmailPattern: &PatternRuleParameters{ - Name: Ptr("cep"), - Negate: Ptr(false), + Name: new("cep"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, BranchNamePattern: &PatternRuleParameters{ - Name: Ptr("bp"), - Negate: Ptr(false), + Name: new("bp"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, TagNamePattern: &PatternRuleParameters{ - Name: Ptr("tp"), - Negate: Ptr(false), + Name: new("tp"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -208,19 +208,19 @@ func TestRepositoryRulesetRules(t *testing.T) { }, MaxFileSize: &MaxFileSizeRuleParameters{MaxFileSize: 1024}, Workflows: &WorkflowsRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), Workflows: []*RuleWorkflow{ { Path: ".github/workflows/test1.yaml", - Ref: Ptr("main"), - RepositoryID: Ptr(int64(1)), - SHA: Ptr("aaaa"), + Ref: new("main"), + RepositoryID: new(int64(1)), + SHA: new("aaaa"), }, { Path: ".github/workflows/test2.yaml", - Ref: Ptr("main"), - RepositoryID: Ptr(int64(2)), - SHA: Ptr("bbbb"), + Ref: new("main"), + RepositoryID: new(int64(2)), + SHA: new("bbbb"), }, }, }, @@ -460,10 +460,10 @@ func TestBranchRules(t *testing.T) { RulesetID: 1, }, Parameters: RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), RequiredStatusChecks: []*RuleStatusCheck{ - {Context: "test1", IntegrationID: Ptr(int64(1))}, - {Context: "test2", IntegrationID: Ptr(int64(2))}, + {Context: "test1", IntegrationID: new(int64(1))}, + {Context: "test2", IntegrationID: new(int64(2))}, }, StrictRequiredStatusChecksPolicy: true, }, @@ -484,8 +484,8 @@ func TestBranchRules(t *testing.T) { RulesetID: 1, }, Parameters: PatternRuleParameters{ - Name: Ptr("cmp"), - Negate: Ptr(false), + Name: new("cmp"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -499,8 +499,8 @@ func TestBranchRules(t *testing.T) { RulesetID: 1, }, Parameters: PatternRuleParameters{ - Name: Ptr("caep"), - Negate: Ptr(false), + Name: new("caep"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -514,8 +514,8 @@ func TestBranchRules(t *testing.T) { RulesetID: 1, }, Parameters: PatternRuleParameters{ - Name: Ptr("cep"), - Negate: Ptr(false), + Name: new("cep"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -529,8 +529,8 @@ func TestBranchRules(t *testing.T) { RulesetID: 1, }, Parameters: PatternRuleParameters{ - Name: Ptr("bp"), - Negate: Ptr(false), + Name: new("bp"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -544,8 +544,8 @@ func TestBranchRules(t *testing.T) { RulesetID: 1, }, Parameters: PatternRuleParameters{ - Name: Ptr("tp"), - Negate: Ptr(false), + Name: new("tp"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -603,19 +603,19 @@ func TestBranchRules(t *testing.T) { RulesetID: 1, }, Parameters: WorkflowsRuleParameters{ - DoNotEnforceOnCreate: Ptr(true), + DoNotEnforceOnCreate: new(true), Workflows: []*RuleWorkflow{ { Path: ".github/workflows/test1.yaml", - Ref: Ptr("main"), - RepositoryID: Ptr(int64(1)), - SHA: Ptr("aaaa"), + Ref: new("main"), + RepositoryID: new(int64(1)), + SHA: new("aaaa"), }, { Path: ".github/workflows/test2.yaml", - Ref: Ptr("main"), - RepositoryID: Ptr(int64(2)), - SHA: Ptr("bbbb"), + Ref: new("main"), + RepositoryID: new(int64(2)), + SHA: new("bbbb"), }, }, }, @@ -824,11 +824,11 @@ func TestRepositoryRule(t *testing.T) { RequiredReviewThreadResolution: false, RequiredReviewers: []*RulesetRequiredReviewer{ { - MinimumApprovals: Ptr(1), + MinimumApprovals: new(1), FilePatterns: []string{"*"}, Reviewer: &RulesetReviewer{ - ID: Ptr(int64(123456)), - Type: Ptr(RulesetReviewerTypeTeam), + ID: new(int64(123456)), + Type: new(RulesetReviewerTypeTeam), }, }, }, @@ -853,11 +853,11 @@ func TestRepositoryRule(t *testing.T) { RequiredReviewThreadResolution: false, RequiredReviewers: []*RulesetRequiredReviewer{ { - MinimumApprovals: Ptr(1), + MinimumApprovals: new(1), FilePatterns: []string{"*"}, Reviewer: &RulesetReviewer{ - ID: Ptr(int64(123456)), - Type: Ptr(RulesetReviewerTypeTeam), + ID: new(int64(123456)), + Type: new(RulesetReviewerTypeTeam), }, }, }, @@ -889,8 +889,8 @@ func TestRepositoryRule(t *testing.T) { &RepositoryRule{ Type: RulesetRuleTypeCommitMessagePattern, Parameters: &PatternRuleParameters{ - Name: Ptr("test"), - Negate: Ptr(false), + Name: new("test"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -902,8 +902,8 @@ func TestRepositoryRule(t *testing.T) { &RepositoryRule{ Type: RulesetRuleTypeCommitAuthorEmailPattern, Parameters: &PatternRuleParameters{ - Name: Ptr("test"), - Negate: Ptr(false), + Name: new("test"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -915,8 +915,8 @@ func TestRepositoryRule(t *testing.T) { &RepositoryRule{ Type: RulesetRuleTypeCommitterEmailPattern, Parameters: &PatternRuleParameters{ - Name: Ptr("test"), - Negate: Ptr(false), + Name: new("test"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -928,8 +928,8 @@ func TestRepositoryRule(t *testing.T) { &RepositoryRule{ Type: RulesetRuleTypeBranchNamePattern, Parameters: &PatternRuleParameters{ - Name: Ptr("test"), - Negate: Ptr(false), + Name: new("test"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, @@ -941,8 +941,8 @@ func TestRepositoryRule(t *testing.T) { &RepositoryRule{ Type: RulesetRuleTypeTagNamePattern, Parameters: &PatternRuleParameters{ - Name: Ptr("test"), - Negate: Ptr(false), + Name: new("test"), + Negate: new(false), Operator: PatternRuleOperatorStartsWith, Pattern: "test", }, diff --git a/github/scim_test.go b/github/scim_test.go index a26a3cb17c1..1aacfff16fd 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -63,9 +63,9 @@ func TestSCIMService_ListSCIMProvisionedIdentities(t *testing.T) { ctx := t.Context() opts := &ListSCIMProvisionedIdentitiesOptions{ - StartIndex: Ptr(1), - Count: Ptr(10), - Filter: Ptr(`userName="Octocat"`), + StartIndex: new(1), + Count: new(10), + Filter: new(`userName="Octocat"`), } identities, _, err := client.SCIM.ListSCIMProvisionedIdentities(ctx, "o", opts) if err != nil { @@ -74,35 +74,35 @@ func TestSCIMService_ListSCIMProvisionedIdentities(t *testing.T) { want := SCIMProvisionedIdentities{ Schemas: []string{"urn:ietf:params:scim:api:messages:2.0:ListResponse"}, - TotalResults: Ptr(1), - ItemsPerPage: Ptr(1), - StartIndex: Ptr(1), + TotalResults: new(1), + ItemsPerPage: new(1), + StartIndex: new(1), Resources: []*SCIMUserAttributes{ { - ID: Ptr("5fc0c238-1112-11e8-8e45-920c87bdbd75"), + ID: new("5fc0c238-1112-11e8-8e45-920c87bdbd75"), Meta: &SCIMMeta{ - ResourceType: Ptr("User"), + ResourceType: new("User"), Created: refTimestamp(1136178000), LastModified: refTimestamp(1136178001), - Location: Ptr("https://api.github.com/scim/v2/organizations/octo-org/Users/5fc0c238-1112-11e8-8e45-920c87bdbd75"), + Location: new("https://api.github.com/scim/v2/organizations/octo-org/Users/5fc0c238-1112-11e8-8e45-920c87bdbd75"), }, UserName: "octocat@github.com", Name: SCIMUserName{ GivenName: "Mona", FamilyName: "Octocat", - Formatted: Ptr("Mona Octocat"), + Formatted: new("Mona Octocat"), }, - DisplayName: Ptr("Mona Octocat"), + DisplayName: new("Mona Octocat"), Emails: []*SCIMUserEmail{ { Value: "octocat@github.com", - Primary: Ptr(true), + Primary: new(true), }, }, Schemas: []string{"urn:ietf:params:scim:schemas:core:2.0:User"}, - ExternalID: Ptr("00u1dhhb1fkIGP7RL1d8"), + ExternalID: new("00u1dhhb1fkIGP7RL1d8"), Groups: nil, - Active: Ptr(true), + Active: new(true), }, }, } @@ -153,7 +153,7 @@ func TestSCIMService_ProvisionAndInviteSCIMUser(t *testing.T) { } want := &SCIMUserAttributes{ - ID: Ptr("1234567890"), + ID: new("1234567890"), UserName: "userName", } if !cmp.Equal(user, want) { @@ -221,33 +221,33 @@ func TestSCIMService_GetSCIMProvisioningInfoForUser(t *testing.T) { } want := SCIMUserAttributes{ - ID: Ptr("edefdfedf-050c-11e7-8d32"), + ID: new("edefdfedf-050c-11e7-8d32"), Meta: &SCIMMeta{ - ResourceType: Ptr("User"), + ResourceType: new("User"), Created: refTimestamp(1136178000), LastModified: refTimestamp(1136178001), - Location: Ptr("https://api.github.com/scim/v2/organizations/octo-org/Users/edefdfedf-050c-11e7-8d32"), + Location: new("https://api.github.com/scim/v2/organizations/octo-org/Users/edefdfedf-050c-11e7-8d32"), }, UserName: "mona.octocat@okta.example.com", Name: SCIMUserName{ GivenName: "Mona", FamilyName: "Octocat", - Formatted: Ptr("Mona Octocat"), + Formatted: new("Mona Octocat"), }, - DisplayName: Ptr("Mona Octocat"), + DisplayName: new("Mona Octocat"), Emails: []*SCIMUserEmail{ { Value: "mona.octocat@okta.example.com", - Primary: Ptr(true), + Primary: new(true), }, { Value: "mona@octocat.github.com", }, }, Schemas: []string{"urn:ietf:params:scim:schemas:core:2.0:User"}, - ExternalID: Ptr("a7d0f98382"), + ExternalID: new("a7d0f98382"), Groups: nil, - Active: Ptr(true), + Active: new(true), } if !cmp.Equal(user, &want) { @@ -298,7 +298,7 @@ func TestSCIMService_UpdateProvisionedOrgMembership(t *testing.T) { } want := &SCIMUserAttributes{ - ID: Ptr("123"), + ID: new("123"), UserName: "userName", } if !cmp.Equal(user, want) { @@ -329,7 +329,7 @@ func TestSCIMService_UpdateAttributeForSCIMUser(t *testing.T) { Operations: []*UpdateAttributeForSCIMUserOperations{ { Op: "replace", - Path: Ptr("displayName"), + Path: new("displayName"), Value: json.RawMessage(`"NewDisplayName"`), }, }, @@ -363,7 +363,7 @@ func TestSCIMService_UpdateAttributeForSCIMUser(t *testing.T) { } want := &SCIMUserAttributes{ - ID: Ptr("123"), + ID: new("123"), UserName: "userName", } if !cmp.Equal(user, want) { diff --git a/github/search_test.go b/github/search_test.go index c7909134177..8c9c2571fe8 100644 --- a/github/search_test.go +++ b/github/search_test.go @@ -39,9 +39,9 @@ func TestSearchService_Repositories(t *testing.T) { } want := &RepositoriesSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(false), - Repositories: []*Repository{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}, + Total: new(4), + IncompleteResults: new(false), + Repositories: []*Repository{{ID: new(int64(1))}, {ID: new(int64(2))}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Repositories returned %+v, want %+v", result, want) @@ -130,18 +130,18 @@ func TestSearchService_RepositoriesTextMatch(t *testing.T) { } wantedRepoResult := &Repository{ - Name: Ptr("gopher1"), + Name: new("gopher1"), TextMatches: []*TextMatch{ { - Fragment: Ptr("I'm afraid my friend what you have found\nIs a gopher who lives to feed"), - Matches: []*Match{{Text: Ptr("gopher"), Indices: []int{14, 21}}}, + Fragment: new("I'm afraid my friend what you have found\nIs a gopher who lives to feed"), + Matches: []*Match{{Text: new("gopher"), Indices: []int{14, 21}}}, }, }, } want := &RepositoriesSearchResult{ - Total: Ptr(1), - IncompleteResults: Ptr(false), + Total: new(1), + IncompleteResults: new(false), Repositories: []*Repository{wantedRepoResult}, } if !cmp.Equal(result, want) { @@ -172,9 +172,9 @@ func TestSearchService_Topics(t *testing.T) { } want := &TopicsSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(false), - Topics: []*TopicResult{{Name: Ptr("blah")}, {Name: Ptr("blahblah")}}, + Total: new(4), + IncompleteResults: new(false), + Topics: []*TopicResult{{Name: new("blah")}, {Name: new("blahblah")}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Topics returned %+v, want %+v", result, want) @@ -225,9 +225,9 @@ func TestSearchService_Commits(t *testing.T) { } want := &CommitsSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(false), - Commits: []*CommitResult{{SHA: Ptr("random_hash1")}, {SHA: Ptr("random_hash2")}}, + Total: new(4), + IncompleteResults: new(false), + Commits: []*CommitResult{{SHA: new("random_hash1")}, {SHA: new("random_hash2")}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Commits returned %+v, want %+v", result, want) @@ -280,9 +280,9 @@ func TestSearchService_Issues(t *testing.T) { } want := &IssuesSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(true), - Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, + Total: new(4), + IncompleteResults: new(true), + Issues: []*Issue{{Number: new(1)}, {Number: new(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues returned %+v, want %+v", result, want) @@ -315,7 +315,7 @@ func TestSearchService_Issues_advancedSearch(t *testing.T) { fmt.Fprint(w, `{"total_count": 4, "incomplete_results": true, "items": [{"number":1},{"number":2}]}`) }) - opts := &SearchOptions{Sort: "forks", Order: "desc", ListOptions: ListOptions{Page: 2, PerPage: 2}, AdvancedSearch: Ptr(true)} + opts := &SearchOptions{Sort: "forks", Order: "desc", ListOptions: ListOptions{Page: 2, PerPage: 2}, AdvancedSearch: new(true)} ctx := t.Context() result, _, err := client.Search.Issues(ctx, "blah", opts) if err != nil { @@ -323,9 +323,9 @@ func TestSearchService_Issues_advancedSearch(t *testing.T) { } want := &IssuesSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(true), - Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, + Total: new(4), + IncompleteResults: new(true), + Issues: []*Issue{{Number: new(1)}, {Number: new(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues_advancedSearch returned %+v, want %+v", result, want) @@ -358,10 +358,10 @@ func TestSearchService_Issues_searchType(t *testing.T) { } want := &IssuesSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(true), - SearchType: Ptr("hybrid"), - Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, + Total: new(4), + IncompleteResults: new(true), + SearchType: new("hybrid"), + Issues: []*Issue{{Number: new(1)}, {Number: new(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues_searchType returned %+v, want %+v", result, want) @@ -410,9 +410,9 @@ func TestSearchService_Issues_withQualifiersNoOpts(t *testing.T) { } want := &IssuesSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(true), - Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, + Total: new(4), + IncompleteResults: new(true), + Issues: []*Issue{{Number: new(1)}, {Number: new(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues returned %+v, want %+v", result, want) @@ -449,9 +449,9 @@ func TestSearchService_Issues_withQualifiersAndOpts(t *testing.T) { } want := &IssuesSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(true), - Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, + Total: new(4), + IncompleteResults: new(true), + Issues: []*Issue{{Number: new(1)}, {Number: new(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues returned %+v, want %+v", result, want) @@ -483,9 +483,9 @@ func TestSearchService_Users(t *testing.T) { } want := &UsersSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(false), - Users: []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}, + Total: new(4), + IncompleteResults: new(false), + Users: []*User{{ID: new(int64(1))}, {ID: new(int64(2))}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Users returned %+v, want %+v", result, want) @@ -538,9 +538,9 @@ func TestSearchService_Code(t *testing.T) { } want := &CodeSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(false), - CodeResults: []*CodeResult{{Name: Ptr("1")}, {Name: Ptr("2")}}, + Total: new(4), + IncompleteResults: new(false), + CodeResults: []*CodeResult{{Name: new("1")}, {Name: new("2")}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Code returned %+v, want %+v", result, want) @@ -612,18 +612,18 @@ func TestSearchService_CodeTextMatch(t *testing.T) { } wantedCodeResult := &CodeResult{ - Name: Ptr("gopher1"), + Name: new("gopher1"), TextMatches: []*TextMatch{ { - Fragment: Ptr("I'm afraid my friend what you have found\nIs a gopher who lives to feed"), - Matches: []*Match{{Text: Ptr("gopher"), Indices: []int{14, 21}}}, + Fragment: new("I'm afraid my friend what you have found\nIs a gopher who lives to feed"), + Matches: []*Match{{Text: new("gopher"), Indices: []int{14, 21}}}, }, }, } want := &CodeSearchResult{ - Total: Ptr(1), - IncompleteResults: Ptr(false), + Total: new(1), + IncompleteResults: new(false), CodeResults: []*CodeResult{wantedCodeResult}, } if !cmp.Equal(result, want) { @@ -657,11 +657,11 @@ func TestSearchService_Labels(t *testing.T) { } want := &LabelsSearchResult{ - Total: Ptr(4), - IncompleteResults: Ptr(false), + Total: new(4), + IncompleteResults: new(false), Labels: []*LabelResult{ - {ID: Ptr(int64(1234)), Name: Ptr("bug"), Description: Ptr("some text")}, - {ID: Ptr(int64(4567)), Name: Ptr("feature")}, + {ID: new(int64(1234)), Name: new("bug"), Description: new("some text")}, + {ID: new(int64(4567)), Name: new("feature")}, }, } if !cmp.Equal(result, want) { diff --git a/github/secret_scanning_custom_patterns_test.go b/github/secret_scanning_custom_patterns_test.go index 051280e4b86..7424578bd1e 100644 --- a/github/secret_scanning_custom_patterns_test.go +++ b/github/secret_scanning_custom_patterns_test.go @@ -66,11 +66,11 @@ func TestSecretScanningService_ListCustomPatternsForRepo(t *testing.T) { Slug: "custom-pattern", State: "published", PushProtectionEnabled: true, - StartDelimiter: Ptr(`\b`), - EndDelimiter: Ptr(`\b`), + StartDelimiter: new(`\b`), + EndDelimiter: new(`\b`), MustMatch: []string{"ID-.*"}, MustNotMatch: []string{"TEST-.*"}, - CustomPatternVersion: Ptr("v1"), + CustomPatternVersion: new("v1"), CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp, }, @@ -162,8 +162,8 @@ func TestSecretScanningService_UpdateCustomPatternForRepo(t *testing.T) { client, mux, _ := setup(t) input := SecretScanningUpdateCustomPatternRequest{ - Pattern: Ptr("[A-Z]{3}-[0-9]{4}"), - CustomPatternVersion: Ptr("v1"), + Pattern: new("[A-Z]{3}-[0-9]{4}"), + CustomPatternVersion: new("v1"), } mux.HandleFunc("/repos/o/r/secret-scanning/custom-patterns/1", func(w http.ResponseWriter, r *http.Request) { @@ -193,7 +193,7 @@ func TestSecretScanningService_UpdateCustomPatternForRepo(t *testing.T) { Slug: "custom-pattern", State: "published", PushProtectionEnabled: false, - CustomPatternVersion: Ptr("v2"), + CustomPatternVersion: new("v2"), } if !cmp.Equal(pattern, want) { t.Errorf("SecretScanning.UpdateCustomPatternForRepo returned %+v, want %+v", pattern, want) @@ -298,11 +298,11 @@ func TestSecretScanningService_ListCustomPatternsForOrg(t *testing.T) { Slug: "custom-pattern", State: "published", PushProtectionEnabled: true, - StartDelimiter: Ptr(`\b`), - EndDelimiter: Ptr(`\b`), + StartDelimiter: new(`\b`), + EndDelimiter: new(`\b`), MustMatch: []string{"ID-.*"}, MustNotMatch: []string{"TEST-.*"}, - CustomPatternVersion: Ptr("v1"), + CustomPatternVersion: new("v1"), CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp, }, @@ -394,8 +394,8 @@ func TestSecretScanningService_UpdateCustomPatternForOrg(t *testing.T) { client, mux, _ := setup(t) input := SecretScanningUpdateCustomPatternRequest{ - Pattern: Ptr("[A-Z]{3}-[0-9]{4}"), - CustomPatternVersion: Ptr("v1"), + Pattern: new("[A-Z]{3}-[0-9]{4}"), + CustomPatternVersion: new("v1"), } mux.HandleFunc("/orgs/o/secret-scanning/custom-patterns/1", func(w http.ResponseWriter, r *http.Request) { @@ -425,7 +425,7 @@ func TestSecretScanningService_UpdateCustomPatternForOrg(t *testing.T) { Slug: "custom-pattern", State: "published", PushProtectionEnabled: false, - CustomPatternVersion: Ptr("v2"), + CustomPatternVersion: new("v2"), } if !cmp.Equal(pattern, want) { t.Errorf("SecretScanning.UpdateCustomPatternForOrg returned %+v, want %+v", pattern, want) @@ -530,11 +530,11 @@ func TestSecretScanningService_ListCustomPatternsForEnterprise(t *testing.T) { Slug: "custom-pattern", State: "published", PushProtectionEnabled: true, - StartDelimiter: Ptr(`\b`), - EndDelimiter: Ptr(`\b`), + StartDelimiter: new(`\b`), + EndDelimiter: new(`\b`), MustMatch: []string{"ID-.*"}, MustNotMatch: []string{"TEST-.*"}, - CustomPatternVersion: Ptr("v1"), + CustomPatternVersion: new("v1"), CreatedAt: &referenceTimestamp, UpdatedAt: &referenceTimestamp, }, @@ -626,8 +626,8 @@ func TestSecretScanningService_UpdateCustomPatternForEnterprise(t *testing.T) { client, mux, _ := setup(t) input := SecretScanningUpdateCustomPatternRequest{ - Pattern: Ptr("[A-Z]{3}-[0-9]{4}"), - CustomPatternVersion: Ptr("v1"), + Pattern: new("[A-Z]{3}-[0-9]{4}"), + CustomPatternVersion: new("v1"), } mux.HandleFunc("/enterprises/e/secret-scanning/custom-patterns/1", func(w http.ResponseWriter, r *http.Request) { @@ -657,7 +657,7 @@ func TestSecretScanningService_UpdateCustomPatternForEnterprise(t *testing.T) { Slug: "custom-pattern", State: "published", PushProtectionEnabled: false, - CustomPatternVersion: Ptr("v2"), + CustomPatternVersion: new("v2"), } if !cmp.Equal(pattern, want) { t.Errorf("SecretScanning.UpdateCustomPatternForEnterprise returned %+v, want %+v", pattern, want) diff --git a/github/secret_scanning_pattern_configs_test.go b/github/secret_scanning_pattern_configs_test.go index d41dfb4770a..de68d2d1c1f 100644 --- a/github/secret_scanning_pattern_configs_test.go +++ b/github/secret_scanning_pattern_configs_test.go @@ -63,37 +63,37 @@ func TestSecretScanningService_ListPatternConfigsForEnterprise(t *testing.T) { } want := &SecretScanningPatternConfigs{ - PatternConfigVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + PatternConfigVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), ProviderPatternOverrides: []*SecretScanningPatternOverride{ { - TokenType: Ptr("GITHUB_PERSONAL_ACCESS_TOKEN"), + TokenType: new("GITHUB_PERSONAL_ACCESS_TOKEN"), CustomPatternVersion: nil, - Slug: Ptr("github_personal_access_token_legacy_v2"), - DisplayName: Ptr("GitHub Personal Access Token (Legacy v2)"), - AlertTotal: Ptr(15), - AlertTotalPercentage: Ptr(36), - FalsePositives: Ptr(2), - FalsePositiveRate: Ptr(13), - Bypassrate: Ptr(13), - DefaultSetting: Ptr("enabled"), - EnterpriseSetting: Ptr("enabled"), - Setting: Ptr("enabled"), + Slug: new("github_personal_access_token_legacy_v2"), + DisplayName: new("GitHub Personal Access Token (Legacy v2)"), + AlertTotal: new(15), + AlertTotalPercentage: new(36), + FalsePositives: new(2), + FalsePositiveRate: new(13), + Bypassrate: new(13), + DefaultSetting: new("enabled"), + EnterpriseSetting: new("enabled"), + Setting: new("enabled"), }, }, CustomPatternOverrides: []*SecretScanningPatternOverride{ { - TokenType: Ptr("cp_2"), - CustomPatternVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), - Slug: Ptr("custom-api-key"), - DisplayName: Ptr("Custom API Key"), - AlertTotal: Ptr(15), - AlertTotalPercentage: Ptr(36), - FalsePositives: Ptr(3), - FalsePositiveRate: Ptr(20), - Bypassrate: Ptr(20), - DefaultSetting: Ptr("disabled"), + TokenType: new("cp_2"), + CustomPatternVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), + Slug: new("custom-api-key"), + DisplayName: new("Custom API Key"), + AlertTotal: new(15), + AlertTotalPercentage: new(36), + FalsePositives: new(3), + FalsePositiveRate: new(20), + Bypassrate: new(20), + DefaultSetting: new("disabled"), EnterpriseSetting: nil, - Setting: Ptr("enabled"), + Setting: new("enabled"), }, }, } @@ -164,37 +164,37 @@ func TestSecretScanningService_ListPatternConfigsForOrg(t *testing.T) { } want := &SecretScanningPatternConfigs{ - PatternConfigVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + PatternConfigVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), ProviderPatternOverrides: []*SecretScanningPatternOverride{ { - TokenType: Ptr("GITHUB_PERSONAL_ACCESS_TOKEN"), + TokenType: new("GITHUB_PERSONAL_ACCESS_TOKEN"), CustomPatternVersion: nil, - Slug: Ptr("github_personal_access_token_legacy_v2"), - DisplayName: Ptr("GitHub Personal Access Token (Legacy v2)"), - AlertTotal: Ptr(15), - AlertTotalPercentage: Ptr(36), - FalsePositives: Ptr(2), - FalsePositiveRate: Ptr(13), - Bypassrate: Ptr(13), - DefaultSetting: Ptr("enabled"), - EnterpriseSetting: Ptr("enabled"), - Setting: Ptr("enabled"), + Slug: new("github_personal_access_token_legacy_v2"), + DisplayName: new("GitHub Personal Access Token (Legacy v2)"), + AlertTotal: new(15), + AlertTotalPercentage: new(36), + FalsePositives: new(2), + FalsePositiveRate: new(13), + Bypassrate: new(13), + DefaultSetting: new("enabled"), + EnterpriseSetting: new("enabled"), + Setting: new("enabled"), }, }, CustomPatternOverrides: []*SecretScanningPatternOverride{ { - TokenType: Ptr("cp_2"), - CustomPatternVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), - Slug: Ptr("custom-api-key"), - DisplayName: Ptr("Custom API Key"), - AlertTotal: Ptr(15), - AlertTotalPercentage: Ptr(36), - FalsePositives: Ptr(3), - FalsePositiveRate: Ptr(20), - Bypassrate: Ptr(20), - DefaultSetting: Ptr("disabled"), + TokenType: new("cp_2"), + CustomPatternVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), + Slug: new("custom-api-key"), + DisplayName: new("Custom API Key"), + AlertTotal: new(15), + AlertTotalPercentage: new(36), + FalsePositives: new(3), + FalsePositiveRate: new(20), + Bypassrate: new(20), + DefaultSetting: new("disabled"), EnterpriseSetting: nil, - Setting: Ptr("enabled"), + Setting: new("enabled"), }, }, } @@ -231,7 +231,7 @@ func TestSecretScanningService_UpdatePatternConfigsForEnterprise(t *testing.T) { ctx := t.Context() opts := &SecretScanningPatternConfigsUpdateOptions{ - PatternConfigVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + PatternConfigVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), ProviderPatternSettings: []*SecretScanningProviderPatternSetting{ { TokenType: "GITHUB_PERSONAL_ACCESS_TOKEN", @@ -241,7 +241,7 @@ func TestSecretScanningService_UpdatePatternConfigsForEnterprise(t *testing.T) { CustomPatternSettings: []*SecretScanningCustomPatternSetting{ { TokenType: "cp_2", - CustomPatternVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + CustomPatternVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), PushProtectionSetting: "enabled", }, }, @@ -253,7 +253,7 @@ func TestSecretScanningService_UpdatePatternConfigsForEnterprise(t *testing.T) { } want := &SecretScanningPatternConfigsUpdate{ - PatternConfigVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + PatternConfigVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), } if !cmp.Equal(configsUpdate, want) { @@ -288,7 +288,7 @@ func TestSecretScanningService_UpdatePatternConfigsForOrg(t *testing.T) { ctx := t.Context() opts := &SecretScanningPatternConfigsUpdateOptions{ - PatternConfigVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + PatternConfigVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), ProviderPatternSettings: []*SecretScanningProviderPatternSetting{ { TokenType: "GITHUB_PERSONAL_ACCESS_TOKEN", @@ -298,7 +298,7 @@ func TestSecretScanningService_UpdatePatternConfigsForOrg(t *testing.T) { CustomPatternSettings: []*SecretScanningCustomPatternSetting{ { TokenType: "cp_2", - CustomPatternVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + CustomPatternVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), PushProtectionSetting: "enabled", }, }, @@ -310,7 +310,7 @@ func TestSecretScanningService_UpdatePatternConfigsForOrg(t *testing.T) { } want := &SecretScanningPatternConfigsUpdate{ - PatternConfigVersion: Ptr("0ujsswThIGTUYm2K8FjOOfXtY1K"), + PatternConfigVersion: new("0ujsswThIGTUYm2K8FjOOfXtY1K"), } if !cmp.Equal(configsUpdate, want) { diff --git a/github/secret_scanning_test.go b/github/secret_scanning_test.go index 852e3da073f..e23cb5e42f9 100644 --- a/github/secret_scanning_test.go +++ b/github/secret_scanning_test.go @@ -51,21 +51,21 @@ func TestSecretScanningService_ListAlertsForEnterprise(t *testing.T) { want := []*SecretScanningAlert{ { - Number: Ptr(1), + Number: new(1), CreatedAt: refTimestamp(1136178000), - URL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: Ptr("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: Ptr("open"), + URL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), + HTMLURL: new("https://github.com/o/r/security/secret-scanning/1"), + LocationsURL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), + State: new("open"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: Ptr("mailchimp_api_key"), - Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: new("mailchimp_api_key"), + Secret: new("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), Repository: &Repository{ - ID: Ptr(int64(1)), - URL: Ptr("url"), - Name: Ptr("n"), + ID: new(int64(1)), + URL: new("url"), + Name: new("n"), }, }, } @@ -120,17 +120,17 @@ func TestSecretScanningService_ListAlertsForOrg(t *testing.T) { want := []*SecretScanningAlert{ { - Number: Ptr(1), + Number: new(1), CreatedAt: refTimestamp(1136178000), - URL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: Ptr("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: Ptr("open"), + URL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), + HTMLURL: new("https://github.com/o/r/security/secret-scanning/1"), + LocationsURL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), + State: new("open"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: Ptr("mailchimp_api_key"), - Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: new("mailchimp_api_key"), + Secret: new("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), }, } @@ -186,17 +186,17 @@ func TestSecretScanningService_ListAlertsForOrgListOptions(t *testing.T) { want := []*SecretScanningAlert{ { - Number: Ptr(1), + Number: new(1), CreatedAt: refTimestamp(1136178000), - URL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: Ptr("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: Ptr("open"), + URL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), + HTMLURL: new("https://github.com/o/r/security/secret-scanning/1"), + LocationsURL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), + State: new("open"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: Ptr("mailchimp_api_key"), - Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: new("mailchimp_api_key"), + Secret: new("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), }, } @@ -250,17 +250,17 @@ func TestSecretScanningService_ListAlertsForRepo(t *testing.T) { want := []*SecretScanningAlert{ { - Number: Ptr(1), + Number: new(1), CreatedAt: refTimestamp(1136178000), - URL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: Ptr("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: Ptr("open"), + URL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), + HTMLURL: new("https://github.com/o/r/security/secret-scanning/1"), + LocationsURL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), + State: new("open"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: Ptr("mailchimp_api_key"), - Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: new("mailchimp_api_key"), + Secret: new("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), }, } @@ -311,17 +311,17 @@ func TestSecretScanningService_GetAlert(t *testing.T) { } want := &SecretScanningAlert{ - Number: Ptr(1), + Number: new(1), CreatedAt: refTimestamp(1136178000), - URL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: Ptr("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: Ptr("open"), + URL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), + HTMLURL: new("https://github.com/o/r/security/secret-scanning/1"), + LocationsURL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), + State: new("open"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: Ptr("mailchimp_api_key"), - Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: new("mailchimp_api_key"), + Secret: new("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), } if !cmp.Equal(alert, want) { @@ -345,7 +345,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: Ptr("used_in_tests")} + opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: new("used_in_tests")} mux.HandleFunc("/repos/o/r/secret-scanning/alerts/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -373,18 +373,18 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { } want := &SecretScanningAlert{ - Number: Ptr(1), + Number: new(1), CreatedAt: refTimestamp(1136178000), - URL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: Ptr("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: Ptr("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: Ptr("resolved"), - Resolution: Ptr("used_in_tests"), - ResolutionComment: Ptr("resolution comment"), + URL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), + HTMLURL: new("https://github.com/o/r/security/secret-scanning/1"), + LocationsURL: new("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), + State: new("resolved"), + Resolution: new("used_in_tests"), + ResolutionComment: new("resolution comment"), ResolvedAt: refTimestamp(1136178001), ResolvedBy: nil, - SecretType: Ptr("mailchimp_api_key"), - Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: new("mailchimp_api_key"), + Secret: new("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), } if !cmp.Equal(alert, want) { @@ -438,17 +438,17 @@ func TestSecretScanningService_ListLocationsForAlert(t *testing.T) { want := []*SecretScanningAlertLocation{ { - Type: Ptr("commit"), + Type: new("commit"), Details: &SecretScanningAlertLocationDetails{ - Path: Ptr("/example/secrets.txt"), - Startline: Ptr(1), - EndLine: Ptr(1), - StartColumn: Ptr(1), - EndColumn: Ptr(64), - BlobSHA: Ptr("af5626b4a114abcb82d63db7c8082c3c4756e51b"), - BlobURL: Ptr("https://api.github.com/repos/o/r/git/blobs/af5626b4a114abcb82d63db7c8082c3c4756e51b"), - CommitSHA: Ptr("f14d7debf9775f957cf4f1e8176da0786431f72b"), - CommitURL: Ptr("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), + Path: new("/example/secrets.txt"), + Startline: new(1), + EndLine: new(1), + StartColumn: new(1), + EndColumn: new(64), + BlobSHA: new("af5626b4a114abcb82d63db7c8082c3c4756e51b"), + BlobURL: new("https://api.github.com/repos/o/r/git/blobs/af5626b4a114abcb82d63db7c8082c3c4756e51b"), + CommitSHA: new("f14d7debf9775f957cf4f1e8176da0786431f72b"), + CommitURL: new("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), }, }, } @@ -564,8 +564,8 @@ func TestSecretScanningService_GetScanHistory(t *testing.T) { CustomPatternBackfillScans: []*CustomPatternBackfillScan{ { SecretsScan: SecretsScan{Type: "custom_backfill", Status: "in_progress", CompletedAt: nil, StartedAt: refTimestamp(1136178002)}, - PatternSlug: Ptr("my-custom-pattern"), - PatternScope: Ptr("organization"), + PatternSlug: new("my-custom-pattern"), + PatternScope: new("organization"), }, }, } diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index cea5b9abe90..9f0acfc34db 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -170,105 +170,105 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork(t *testing.T) { } want := &Repository{ - ID: Ptr(int64(1)), - NodeID: Ptr("R_kgDPP3c6pQ"), + ID: new(int64(1)), + NodeID: new("R_kgDPP3c6pQ"), Owner: &User{ - Login: Ptr("owner"), - ID: Ptr(int64(2)), - NodeID: Ptr("MDQ6VXFGcjYyMjcyMTQw"), - AvatarURL: Ptr("https://avatars.githubusercontent.com/u/111111?v=4"), - HTMLURL: Ptr("https://github.com/xxxxx"), - GravatarID: Ptr(""), - Type: Ptr("User"), - SiteAdmin: Ptr(false), - URL: Ptr("https://api.github.com/users/owner"), - EventsURL: Ptr("https://api.github.com/users/owner/events{/privacy}"), - FollowingURL: Ptr("https://api.github.com/users/owner/following{/other_user}"), - FollowersURL: Ptr("https://api.github.com/users/owner/followers"), - GistsURL: Ptr("https://api.github.com/users/owner/gists{/gist_id}"), - OrganizationsURL: Ptr("https://api.github.com/users/owner/orgs"), - ReceivedEventsURL: Ptr("https://api.github.com/users/owner/received_events"), - ReposURL: Ptr("https://api.github.com/users/owner/repos"), - StarredURL: Ptr("https://api.github.com/users/owner/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/owner/subscriptions"), + Login: new("owner"), + ID: new(int64(2)), + NodeID: new("MDQ6VXFGcjYyMjcyMTQw"), + AvatarURL: new("https://avatars.githubusercontent.com/u/111111?v=4"), + HTMLURL: new("https://github.com/xxxxx"), + GravatarID: new(""), + Type: new("User"), + SiteAdmin: new(false), + URL: new("https://api.github.com/users/owner"), + EventsURL: new("https://api.github.com/users/owner/events{/privacy}"), + FollowingURL: new("https://api.github.com/users/owner/following{/other_user}"), + FollowersURL: new("https://api.github.com/users/owner/followers"), + GistsURL: new("https://api.github.com/users/owner/gists{/gist_id}"), + OrganizationsURL: new("https://api.github.com/users/owner/orgs"), + ReceivedEventsURL: new("https://api.github.com/users/owner/received_events"), + ReposURL: new("https://api.github.com/users/owner/repos"), + StarredURL: new("https://api.github.com/users/owner/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/owner/subscriptions"), }, - Name: Ptr("repo-ghsa-xxxx-xxxx-xxxx"), - FullName: Ptr("owner/repo-ghsa-xxxx-xxxx-xxxx"), - DefaultBranch: Ptr("master"), + Name: new("repo-ghsa-xxxx-xxxx-xxxx"), + FullName: new("owner/repo-ghsa-xxxx-xxxx-xxxx"), + DefaultBranch: new("master"), CreatedAt: refTimestamp(1136178000), PushedAt: refTimestamp(1136178001), UpdatedAt: refTimestamp(1136178002), - HTMLURL: Ptr("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - CloneURL: Ptr("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - GitURL: Ptr("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SSHURL: Ptr("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SVNURL: Ptr("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - Fork: Ptr(false), - ForksCount: Ptr(0), - NetworkCount: Ptr(0), - OpenIssuesCount: Ptr(0), - OpenIssues: Ptr(0), - StargazersCount: Ptr(0), - SubscribersCount: Ptr(0), - WatchersCount: Ptr(0), - Watchers: Ptr(0), - Size: Ptr(0), + HTMLURL: new("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + CloneURL: new("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + GitURL: new("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SSHURL: new("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SVNURL: new("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + Fork: new(false), + ForksCount: new(0), + NetworkCount: new(0), + OpenIssuesCount: new(0), + OpenIssues: new(0), + StargazersCount: new(0), + SubscribersCount: new(0), + WatchersCount: new(0), + Watchers: new(0), + Size: new(0), Permissions: &RepositoryPermissions{ - Admin: Ptr(true), - Maintain: Ptr(true), - Pull: Ptr(true), - Push: Ptr(true), - Triage: Ptr(true), + Admin: new(true), + Maintain: new(true), + Pull: new(true), + Push: new(true), + Triage: new(true), }, - AllowForking: Ptr(true), - WebCommitSignoffRequired: Ptr(false), - Archived: Ptr(false), - Disabled: Ptr(false), - Private: Ptr(true), - HasIssues: Ptr(false), - HasWiki: Ptr(false), - HasPages: Ptr(false), - HasProjects: Ptr(false), - HasDownloads: Ptr(false), - HasDiscussions: Ptr(false), - IsTemplate: Ptr(false), - URL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), - ArchiveURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), - AssigneesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), - BlobsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), - BranchesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), - CollaboratorsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), - CommentsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), - CommitsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), - CompareURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), - ContentsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), - ContributorsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), - DeploymentsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), - DownloadsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), - EventsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), - ForksURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), - GitCommitsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), - GitRefsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), - GitTagsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), - HooksURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), - IssueCommentURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), - IssueEventsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), - IssuesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), - KeysURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), - LabelsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), - LanguagesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), - MergesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), - MilestonesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), - NotificationsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), - PullsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), - ReleasesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), - StargazersURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), - StatusesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), - SubscribersURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), - SubscriptionURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), - TagsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), - TeamsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), - Visibility: Ptr("private"), + AllowForking: new(true), + WebCommitSignoffRequired: new(false), + Archived: new(false), + Disabled: new(false), + Private: new(true), + HasIssues: new(false), + HasWiki: new(false), + HasPages: new(false), + HasProjects: new(false), + HasDownloads: new(false), + HasDiscussions: new(false), + IsTemplate: new(false), + URL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), + ArchiveURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), + AssigneesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), + BlobsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), + BranchesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), + CollaboratorsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), + CommentsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), + CommitsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), + CompareURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), + ContentsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), + ContributorsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), + DeploymentsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), + DownloadsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), + EventsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), + ForksURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), + GitCommitsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), + GitRefsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), + GitTagsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), + HooksURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), + IssueCommentURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), + IssueEventsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), + IssuesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), + KeysURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), + LabelsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), + LanguagesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), + MergesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), + MilestonesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), + NotificationsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), + PullsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), + ReleasesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), + StargazersURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), + StatusesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), + SubscribersURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), + SubscriptionURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), + TagsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), + TeamsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), + Visibility: new("private"), } if !cmp.Equal(fork, want) { t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned %+v, want %+v", fork, want) @@ -406,105 +406,105 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork_deferred(t *testin } want := &Repository{ - ID: Ptr(int64(1)), - NodeID: Ptr("R_kgDPP3c6pQ"), + ID: new(int64(1)), + NodeID: new("R_kgDPP3c6pQ"), Owner: &User{ - Login: Ptr("owner"), - ID: Ptr(int64(2)), - NodeID: Ptr("MDQ6VXFGcjYyMjcyMTQw"), - AvatarURL: Ptr("https://avatars.githubusercontent.com/u/111111?v=4"), - HTMLURL: Ptr("https://github.com/xxxxx"), - GravatarID: Ptr(""), - Type: Ptr("User"), - SiteAdmin: Ptr(false), - URL: Ptr("https://api.github.com/users/owner"), - EventsURL: Ptr("https://api.github.com/users/owner/events{/privacy}"), - FollowingURL: Ptr("https://api.github.com/users/owner/following{/other_user}"), - FollowersURL: Ptr("https://api.github.com/users/owner/followers"), - GistsURL: Ptr("https://api.github.com/users/owner/gists{/gist_id}"), - OrganizationsURL: Ptr("https://api.github.com/users/owner/orgs"), - ReceivedEventsURL: Ptr("https://api.github.com/users/owner/received_events"), - ReposURL: Ptr("https://api.github.com/users/owner/repos"), - StarredURL: Ptr("https://api.github.com/users/owner/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/owner/subscriptions"), + Login: new("owner"), + ID: new(int64(2)), + NodeID: new("MDQ6VXFGcjYyMjcyMTQw"), + AvatarURL: new("https://avatars.githubusercontent.com/u/111111?v=4"), + HTMLURL: new("https://github.com/xxxxx"), + GravatarID: new(""), + Type: new("User"), + SiteAdmin: new(false), + URL: new("https://api.github.com/users/owner"), + EventsURL: new("https://api.github.com/users/owner/events{/privacy}"), + FollowingURL: new("https://api.github.com/users/owner/following{/other_user}"), + FollowersURL: new("https://api.github.com/users/owner/followers"), + GistsURL: new("https://api.github.com/users/owner/gists{/gist_id}"), + OrganizationsURL: new("https://api.github.com/users/owner/orgs"), + ReceivedEventsURL: new("https://api.github.com/users/owner/received_events"), + ReposURL: new("https://api.github.com/users/owner/repos"), + StarredURL: new("https://api.github.com/users/owner/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/owner/subscriptions"), }, - Name: Ptr("repo-ghsa-xxxx-xxxx-xxxx"), - FullName: Ptr("owner/repo-ghsa-xxxx-xxxx-xxxx"), - DefaultBranch: Ptr("master"), + Name: new("repo-ghsa-xxxx-xxxx-xxxx"), + FullName: new("owner/repo-ghsa-xxxx-xxxx-xxxx"), + DefaultBranch: new("master"), CreatedAt: refTimestamp(1136178000), PushedAt: refTimestamp(1136178001), UpdatedAt: refTimestamp(1136178002), - HTMLURL: Ptr("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - CloneURL: Ptr("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - GitURL: Ptr("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SSHURL: Ptr("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SVNURL: Ptr("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - Fork: Ptr(false), - ForksCount: Ptr(0), - NetworkCount: Ptr(0), - OpenIssuesCount: Ptr(0), - OpenIssues: Ptr(0), - StargazersCount: Ptr(0), - SubscribersCount: Ptr(0), - WatchersCount: Ptr(0), - Watchers: Ptr(0), - Size: Ptr(0), + HTMLURL: new("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + CloneURL: new("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + GitURL: new("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SSHURL: new("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SVNURL: new("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + Fork: new(false), + ForksCount: new(0), + NetworkCount: new(0), + OpenIssuesCount: new(0), + OpenIssues: new(0), + StargazersCount: new(0), + SubscribersCount: new(0), + WatchersCount: new(0), + Watchers: new(0), + Size: new(0), Permissions: &RepositoryPermissions{ - Admin: Ptr(true), - Maintain: Ptr(true), - Pull: Ptr(true), - Push: Ptr(true), - Triage: Ptr(true), + Admin: new(true), + Maintain: new(true), + Pull: new(true), + Push: new(true), + Triage: new(true), }, - AllowForking: Ptr(true), - WebCommitSignoffRequired: Ptr(false), - Archived: Ptr(false), - Disabled: Ptr(false), - Private: Ptr(true), - HasIssues: Ptr(false), - HasWiki: Ptr(false), - HasPages: Ptr(false), - HasProjects: Ptr(false), - HasDownloads: Ptr(false), - HasDiscussions: Ptr(false), - IsTemplate: Ptr(false), - URL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), - ArchiveURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), - AssigneesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), - BlobsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), - BranchesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), - CollaboratorsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), - CommentsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), - CommitsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), - CompareURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), - ContentsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), - ContributorsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), - DeploymentsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), - DownloadsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), - EventsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), - ForksURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), - GitCommitsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), - GitRefsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), - GitTagsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), - HooksURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), - IssueCommentURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), - IssueEventsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), - IssuesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), - KeysURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), - LabelsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), - LanguagesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), - MergesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), - MilestonesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), - NotificationsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), - PullsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), - ReleasesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), - StargazersURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), - StatusesURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), - SubscribersURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), - SubscriptionURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), - TagsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), - TeamsURL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), - Visibility: Ptr("private"), + AllowForking: new(true), + WebCommitSignoffRequired: new(false), + Archived: new(false), + Disabled: new(false), + Private: new(true), + HasIssues: new(false), + HasWiki: new(false), + HasPages: new(false), + HasProjects: new(false), + HasDownloads: new(false), + HasDiscussions: new(false), + IsTemplate: new(false), + URL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), + ArchiveURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), + AssigneesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), + BlobsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), + BranchesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), + CollaboratorsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), + CommentsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), + CommitsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), + CompareURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), + ContentsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), + ContributorsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), + DeploymentsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), + DownloadsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), + EventsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), + ForksURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), + GitCommitsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), + GitRefsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), + GitTagsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), + HooksURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), + IssueCommentURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), + IssueEventsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), + IssuesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), + KeysURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), + LabelsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), + LanguagesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), + MergesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), + MilestonesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), + NotificationsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), + PullsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), + ReleasesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), + StargazersURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), + StatusesURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), + SubscribersURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), + SubscriptionURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), + TagsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), + TeamsURL: new("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), + Visibility: new("private"), } if !cmp.Equal(fork, want) { t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned %+v, want %+v", fork, want) @@ -616,8 +616,8 @@ func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg(t *tes want := []*SecurityAdvisory{ { - GHSAID: Ptr("GHSA-abcd-1234-efgh"), - CVEID: Ptr("CVE-2050-00000"), + GHSAID: new("GHSA-abcd-1234-efgh"), + CVEID: new("CVE-2050-00000"), }, } if !cmp.Equal(advisories, want) { @@ -717,8 +717,8 @@ func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories(t *testing.T want := []*SecurityAdvisory{ { - GHSAID: Ptr("GHSA-abcd-1234-efgh"), - CVEID: Ptr("CVE-2050-00000"), + GHSAID: new("GHSA-abcd-1234-efgh"), + CVEID: new("CVE-2050-00000"), }, } if !cmp.Equal(advisories, want) { @@ -833,7 +833,7 @@ func TestListGlobalSecurityAdvisories(t *testing.T) { }) ctx := t.Context() - opts := &ListGlobalSecurityAdvisoriesOptions{CVEID: Ptr("CVE-xoxo-1234")} + opts := &ListGlobalSecurityAdvisoriesOptions{CVEID: new("CVE-xoxo-1234")} advisories, _, err := client.SecurityAdvisories.ListGlobalSecurityAdvisories(ctx, opts) if err != nil { @@ -842,46 +842,46 @@ func TestListGlobalSecurityAdvisories(t *testing.T) { want := []*GlobalSecurityAdvisory{ { - ID: Ptr(int64(1)), + ID: new(int64(1)), SecurityAdvisory: SecurityAdvisory{ - GHSAID: Ptr("GHSA-xoxo-1234-xoxo"), - CVEID: Ptr("CVE-xoxo-1234"), - URL: Ptr("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), - HTMLURL: Ptr("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), - Severity: Ptr("high"), - Summary: Ptr("Heartbleed security advisory"), - Description: Ptr("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + GHSAID: new("GHSA-xoxo-1234-xoxo"), + CVEID: new("CVE-xoxo-1234"), + URL: new("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), + HTMLURL: new("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), + Severity: new("high"), + Summary: new("Heartbleed security advisory"), + Description: new("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), Identifiers: []*AdvisoryIdentifier{ { - Type: Ptr("GHSA"), - Value: Ptr("GHSA-xoxo-1234-xoxo"), + Type: new("GHSA"), + Value: new("GHSA-xoxo-1234-xoxo"), }, { - Type: Ptr("CVE"), - Value: Ptr("CVE-xoxo-1234"), + Type: new("CVE"), + Value: new("CVE-xoxo-1234"), }, }, PublishedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), WithdrawnAt: nil, CVSS: &AdvisoryCVSS{ - VectorString: Ptr("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), - Score: Ptr(7.6), + VectorString: new("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), + Score: new(7.6), }, CVSSSeverities: &AdvisoryCVSSSeverities{ CVSSV3: &AdvisoryCVSS{ - VectorString: Ptr("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), - Score: Ptr(7.6), + VectorString: new("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), + Score: new(7.6), }, CVSSV4: &AdvisoryCVSS{ - VectorString: Ptr("CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"), - Score: Ptr(8.7), + VectorString: new("CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"), + Score: new(8.7), }, }, CWEs: []*AdvisoryCWEs{ { - CWEID: Ptr("CWE-400"), - Name: Ptr("Uncontrolled Resource Consumption"), + CWEID: new("CWE-400"), + Name: new("Uncontrolled Resource Consumption"), }, }, }, @@ -889,42 +889,42 @@ func TestListGlobalSecurityAdvisories(t *testing.T) { Vulnerabilities: []*GlobalSecurityVulnerability{ { Package: &VulnerabilityPackage{ - Ecosystem: Ptr("npm"), - Name: Ptr("a-package"), + Ecosystem: new("npm"), + Name: new("a-package"), }, - FirstPatchedVersion: Ptr("1.0.3"), - VulnerableVersionRange: Ptr("<=1.0.2"), + FirstPatchedVersion: new("1.0.3"), + VulnerableVersionRange: new("<=1.0.2"), VulnerableFunctions: []string{"a_function"}, }, }, - RepositoryAdvisoryURL: Ptr("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), - Type: Ptr("reviewed"), - SourceCodeLocation: Ptr("https://github.com/project/a-package"), + RepositoryAdvisoryURL: new("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), + Type: new("reviewed"), + SourceCodeLocation: new("https://github.com/project/a-package"), GithubReviewedAt: refTimestamp(1136178002), NVDPublishedAt: refTimestamp(1136178003), Credits: []*Credit{ { User: &User{ - Login: Ptr("user"), - ID: Ptr(int64(1)), - NodeID: Ptr("12="), - AvatarURL: Ptr("a"), - GravatarID: Ptr(""), - URL: Ptr("a"), - HTMLURL: Ptr("b"), - FollowersURL: Ptr("b"), - FollowingURL: Ptr("c"), - GistsURL: Ptr("d"), - StarredURL: Ptr("e"), - SubscriptionsURL: Ptr("f"), - OrganizationsURL: Ptr("g"), - ReposURL: Ptr("h"), - EventsURL: Ptr("i"), - ReceivedEventsURL: Ptr("j"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("user"), + ID: new(int64(1)), + NodeID: new("12="), + AvatarURL: new("a"), + GravatarID: new(""), + URL: new("a"), + HTMLURL: new("b"), + FollowersURL: new("b"), + FollowingURL: new("c"), + GistsURL: new("d"), + StarredURL: new("e"), + SubscriptionsURL: new("f"), + OrganizationsURL: new("g"), + ReposURL: new("h"), + EventsURL: new("i"), + ReceivedEventsURL: new("j"), + Type: new("User"), + SiteAdmin: new(false), }, - Type: Ptr("analyst"), + Type: new("analyst"), }, }, }, @@ -1036,52 +1036,52 @@ func TestGetGlobalSecurityAdvisories(t *testing.T) { } want := &GlobalSecurityAdvisory{ - ID: Ptr(int64(1)), + ID: new(int64(1)), SecurityAdvisory: SecurityAdvisory{ - GHSAID: Ptr("GHSA-xoxo-1234-xoxo"), - CVEID: Ptr("CVE-xoxo-1234"), - URL: Ptr("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), - HTMLURL: Ptr("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), - Severity: Ptr("high"), - Summary: Ptr("Heartbleed security advisory"), - Description: Ptr("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + GHSAID: new("GHSA-xoxo-1234-xoxo"), + CVEID: new("CVE-xoxo-1234"), + URL: new("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), + HTMLURL: new("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), + Severity: new("high"), + Summary: new("Heartbleed security advisory"), + Description: new("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), Identifiers: []*AdvisoryIdentifier{ { - Type: Ptr("GHSA"), - Value: Ptr("GHSA-xoxo-1234-xoxo"), + Type: new("GHSA"), + Value: new("GHSA-xoxo-1234-xoxo"), }, { - Type: Ptr("CVE"), - Value: Ptr("CVE-xoxo-1234"), + Type: new("CVE"), + Value: new("CVE-xoxo-1234"), }, }, PublishedAt: refTimestamp(1136178000), UpdatedAt: refTimestamp(1136178001), WithdrawnAt: nil, CVSS: &AdvisoryCVSS{ - VectorString: Ptr("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), - Score: Ptr(7.6), + VectorString: new("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), + Score: new(7.6), }, CVSSSeverities: &AdvisoryCVSSSeverities{ CVSSV3: &AdvisoryCVSS{ - VectorString: Ptr("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), - Score: Ptr(7.6), + VectorString: new("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), + Score: new(7.6), }, CVSSV4: &AdvisoryCVSS{ - VectorString: Ptr("CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"), - Score: Ptr(8.7), + VectorString: new("CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"), + Score: new(8.7), }, }, CWEs: []*AdvisoryCWEs{ { - CWEID: Ptr("CWE-400"), - Name: Ptr("Uncontrolled Resource Consumption"), + CWEID: new("CWE-400"), + Name: new("Uncontrolled Resource Consumption"), }, }, }, - RepositoryAdvisoryURL: Ptr("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), - Type: Ptr("reviewed"), - SourceCodeLocation: Ptr("https://github.com/project/a-package"), + RepositoryAdvisoryURL: new("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), + Type: new("reviewed"), + SourceCodeLocation: new("https://github.com/project/a-package"), References: []string{"https://nvd.nist.gov/vuln/detail/CVE-xoxo-1234"}, GithubReviewedAt: refTimestamp(1136178002), NVDPublishedAt: refTimestamp(1136178003), @@ -1089,37 +1089,37 @@ func TestGetGlobalSecurityAdvisories(t *testing.T) { Vulnerabilities: []*GlobalSecurityVulnerability{ { Package: &VulnerabilityPackage{ - Ecosystem: Ptr("npm"), - Name: Ptr("a-package"), + Ecosystem: new("npm"), + Name: new("a-package"), }, - FirstPatchedVersion: Ptr("1.0.3"), - VulnerableVersionRange: Ptr("<=1.0.2"), + FirstPatchedVersion: new("1.0.3"), + VulnerableVersionRange: new("<=1.0.2"), VulnerableFunctions: []string{"a_function"}, }, }, Credits: []*Credit{ { User: &User{ - Login: Ptr("user"), - ID: Ptr(int64(1)), - NodeID: Ptr("12="), - AvatarURL: Ptr("a"), - GravatarID: Ptr(""), - URL: Ptr("a"), - HTMLURL: Ptr("b"), - FollowersURL: Ptr("b"), - FollowingURL: Ptr("c"), - GistsURL: Ptr("d"), - StarredURL: Ptr("e"), - SubscriptionsURL: Ptr("f"), - OrganizationsURL: Ptr("g"), - ReposURL: Ptr("h"), - EventsURL: Ptr("i"), - ReceivedEventsURL: Ptr("j"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("user"), + ID: new(int64(1)), + NodeID: new("12="), + AvatarURL: new("a"), + GravatarID: new(""), + URL: new("a"), + HTMLURL: new("b"), + FollowersURL: new("b"), + FollowingURL: new("c"), + GistsURL: new("d"), + StarredURL: new("e"), + SubscriptionsURL: new("f"), + OrganizationsURL: new("g"), + ReposURL: new("h"), + EventsURL: new("i"), + ReceivedEventsURL: new("j"), + Type: new("User"), + SiteAdmin: new(false), }, - Type: Ptr("analyst"), + Type: new("analyst"), }, }, } diff --git a/github/strings_benchmark_test.go b/github/strings_benchmark_test.go index b19db42c51e..5998c80632d 100644 --- a/github/strings_benchmark_test.go +++ b/github/strings_benchmark_test.go @@ -27,7 +27,7 @@ func BenchmarkStringify(b *testing.B) { Score: 1.1, Rank: 99.999999, Tags: []string{"go", "github", "api"}, - Pointer: Ptr(42), + Pointer: new(42), } b.ResetTimer() for b.Loop() { diff --git a/github/strings_test.go b/github/strings_test.go index 83392f1f80e..7858924cccf 100644 --- a/github/strings_test.go +++ b/github/strings_test.go @@ -45,12 +45,12 @@ func TestStringify(t *testing.T) { // pointers {nilPointer, ``}, - {Ptr("foo"), `"foo"`}, - {Ptr(123), `123`}, - {Ptr(false), `false`}, + {new("foo"), `"foo"`}, + {new(123), `123`}, + {new(false), `false`}, { //nolint:sliceofpointers - []*string{Ptr("a"), Ptr("b")}, + []*string{new("a"), new("b")}, `["a" "b"]`, }, @@ -64,11 +64,11 @@ func TestStringify(t *testing.T) { `github.Timestamp{2006-01-02 15:04:05 +0000 UTC}`, }, { - User{ID: Ptr(int64(123)), Name: Ptr("n")}, + User{ID: new(int64(123)), Name: new("n")}, `github.User{ID:123, Name:"n"}`, }, { - Repository{Owner: &User{ID: Ptr(int64(123))}}, + Repository{Owner: &User{ID: new(int64(123))}}, `github.Repository{Owner:github.User{ID:123}}`, }, } @@ -178,48 +178,48 @@ func TestString(t *testing.T) { in any out string }{ - {CodeResult{Name: Ptr("n")}, `github.CodeResult{Name:"n"}`}, - {CommitAuthor{Name: Ptr("n")}, `github.CommitAuthor{Name:"n"}`}, - {CommitFile{SHA: Ptr("s")}, `github.CommitFile{SHA:"s"}`}, - {CommitStats{Total: Ptr(1)}, `github.CommitStats{Total:1}`}, - {CommitsComparison{TotalCommits: Ptr(1)}, `github.CommitsComparison{TotalCommits:1}`}, - {Commit{SHA: Ptr("s")}, `github.Commit{SHA:"s"}`}, - {Event{ID: Ptr("1")}, `github.Event{ID:"1"}`}, - {GistComment{ID: Ptr(int64(1))}, `github.GistComment{ID:1}`}, - {GistFile{Size: Ptr(1)}, `github.GistFile{Size:1}`}, - {Gist{ID: Ptr("1")}, `github.Gist{ID:"1"}`}, - {GitObject{SHA: Ptr("s")}, `github.GitObject{SHA:"s"}`}, - {Gitignore{Name: Ptr("n")}, `github.Gitignore{Name:"n"}`}, - {Hook{ID: Ptr(int64(1))}, `github.Hook{ID:1}`}, - {IssueComment{ID: Ptr(int64(1))}, `github.IssueComment{ID:1}`}, - {Issue{Number: Ptr(1)}, `github.Issue{Number:1}`}, - {SubIssue{ID: Ptr(int64(1))}, `github.SubIssue{ID:1}`}, - {Key{ID: Ptr(int64(1))}, `github.Key{ID:1}`}, + {CodeResult{Name: new("n")}, `github.CodeResult{Name:"n"}`}, + {CommitAuthor{Name: new("n")}, `github.CommitAuthor{Name:"n"}`}, + {CommitFile{SHA: new("s")}, `github.CommitFile{SHA:"s"}`}, + {CommitStats{Total: new(1)}, `github.CommitStats{Total:1}`}, + {CommitsComparison{TotalCommits: new(1)}, `github.CommitsComparison{TotalCommits:1}`}, + {Commit{SHA: new("s")}, `github.Commit{SHA:"s"}`}, + {Event{ID: new("1")}, `github.Event{ID:"1"}`}, + {GistComment{ID: new(int64(1))}, `github.GistComment{ID:1}`}, + {GistFile{Size: new(1)}, `github.GistFile{Size:1}`}, + {Gist{ID: new("1")}, `github.Gist{ID:"1"}`}, + {GitObject{SHA: new("s")}, `github.GitObject{SHA:"s"}`}, + {Gitignore{Name: new("n")}, `github.Gitignore{Name:"n"}`}, + {Hook{ID: new(int64(1))}, `github.Hook{ID:1}`}, + {IssueComment{ID: new(int64(1))}, `github.IssueComment{ID:1}`}, + {Issue{Number: new(1)}, `github.Issue{Number:1}`}, + {SubIssue{ID: new(int64(1))}, `github.SubIssue{ID:1}`}, + {Key{ID: new(int64(1))}, `github.Key{ID:1}`}, {Label{ID: 1, Name: "l"}, `github.Label{ID:1, URL:"", Name:"l", Color:"", Default:false, NodeID:""}`}, - {Organization{ID: Ptr(int64(1))}, `github.Organization{ID:1}`}, - {PullRequestComment{ID: Ptr(int64(1))}, `github.PullRequestComment{ID:1}`}, - {PullRequest{Number: Ptr(1)}, `github.PullRequest{Number:1}`}, - {PullRequestReview{ID: Ptr(int64(1))}, `github.PullRequestReview{ID:1}`}, - {DraftReviewComment{Position: Ptr(1)}, `github.DraftReviewComment{Position:1}`}, - {PullRequestReviewRequest{Body: Ptr("r")}, `github.PullRequestReviewRequest{Body:"r"}`}, + {Organization{ID: new(int64(1))}, `github.Organization{ID:1}`}, + {PullRequestComment{ID: new(int64(1))}, `github.PullRequestComment{ID:1}`}, + {PullRequest{Number: new(1)}, `github.PullRequest{Number:1}`}, + {PullRequestReview{ID: new(int64(1))}, `github.PullRequestReview{ID:1}`}, + {DraftReviewComment{Position: new(1)}, `github.DraftReviewComment{Position:1}`}, + {PullRequestReviewRequest{Body: new("r")}, `github.PullRequestReviewRequest{Body:"r"}`}, {PullRequestDismissReviewRequest{Message: "r"}, `github.PullRequestDismissReviewRequest{Message:"r"}`}, - {HeadCommit{SHA: Ptr("s")}, `github.HeadCommit{SHA:"s"}`}, - {PushEvent{PushID: Ptr(int64(1))}, `github.PushEvent{PushID:1}`}, - {Reference{Ref: Ptr("r")}, `github.Reference{Ref:"r"}`}, - {ReleaseAsset{ID: Ptr(int64(1))}, `github.ReleaseAsset{ID:1}`}, - {RepoStatus{ID: Ptr(int64(1))}, `github.RepoStatus{ID:1}`}, - {RepositoryComment{ID: Ptr(int64(1))}, `github.RepositoryComment{ID:1}`}, - {RepositoryCommit{SHA: Ptr("s")}, `github.RepositoryCommit{SHA:"s"}`}, - {RepositoryContent{Name: Ptr("n")}, `github.RepositoryContent{Name:"n"}`}, + {HeadCommit{SHA: new("s")}, `github.HeadCommit{SHA:"s"}`}, + {PushEvent{PushID: new(int64(1))}, `github.PushEvent{PushID:1}`}, + {Reference{Ref: new("r")}, `github.Reference{Ref:"r"}`}, + {ReleaseAsset{ID: new(int64(1))}, `github.ReleaseAsset{ID:1}`}, + {RepoStatus{ID: new(int64(1))}, `github.RepoStatus{ID:1}`}, + {RepositoryComment{ID: new(int64(1))}, `github.RepositoryComment{ID:1}`}, + {RepositoryCommit{SHA: new("s")}, `github.RepositoryCommit{SHA:"s"}`}, + {RepositoryContent{Name: new("n")}, `github.RepositoryContent{Name:"n"}`}, {RepositoryRelease{ID: 1}, `github.RepositoryRelease{TagName:"", TargetCommitish:"", Draft:false, Prerelease:false, ID:1, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, URL:"", HTMLURL:"", AssetsURL:"", UploadURL:"", NodeID:""}`}, - {Repository{ID: Ptr(int64(1))}, `github.Repository{ID:1}`}, - {Team{ID: Ptr(int64(1))}, `github.Team{ID:1}`}, - {TreeEntry{SHA: Ptr("s")}, `github.TreeEntry{SHA:"s"}`}, - {Tree{SHA: Ptr("s")}, `github.Tree{SHA:"s"}`}, - {User{ID: Ptr(int64(1))}, `github.User{ID:1}`}, - {WebHookAuthor{Name: Ptr("n")}, `github.CommitAuthor{Name:"n"}`}, - {WebHookCommit{ID: Ptr("1")}, `github.HeadCommit{ID:"1"}`}, - {WebHookPayload{Ref: Ptr("r")}, `github.PushEvent{Ref:"r"}`}, + {Repository{ID: new(int64(1))}, `github.Repository{ID:1}`}, + {Team{ID: new(int64(1))}, `github.Team{ID:1}`}, + {TreeEntry{SHA: new("s")}, `github.TreeEntry{SHA:"s"}`}, + {Tree{SHA: new("s")}, `github.Tree{SHA:"s"}`}, + {User{ID: new(int64(1))}, `github.User{ID:1}`}, + {WebHookAuthor{Name: new("n")}, `github.CommitAuthor{Name:"n"}`}, + {WebHookCommit{ID: new("1")}, `github.HeadCommit{ID:"1"}`}, + {WebHookPayload{Ref: new("r")}, `github.PushEvent{Ref:"r"}`}, } for i, tt := range tests { diff --git a/github/sub_issue_test.go b/github/sub_issue_test.go index faeea077d6e..920165addcc 100644 --- a/github/sub_issue_test.go +++ b/github/sub_issue_test.go @@ -31,7 +31,7 @@ func TestSubIssuesService_Add(t *testing.T) { t.Errorf("SubIssues.Add returned error: %v", err) } - want := &SubIssue{Number: Ptr(1), ID: Ptr(int64(42))} + want := &SubIssue{Number: new(1), ID: new(int64(42))} if !cmp.Equal(got, want) { t.Errorf("SubIssues.Add = %+v, want %+v", got, want) } @@ -70,7 +70,7 @@ func TestSubIssuesService_ListByIssue(t *testing.T) { t.Errorf("SubIssues.ListByIssue returned error: %v", err) } - want := []*SubIssue{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*SubIssue{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(issues, want) { t.Errorf("SubIssues.ListByIssue = %+v, want %+v", issues, want) } @@ -108,7 +108,7 @@ func TestSubIssuesService_Remove(t *testing.T) { t.Errorf("SubIssues.Remove returned error: %v", err) } - want := &SubIssue{ID: Ptr(int64(42)), Number: Ptr(1)} + want := &SubIssue{ID: new(int64(42)), Number: new(1)} if !cmp.Equal(got, want) { t.Errorf("SubIssues.Remove = %+v, want %+v", got, want) } @@ -127,7 +127,7 @@ func TestSubIssuesService_Reprioritize(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &SubIssueRequest{SubIssueID: 42, AfterID: Ptr(int64(5))} + input := &SubIssueRequest{SubIssueID: 42, AfterID: new(int64(5))} mux.HandleFunc("/repos/o/r/issues/1/sub_issues/priority", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -141,7 +141,7 @@ func TestSubIssuesService_Reprioritize(t *testing.T) { t.Errorf("SubIssues.Reprioritize returned error: %v", err) } - want := &SubIssue{ID: Ptr(int64(42)), Number: Ptr(1)} + want := &SubIssue{ID: new(int64(42)), Number: new(1)} if !cmp.Equal(got, want) { t.Errorf("SubIssues.Reprioritize = %+v, want %+v", got, want) } @@ -172,7 +172,7 @@ func TestSubIssuesService_GetParentIssue(t *testing.T) { t.Errorf("SubIssues.GetParentIssue returned error: %v", err) } - want := &Issue{Number: Ptr(1), ID: Ptr(int64(1))} + want := &Issue{Number: new(1), ID: new(int64(1))} if !cmp.Equal(got, want) { t.Errorf("SubIssues.GetParentIssue = %+v, want %+v", got, want) } diff --git a/github/teams_discussion_comments_test.go b/github/teams_discussion_comments_test.go index c25ba0f12d9..edcc7792459 100644 --- a/github/teams_discussion_comments_test.go +++ b/github/teams_discussion_comments_test.go @@ -80,35 +80,35 @@ func TestTeamsService_ListComments(t *testing.T) { want := []*DiscussionComment{ { Author: &User{ - Login: Ptr("author"), - ID: Ptr(int64(0)), - AvatarURL: Ptr("https://avatars1.githubusercontent.com/u/0?v=4"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/author"), - HTMLURL: Ptr("https://github.com/author"), - FollowersURL: Ptr("https://api.github.com/users/author/followers"), - FollowingURL: Ptr("https://api.github.com/users/author/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/author/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/author/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/author/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/author/orgs"), - ReposURL: Ptr("https://api.github.com/users/author/repos"), - EventsURL: Ptr("https://api.github.com/users/author/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/author/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("author"), + ID: new(int64(0)), + AvatarURL: new("https://avatars1.githubusercontent.com/u/0?v=4"), + GravatarID: new(""), + URL: new("https://api.github.com/users/author"), + HTMLURL: new("https://github.com/author"), + FollowersURL: new("https://api.github.com/users/author/followers"), + FollowingURL: new("https://api.github.com/users/author/following{/other_user}"), + GistsURL: new("https://api.github.com/users/author/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/author/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/author/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/author/orgs"), + ReposURL: new("https://api.github.com/users/author/repos"), + EventsURL: new("https://api.github.com/users/author/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/author/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, - Body: Ptr("comment"), - BodyHTML: Ptr("

comment

"), - BodyVersion: Ptr("version"), + Body: new("comment"), + BodyHTML: new("

comment

"), + BodyVersion: new("version"), CreatedAt: refTimestamp(1136178000), LastEditedAt: nil, - DiscussionURL: Ptr("https://api.github.com/teams/2/discussions/3"), - HTMLURL: Ptr("https://github.com/orgs/1/teams/2/discussions/3/comments/4"), - NodeID: Ptr("node"), - Number: Ptr(4), + DiscussionURL: new("https://api.github.com/teams/2/discussions/3"), + HTMLURL: new("https://github.com/orgs/1/teams/2/discussions/3/comments/4"), + NodeID: new("node"), + Number: new(4), UpdatedAt: refTimestamp(1136178001), - URL: Ptr("https://api.github.com/teams/2/discussions/3/comments/4"), + URL: new("https://api.github.com/teams/2/discussions/3/comments/4"), }, } @@ -180,7 +180,7 @@ func TestTeamsService_GetComment(t *testing.T) { testMethod(t, r, "GET") fmt.Fprint(w, `{"number":4}`) } - want := &DiscussionComment{Number: Ptr(4)} + want := &DiscussionComment{Number: new(4)} e := tdcEndpointByID("1", "2", "3", "4") mux.HandleFunc(e, handlerFunc) @@ -240,14 +240,14 @@ func TestTeamsService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := DiscussionComment{Body: Ptr("c")} + input := DiscussionComment{Body: new("c")} handlerFunc := func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testJSONBody(t, r, input) fmt.Fprint(w, `{"number":4}`) } - want := &DiscussionComment{Number: Ptr(4)} + want := &DiscussionComment{Number: new(4)} e := tdcEndpointByID("1", "2", "3", "") mux.HandleFunc(e, handlerFunc) @@ -307,13 +307,13 @@ func TestTeamsService_EditComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := DiscussionComment{Body: Ptr("e")} + input := DiscussionComment{Body: new("e")} handlerFunc := func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testJSONBody(t, r, input) fmt.Fprint(w, `{"number":4}`) } - want := &DiscussionComment{Number: Ptr(4)} + want := &DiscussionComment{Number: new(4)} e := tdcEndpointByID("1", "2", "3", "4") mux.HandleFunc(e, handlerFunc) diff --git a/github/teams_discussions_test.go b/github/teams_discussions_test.go index 11be8d3ddda..98a9710d68e 100644 --- a/github/teams_discussions_test.go +++ b/github/teams_discussions_test.go @@ -73,40 +73,40 @@ func TestTeamsService_ListDiscussionsByID(t *testing.T) { want := []*TeamDiscussion{ { Author: &User{ - Login: Ptr("author"), - ID: Ptr(int64(0)), - AvatarURL: Ptr("https://avatars1.githubusercontent.com/u/0?v=4"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/author"), - HTMLURL: Ptr("https://github.com/author"), - FollowersURL: Ptr("https://api.github.com/users/author/followers"), - FollowingURL: Ptr("https://api.github.com/users/author/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/author/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/author/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/author/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/author/orgs"), - ReposURL: Ptr("https://api.github.com/users/author/repos"), - EventsURL: Ptr("https://api.github.com/users/author/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/author/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("author"), + ID: new(int64(0)), + AvatarURL: new("https://avatars1.githubusercontent.com/u/0?v=4"), + GravatarID: new(""), + URL: new("https://api.github.com/users/author"), + HTMLURL: new("https://github.com/author"), + FollowersURL: new("https://api.github.com/users/author/followers"), + FollowingURL: new("https://api.github.com/users/author/following{/other_user}"), + GistsURL: new("https://api.github.com/users/author/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/author/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/author/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/author/orgs"), + ReposURL: new("https://api.github.com/users/author/repos"), + EventsURL: new("https://api.github.com/users/author/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/author/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, - Body: Ptr("test"), - BodyHTML: Ptr("

test

"), - BodyVersion: Ptr("version"), - CommentsCount: Ptr(1), - CommentsURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), + Body: new("test"), + BodyHTML: new("

test

"), + BodyVersion: new("version"), + CommentsCount: new(1), + CommentsURL: new("https://api.github.com/teams/2/discussions/3/comments"), CreatedAt: refTimestamp(1136178000), LastEditedAt: nil, - HTMLURL: Ptr("https://github.com/orgs/1/teams/2/discussions/3"), - NodeID: Ptr("node"), - Number: Ptr(3), - Pinned: Ptr(false), - Private: Ptr(false), - TeamURL: Ptr("https://api.github.com/teams/2"), - Title: Ptr("test"), + HTMLURL: new("https://github.com/orgs/1/teams/2/discussions/3"), + NodeID: new("node"), + Number: new(3), + Pinned: new(false), + Private: new(false), + TeamURL: new("https://api.github.com/teams/2"), + Title: new("test"), UpdatedAt: refTimestamp(1136178001), - URL: Ptr("https://api.github.com/teams/2/discussions/3"), + URL: new("https://api.github.com/teams/2/discussions/3"), }, } if !cmp.Equal(discussions, want) { @@ -188,40 +188,40 @@ func TestTeamsService_ListDiscussionsBySlug(t *testing.T) { want := []*TeamDiscussion{ { Author: &User{ - Login: Ptr("author"), - ID: Ptr(int64(0)), - AvatarURL: Ptr("https://avatars1.githubusercontent.com/u/0?v=4"), - GravatarID: Ptr(""), - URL: Ptr("https://api.github.com/users/author"), - HTMLURL: Ptr("https://github.com/author"), - FollowersURL: Ptr("https://api.github.com/users/author/followers"), - FollowingURL: Ptr("https://api.github.com/users/author/following{/other_user}"), - GistsURL: Ptr("https://api.github.com/users/author/gists{/gist_id}"), - StarredURL: Ptr("https://api.github.com/users/author/starred{/owner}{/repo}"), - SubscriptionsURL: Ptr("https://api.github.com/users/author/subscriptions"), - OrganizationsURL: Ptr("https://api.github.com/users/author/orgs"), - ReposURL: Ptr("https://api.github.com/users/author/repos"), - EventsURL: Ptr("https://api.github.com/users/author/events{/privacy}"), - ReceivedEventsURL: Ptr("https://api.github.com/users/author/received_events"), - Type: Ptr("User"), - SiteAdmin: Ptr(false), + Login: new("author"), + ID: new(int64(0)), + AvatarURL: new("https://avatars1.githubusercontent.com/u/0?v=4"), + GravatarID: new(""), + URL: new("https://api.github.com/users/author"), + HTMLURL: new("https://github.com/author"), + FollowersURL: new("https://api.github.com/users/author/followers"), + FollowingURL: new("https://api.github.com/users/author/following{/other_user}"), + GistsURL: new("https://api.github.com/users/author/gists{/gist_id}"), + StarredURL: new("https://api.github.com/users/author/starred{/owner}{/repo}"), + SubscriptionsURL: new("https://api.github.com/users/author/subscriptions"), + OrganizationsURL: new("https://api.github.com/users/author/orgs"), + ReposURL: new("https://api.github.com/users/author/repos"), + EventsURL: new("https://api.github.com/users/author/events{/privacy}"), + ReceivedEventsURL: new("https://api.github.com/users/author/received_events"), + Type: new("User"), + SiteAdmin: new(false), }, - Body: Ptr("test"), - BodyHTML: Ptr("

test

"), - BodyVersion: Ptr("version"), - CommentsCount: Ptr(1), - CommentsURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), + Body: new("test"), + BodyHTML: new("

test

"), + BodyVersion: new("version"), + CommentsCount: new(1), + CommentsURL: new("https://api.github.com/teams/2/discussions/3/comments"), CreatedAt: refTimestamp(1136178000), LastEditedAt: nil, - HTMLURL: Ptr("https://github.com/orgs/1/teams/2/discussions/3"), - NodeID: Ptr("node"), - Number: Ptr(3), - Pinned: Ptr(false), - Private: Ptr(false), - TeamURL: Ptr("https://api.github.com/teams/2"), - Title: Ptr("test"), + HTMLURL: new("https://github.com/orgs/1/teams/2/discussions/3"), + NodeID: new("node"), + Number: new(3), + Pinned: new(false), + Private: new(false), + TeamURL: new("https://api.github.com/teams/2"), + Title: new("test"), UpdatedAt: refTimestamp(1136178001), - URL: Ptr("https://api.github.com/teams/2/discussions/3"), + URL: new("https://api.github.com/teams/2/discussions/3"), }, } if !cmp.Equal(discussions, want) { @@ -258,7 +258,7 @@ func TestTeamsService_GetDiscussionByID(t *testing.T) { t.Errorf("Teams.GetDiscussionByID returned error: %v", err) } - want := &TeamDiscussion{Number: Ptr(3)} + want := &TeamDiscussion{Number: new(3)} if !cmp.Equal(discussion, want) { t.Errorf("Teams.GetDiscussionByID returned %+v, want %+v", discussion, want) } @@ -293,7 +293,7 @@ func TestTeamsService_GetDiscussionBySlug(t *testing.T) { t.Errorf("Teams.GetDiscussionBySlug returned error: %v", err) } - want := &TeamDiscussion{Number: Ptr(3)} + want := &TeamDiscussion{Number: new(3)} if !cmp.Equal(discussion, want) { t.Errorf("Teams.GetDiscussionBySlug returned %+v, want %+v", discussion, want) } @@ -317,7 +317,7 @@ func TestTeamsService_CreateDiscussionByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: Ptr("c_t"), Body: Ptr("c_b")} + input := TeamDiscussion{Title: new("c_t"), Body: new("c_b")} mux.HandleFunc("/organizations/1/team/2/discussions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -331,7 +331,7 @@ func TestTeamsService_CreateDiscussionByID(t *testing.T) { t.Errorf("Teams.CreateDiscussionByID returned error: %v", err) } - want := &TeamDiscussion{Number: Ptr(3)} + want := &TeamDiscussion{Number: new(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.CreateDiscussionByID returned %+v, want %+v", comment, want) } @@ -355,7 +355,7 @@ func TestTeamsService_CreateDiscussionBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: Ptr("c_t"), Body: Ptr("c_b")} + input := TeamDiscussion{Title: new("c_t"), Body: new("c_b")} mux.HandleFunc("/orgs/o/teams/s/discussions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -369,7 +369,7 @@ func TestTeamsService_CreateDiscussionBySlug(t *testing.T) { t.Errorf("Teams.CreateDiscussionBySlug returned error: %v", err) } - want := &TeamDiscussion{Number: Ptr(3)} + want := &TeamDiscussion{Number: new(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.CreateDiscussionBySlug returned %+v, want %+v", comment, want) } @@ -393,7 +393,7 @@ func TestTeamsService_EditDiscussionByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: Ptr("e_t"), Body: Ptr("e_b")} + input := TeamDiscussion{Title: new("e_t"), Body: new("e_b")} mux.HandleFunc("/organizations/1/team/2/discussions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -407,7 +407,7 @@ func TestTeamsService_EditDiscussionByID(t *testing.T) { t.Errorf("Teams.EditDiscussionByID returned error: %v", err) } - want := &TeamDiscussion{Number: Ptr(3)} + want := &TeamDiscussion{Number: new(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.EditDiscussionByID returned %+v, want %+v", comment, want) } @@ -431,7 +431,7 @@ func TestTeamsService_EditDiscussionBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: Ptr("e_t"), Body: Ptr("e_b")} + input := TeamDiscussion{Title: new("e_t"), Body: new("e_b")} mux.HandleFunc("/orgs/o/teams/s/discussions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -445,7 +445,7 @@ func TestTeamsService_EditDiscussionBySlug(t *testing.T) { t.Errorf("Teams.EditDiscussionBySlug returned error: %v", err) } - want := &TeamDiscussion{Number: Ptr(3)} + want := &TeamDiscussion{Number: new(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.EditDiscussionBySlug returned %+v, want %+v", comment, want) } diff --git a/github/teams_members_test.go b/github/teams_members_test.go index 72f775e5028..1bae792cbab 100644 --- a/github/teams_members_test.go +++ b/github/teams_members_test.go @@ -30,7 +30,7 @@ func TestTeamsService_ListTeamMembersByID(t *testing.T) { t.Errorf("Teams.ListTeamMembersByID returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamMembersByID returned %+v, want %+v", members, want) } @@ -105,7 +105,7 @@ func TestTeamsService_ListTeamMembersBySlug(t *testing.T) { t.Errorf("Teams.ListTeamMembersBySlug returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamMembersBySlug returned %+v, want %+v", members, want) } @@ -187,7 +187,7 @@ func TestTeamsService_GetTeamMembershipByID(t *testing.T) { t.Errorf("Teams.GetTeamMembershipByID returned error: %v", err) } - want := &Membership{URL: Ptr("u"), State: Ptr("active")} + want := &Membership{URL: new("u"), State: new("active")} if !cmp.Equal(membership, want) { t.Errorf("Teams.GetTeamMembershipByID returned %+v, want %+v", membership, want) } @@ -258,7 +258,7 @@ func TestTeamsService_GetTeamMembershipBySlug(t *testing.T) { t.Errorf("Teams.GetTeamMembershipBySlug returned error: %v", err) } - want := &Membership{URL: Ptr("u"), State: Ptr("active")} + want := &Membership{URL: new("u"), State: new("active")} if !cmp.Equal(membership, want) { t.Errorf("Teams.GetTeamMembershipBySlug returned %+v, want %+v", membership, want) } @@ -341,7 +341,7 @@ func TestTeamsService_AddTeamMembershipByID(t *testing.T) { t.Errorf("Teams.AddTeamMembershipByID returned error: %v", err) } - want := &Membership{URL: Ptr("u"), State: Ptr("pending")} + want := &Membership{URL: new("u"), State: new("pending")} if !cmp.Equal(membership, want) { t.Errorf("Teams.AddTeamMembershipByID returned %+v, want %+v", membership, want) } @@ -418,7 +418,7 @@ func TestTeamsService_AddTeamMembershipBySlug(t *testing.T) { t.Errorf("Teams.AddTeamMembershipBySlug returned error: %v", err) } - want := &Membership{URL: Ptr("u"), State: Ptr("pending")} + want := &Membership{URL: new("u"), State: new("pending")} if !cmp.Equal(membership, want) { t.Errorf("Teams.AddTeamMembershipBySlug returned %+v, want %+v", membership, want) } @@ -622,7 +622,7 @@ func TestTeamsService_ListPendingTeamInvitationsByID(t *testing.T) { t.Errorf("Teams.ListPendingTeamInvitationsByID returned error: %v", err) } - want := []*Invitation{{ID: Ptr(int64(1))}} + want := []*Invitation{{ID: new(int64(1))}} if !cmp.Equal(invitations, want) { t.Errorf("Teams.ListPendingTeamInvitationsByID returned %+v, want %+v", invitations, want) } @@ -697,7 +697,7 @@ func TestTeamsService_ListPendingTeamInvitationsBySlug(t *testing.T) { t.Errorf("Teams.ListPendingTeamInvitationsBySlug returned error: %v", err) } - want := []*Invitation{{ID: Ptr(int64(1))}} + want := []*Invitation{{ID: new(int64(1))}} if !cmp.Equal(invitations, want) { t.Errorf("Teams.ListPendingTeamInvitationsBySlug returned %+v, want %+v", invitations, want) } diff --git a/github/teams_test.go b/github/teams_test.go index 5cbede587e3..5c0896e2365 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -31,7 +31,7 @@ func TestTeamsService_ListTeams(t *testing.T) { t.Errorf("Teams.ListTeams returned error: %v", err) } - want := []*Team{{ID: Ptr(int64(1))}} + want := []*Team{{ID: new(int64(1))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListTeams returned %+v, want %+v", teams, want) } @@ -75,7 +75,7 @@ func TestTeamsService_GetTeamByID(t *testing.T) { t.Errorf("Teams.GetTeamByID returned error: %v", err) } - want := &Team{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), URL: Ptr("u"), Slug: Ptr("s"), Permission: Ptr("p"), LDAPDN: Ptr("cn=n,ou=groups,dc=example,dc=com"), Type: Ptr("organization")} + want := &Team{ID: new(int64(1)), Name: new("n"), Description: new("d"), URL: new("u"), Slug: new("s"), Permission: new("p"), LDAPDN: new("cn=n,ou=groups,dc=example,dc=com"), Type: new("organization")} if !cmp.Equal(team, want) { t.Errorf("Teams.GetTeamByID returned %+v, want %+v", team, want) } @@ -132,7 +132,7 @@ func TestTeamsService_GetTeamBySlug(t *testing.T) { t.Errorf("Teams.GetTeamBySlug returned error: %v", err) } - want := &Team{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), URL: Ptr("u"), Slug: Ptr("s"), Permission: Ptr("p"), LDAPDN: Ptr("cn=n,ou=groups,dc=example,dc=com"), Type: Ptr("organization")} + want := &Team{ID: new(int64(1)), Name: new("n"), Description: new("d"), URL: new("u"), Slug: new("s"), Permission: new("p"), LDAPDN: new("cn=n,ou=groups,dc=example,dc=com"), Type: new("organization")} if !cmp.Equal(team, want) { t.Errorf("Teams.GetTeamBySlug returned %+v, want %+v", team, want) } @@ -187,7 +187,7 @@ func TestTeamsService_CreateTeam(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := CreateTeamRequest{Name: "n", Privacy: Ptr("closed"), RepoNames: []string{"r"}} + input := CreateTeamRequest{Name: "n", Privacy: new("closed"), RepoNames: []string{"r"}} mux.HandleFunc("/orgs/o/teams", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -201,7 +201,7 @@ func TestTeamsService_CreateTeam(t *testing.T) { t.Errorf("Teams.CreateTeam returned error: %v", err) } - want := &Team{ID: Ptr(int64(1))} + want := &Team{ID: new(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.CreateTeam returned %+v, want %+v", team, want) } @@ -234,7 +234,7 @@ func TestTeamsService_UpdateTeamByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateTeamRequest{Name: Ptr("n"), Privacy: Ptr("closed")} + input := UpdateTeamRequest{Name: new("n"), Privacy: new("closed")} mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -248,7 +248,7 @@ func TestTeamsService_UpdateTeamByID(t *testing.T) { t.Errorf("Teams.UpdateTeamByID returned error: %v", err) } - want := &Team{ID: Ptr(int64(1))} + want := &Team{ID: new(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.UpdateTeamByID returned %+v, want %+v", team, want) } @@ -272,7 +272,7 @@ func TestTeamsService_UpdateTeamByID_RemoveParent(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateTeamRequest{Name: Ptr("n"), NotificationSetting: Ptr("notifications_enabled"), Privacy: Ptr("closed"), RemoveParentTeam: true} + input := UpdateTeamRequest{Name: new("n"), NotificationSetting: new("notifications_enabled"), Privacy: new("closed"), RemoveParentTeam: true} mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -287,7 +287,7 @@ func TestTeamsService_UpdateTeamByID_RemoveParent(t *testing.T) { t.Errorf("Teams.UpdateTeamByID returned error: %v", err) } - want := &Team{ID: Ptr(int64(1))} + want := &Team{ID: new(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.UpdateTeamByID returned %+v, want %+v", team, want) } @@ -297,7 +297,7 @@ func TestTeamsService_UpdateTeamBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateTeamRequest{Name: Ptr("n"), Privacy: Ptr("closed")} + input := UpdateTeamRequest{Name: new("n"), Privacy: new("closed")} mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -311,7 +311,7 @@ func TestTeamsService_UpdateTeamBySlug(t *testing.T) { t.Errorf("Teams.UpdateTeamBySlug returned error: %v", err) } - want := &Team{ID: Ptr(int64(1))} + want := &Team{ID: new(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.UpdateTeamBySlug returned %+v, want %+v", team, want) } @@ -335,7 +335,7 @@ func TestTeamsService_UpdateTeamBySlug_RemoveParent(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UpdateTeamRequest{Name: Ptr("n"), NotificationSetting: Ptr("notifications_disabled"), Privacy: Ptr("closed"), RemoveParentTeam: true} + input := UpdateTeamRequest{Name: new("n"), NotificationSetting: new("notifications_disabled"), Privacy: new("closed"), RemoveParentTeam: true} mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -350,7 +350,7 @@ func TestTeamsService_UpdateTeamBySlug_RemoveParent(t *testing.T) { t.Errorf("Teams.UpdateTeamBySlug returned error: %v", err) } - want := &Team{ID: Ptr(int64(1))} + want := &Team{ID: new(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.UpdateTeamBySlug returned %+v, want %+v", team, want) } @@ -423,7 +423,7 @@ func TestTeamsService_ListChildTeamsByParentID(t *testing.T) { t.Errorf("Teams.ListChildTeamsByParentID returned error: %v", err) } - want := []*Team{{ID: Ptr(int64(2))}} + want := []*Team{{ID: new(int64(2))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListChildTeamsByParentID returned %+v, want %+v", teams, want) } @@ -460,7 +460,7 @@ func TestTeamsService_ListChildTeamsByParentSlug(t *testing.T) { t.Errorf("Teams.ListChildTeamsByParentSlug returned error: %v", err) } - want := []*Team{{ID: Ptr(int64(2))}} + want := []*Team{{ID: new(int64(2))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListChildTeamsByParentSlug returned %+v, want %+v", teams, want) } @@ -498,7 +498,7 @@ func TestTeamsService_ListTeamReposByID(t *testing.T) { t.Errorf("Teams.ListTeamReposByID returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamReposByID returned %+v, want %+v", members, want) } @@ -536,7 +536,7 @@ func TestTeamsService_ListTeamReposBySlug(t *testing.T) { t.Errorf("Teams.ListTeamReposBySlug returned error: %v", err) } - want := []*Repository{{ID: Ptr(int64(1))}} + want := []*Repository{{ID: new(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamReposBySlug returned %+v, want %+v", members, want) } @@ -572,7 +572,7 @@ func TestTeamsService_IsTeamRepoByID_true(t *testing.T) { t.Errorf("Teams.IsTeamRepoByID returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Teams.IsTeamRepoByID returned %+v, want %+v", repo, want) } @@ -608,7 +608,7 @@ func TestTeamsService_IsTeamRepoBySlug_true(t *testing.T) { t.Errorf("Teams.IsTeamRepoBySlug returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1))} + want := &Repository{ID: new(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Teams.IsTeamRepoBySlug returned %+v, want %+v", repo, want) } @@ -929,7 +929,7 @@ func TestTeamsService_ListUserTeams(t *testing.T) { t.Errorf("Teams.ListUserTeams returned error: %v", err) } - want := []*Team{{ID: Ptr(int64(1))}} + want := []*Team{{ID: new(int64(1))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListUserTeams returned %+v, want %+v", teams, want) } @@ -960,7 +960,7 @@ func TestTeamsService_ListProjectsByID(t *testing.T) { t.Errorf("Teams.ListTeamProjectsByID returned error: %v", err) } - want := []*ProjectV2{{ID: Ptr(int64(1))}} + want := []*ProjectV2{{ID: new(int64(1))}} if !cmp.Equal(projects, want) { t.Errorf("Teams.ListTeamProjectsByID returned %+v, want %+v", projects, want) } @@ -996,7 +996,7 @@ func TestTeamsService_ListProjectsBySlug(t *testing.T) { t.Errorf("Teams.ListTeamProjectsBySlug returned error: %v", err) } - want := []*ProjectV2{{ID: Ptr(int64(1))}} + want := []*ProjectV2{{ID: new(int64(1))}} if !cmp.Equal(projects, want) { t.Errorf("Teams.ListTeamProjectsBySlug returned %+v, want %+v", projects, want) } @@ -1032,7 +1032,7 @@ func TestTeamsService_ReviewProjectsByID(t *testing.T) { t.Errorf("Teams.ReviewTeamProjectsByID returned error: %v", err) } - want := &ProjectV2{ID: Ptr(int64(1))} + want := &ProjectV2{ID: new(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Teams.ReviewTeamProjectsByID returned %+v, want %+v", project, want) } @@ -1068,7 +1068,7 @@ func TestTeamsService_ReviewProjectsBySlug(t *testing.T) { t.Errorf("Teams.ReviewTeamProjectsBySlug returned error: %v", err) } - want := &ProjectV2{ID: Ptr(int64(1))} + want := &ProjectV2{ID: new(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Teams.ReviewTeamProjectsBySlug returned %+v, want %+v", project, want) } @@ -1093,7 +1093,7 @@ func TestTeamsService_AddTeamProjectByID(t *testing.T) { client, mux, _ := setup(t) opt := &TeamProjectOptions{ - Permission: Ptr("admin"), + Permission: new("admin"), } mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) { @@ -1125,7 +1125,7 @@ func TestTeamsService_AddTeamProjectBySlug(t *testing.T) { client, mux, _ := setup(t) opt := &TeamProjectOptions{ - Permission: Ptr("admin"), + Permission: new("admin"), } mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) { @@ -1232,9 +1232,9 @@ func TestTeamsService_ListIDPGroupsInOrganization(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: Ptr("1"), - GroupName: Ptr("n"), - GroupDescription: Ptr("d"), + GroupID: new("1"), + GroupName: new("n"), + GroupDescription: new("d"), }, }, } @@ -1275,9 +1275,9 @@ func TestTeamsService_ListIDPGroupsForTeamByID(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: Ptr("1"), - GroupName: Ptr("n"), - GroupDescription: Ptr("d"), + GroupID: new("1"), + GroupName: new("n"), + GroupDescription: new("d"), }, }, } @@ -1318,9 +1318,9 @@ func TestTeamsService_ListIDPGroupsForTeamBySlug(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: Ptr("1"), - GroupName: Ptr("n"), - GroupDescription: Ptr("d"), + GroupID: new("1"), + GroupName: new("n"), + GroupDescription: new("d"), }, }, } @@ -1355,9 +1355,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsByID(t *testing.T) { input := IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: Ptr("1"), - GroupName: Ptr("n"), - GroupDescription: Ptr("d"), + GroupID: new("1"), + GroupName: new("n"), + GroupDescription: new("d"), }, }, } @@ -1371,9 +1371,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsByID(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: Ptr("1"), - GroupName: Ptr("n"), - GroupDescription: Ptr("d"), + GroupID: new("1"), + GroupName: new("n"), + GroupDescription: new("d"), }, }, } @@ -1408,9 +1408,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsBySlug(t *testing.T) { input := IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: Ptr("1"), - GroupName: Ptr("n"), - GroupDescription: Ptr("d"), + GroupID: new("1"), + GroupName: new("n"), + GroupDescription: new("d"), }, }, } @@ -1424,9 +1424,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsBySlug(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: Ptr("1"), - GroupName: Ptr("n"), - GroupDescription: Ptr("d"), + GroupID: new("1"), + GroupName: new("n"), + GroupDescription: new("d"), }, }, } @@ -1547,31 +1547,31 @@ func TestTeamsService_GetExternalGroup(t *testing.T) { } want := &ExternalGroup{ - GroupID: Ptr(int64(123)), - GroupName: Ptr("Octocat admins"), + GroupID: new(int64(123)), + GroupName: new("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, Teams: []*ExternalGroupTeam{ { - TeamID: Ptr(int64(1)), - TeamName: Ptr("team-test"), + TeamID: new(int64(1)), + TeamName: new("team-test"), }, { - TeamID: Ptr(int64(2)), - TeamName: Ptr("team-test2"), + TeamID: new(int64(2)), + TeamName: new("team-test2"), }, }, Members: []*ExternalGroupMember{ { - MemberID: Ptr(int64(1)), - MemberLogin: Ptr("mona-lisa_eocsaxrs"), - MemberName: Ptr("Mona Lisa"), - MemberEmail: Ptr("mona_lisa@github.com"), + MemberID: new(int64(1)), + MemberLogin: new("mona-lisa_eocsaxrs"), + MemberName: new("Mona Lisa"), + MemberEmail: new("mona_lisa@github.com"), }, { - MemberID: Ptr(int64(2)), - MemberLogin: Ptr("octo-lisa_eocsaxrs"), - MemberName: Ptr("Octo Lisa"), - MemberEmail: Ptr("octo_lisa@github.com"), + MemberID: new(int64(2)), + MemberLogin: new("octo-lisa_eocsaxrs"), + MemberName: new("Octo Lisa"), + MemberEmail: new("octo_lisa@github.com"), }, }, } @@ -1635,7 +1635,7 @@ func TestTeamsService_ListExternalGroups(t *testing.T) { ctx := t.Context() opts := &ListExternalGroupsOptions{ - DisplayName: Ptr("Octocat"), + DisplayName: new("Octocat"), } list, _, err := client.Teams.ListExternalGroups(ctx, "o", opts) if err != nil { @@ -1645,8 +1645,8 @@ func TestTeamsService_ListExternalGroups(t *testing.T) { want := &ExternalGroupList{ Groups: []*ExternalGroup{ { - GroupID: Ptr(int64(123)), - GroupName: Ptr("Octocat admins"), + GroupID: new(int64(123)), + GroupName: new("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, }, }, @@ -1718,8 +1718,8 @@ func TestTeamsService_ListExternalGroupsForTeamBySlug(t *testing.T) { want := &ExternalGroupList{ Groups: []*ExternalGroup{ { - GroupID: Ptr(int64(123)), - GroupName: Ptr("Octocat admins"), + GroupID: new(int64(123)), + GroupName: new("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, }, }, @@ -1812,31 +1812,31 @@ func TestTeamsService_UpdateConnectedExternalGroup(t *testing.T) { } want := &ExternalGroup{ - GroupID: Ptr(int64(123)), - GroupName: Ptr("Octocat admins"), + GroupID: new(int64(123)), + GroupName: new("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, Teams: []*ExternalGroupTeam{ { - TeamID: Ptr(int64(1)), - TeamName: Ptr("team-test"), + TeamID: new(int64(1)), + TeamName: new("team-test"), }, { - TeamID: Ptr(int64(2)), - TeamName: Ptr("team-test2"), + TeamID: new(int64(2)), + TeamName: new("team-test2"), }, }, Members: []*ExternalGroupMember{ { - MemberID: Ptr(int64(1)), - MemberLogin: Ptr("mona-lisa_eocsaxrs"), - MemberName: Ptr("Mona Lisa"), - MemberEmail: Ptr("mona_lisa@github.com"), + MemberID: new(int64(1)), + MemberLogin: new("mona-lisa_eocsaxrs"), + MemberName: new("Mona Lisa"), + MemberEmail: new("mona_lisa@github.com"), }, { - MemberID: Ptr(int64(2)), - MemberLogin: Ptr("octo-lisa_eocsaxrs"), - MemberName: Ptr("Octo Lisa"), - MemberEmail: Ptr("octo_lisa@github.com"), + MemberID: new(int64(2)), + MemberLogin: new("octo-lisa_eocsaxrs"), + MemberName: new("Octo Lisa"), + MemberEmail: new("octo_lisa@github.com"), }, }, } diff --git a/github/users_administration_test.go b/github/users_administration_test.go index 34ca232a269..563975823b8 100644 --- a/github/users_administration_test.go +++ b/github/users_administration_test.go @@ -92,7 +92,7 @@ func TestUsersServiceReason_Suspend(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &UserSuspendOptions{Reason: Ptr("test")} + input := &UserSuspendOptions{Reason: new("test")} mux.HandleFunc("/users/u/suspended", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") diff --git a/github/users_blocking_test.go b/github/users_blocking_test.go index 79e0dbf6589..12a1d017367 100644 --- a/github/users_blocking_test.go +++ b/github/users_blocking_test.go @@ -33,7 +33,7 @@ func TestUsersService_ListBlockedUsers(t *testing.T) { t.Errorf("Users.ListBlockedUsers returned error: %v", err) } - want := []*User{{Login: Ptr("octocat")}} + want := []*User{{Login: new("octocat")}} if !cmp.Equal(blockedUsers, want) { t.Errorf("Users.ListBlockedUsers returned %+v, want %+v", blockedUsers, want) } diff --git a/github/users_emails_test.go b/github/users_emails_test.go index 3d24c1bdd4a..2ec5793aab3 100644 --- a/github/users_emails_test.go +++ b/github/users_emails_test.go @@ -34,7 +34,7 @@ func TestUsersService_ListEmails(t *testing.T) { t.Errorf("Users.ListEmails returned error: %v", err) } - want := []*UserEmail{{Email: Ptr("user@example.com"), Verified: Ptr(false), Primary: Ptr(true)}} + want := []*UserEmail{{Email: new("user@example.com"), Verified: new(false), Primary: new(true)}} if !cmp.Equal(emails, want) { t.Errorf("Users.ListEmails returned %+v, want %+v", emails, want) } @@ -68,8 +68,8 @@ func TestUsersService_AddEmails(t *testing.T) { } want := []*UserEmail{ - {Email: Ptr("old@example.com")}, - {Email: Ptr("new@example.com")}, + {Email: new("old@example.com")}, + {Email: new("new@example.com")}, } if !cmp.Equal(emails, want) { t.Errorf("Users.AddEmails returned %+v, want %+v", emails, want) @@ -112,7 +112,7 @@ func TestUsersService_SetEmailVisibility(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &UserEmail{Visibility: Ptr("private")} + input := &UserEmail{Visibility: new("private")} mux.HandleFunc("/user/email/visibility", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -131,7 +131,7 @@ func TestUsersService_SetEmailVisibility(t *testing.T) { t.Errorf("Users.SetEmailVisibility returned error: %v", err) } - want := []*UserEmail{{Email: Ptr("user@example.com"), Verified: Ptr(false), Primary: Ptr(true), Visibility: Ptr("private")}} + want := []*UserEmail{{Email: new("user@example.com"), Verified: new(false), Primary: new(true), Visibility: new("private")}} if !cmp.Equal(emails, want) { t.Errorf("Users.SetEmailVisibility returned %+v, want %+v", emails, want) } diff --git a/github/users_followers_test.go b/github/users_followers_test.go index 21e42aab34c..3a486f75010 100644 --- a/github/users_followers_test.go +++ b/github/users_followers_test.go @@ -30,7 +30,7 @@ func TestUsersService_ListFollowers_authenticatedUser(t *testing.T) { t.Errorf("Users.ListFollowers returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListFollowers returned %+v, want %+v", users, want) } @@ -65,7 +65,7 @@ func TestUsersService_ListFollowers_specifiedUser(t *testing.T) { t.Errorf("Users.ListFollowers returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListFollowers returned %+v, want %+v", users, want) } @@ -111,7 +111,7 @@ func TestUsersService_ListFollowing_authenticatedUser(t *testing.T) { t.Errorf("Users.ListFollowing returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListFollowing returned %+v, want %+v", users, want) } @@ -146,7 +146,7 @@ func TestUsersService_ListFollowing_specifiedUser(t *testing.T) { t.Errorf("Users.ListFollowing returned error: %v", err) } - want := []*User{{ID: Ptr(int64(1))}} + want := []*User{{ID: new(int64(1))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListFollowing returned %+v, want %+v", users, want) } diff --git a/github/users_gpg_keys_test.go b/github/users_gpg_keys_test.go index 0c87f31f761..843c910b15e 100644 --- a/github/users_gpg_keys_test.go +++ b/github/users_gpg_keys_test.go @@ -30,7 +30,7 @@ func TestUsersService_ListGPGKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListGPGKeys returned error: %v", err) } - want := []*GPGKey{{ID: Ptr(int64(1)), PrimaryKeyID: Ptr(int64(2))}} + want := []*GPGKey{{ID: new(int64(1)), PrimaryKeyID: new(int64(2))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListGPGKeys = %+v, want %+v", keys, want) } @@ -65,7 +65,7 @@ func TestUsersService_ListGPGKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListGPGKeys returned error: %v", err) } - want := []*GPGKey{{ID: Ptr(int64(1)), PrimaryKeyID: Ptr(int64(2))}} + want := []*GPGKey{{ID: new(int64(1)), PrimaryKeyID: new(int64(2))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListGPGKeys = %+v, want %+v", keys, want) } @@ -95,7 +95,7 @@ func TestUsersService_GetGPGKey(t *testing.T) { t.Errorf("Users.GetGPGKey returned error: %v", err) } - want := &GPGKey{ID: Ptr(int64(1))} + want := &GPGKey{ID: new(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.GetGPGKey = %+v, want %+v", key, want) } @@ -146,7 +146,7 @@ mQINBFcEd9kBEACo54TDbGhKlXKWMvJgecEUKPPcv7XdnpKdGb3LRw5MvFwT0V0f t.Errorf("Users.CreateGPGKey returned error: %v", err) } - want := &GPGKey{ID: Ptr(int64(1))} + want := &GPGKey{ID: new(int64(1))} if !cmp.Equal(gpgKey, want) { t.Errorf("Users.GetGPGKey = %+v, want %+v", gpgKey, want) } diff --git a/github/users_keys_test.go b/github/users_keys_test.go index 245d99516a2..31c0037bec2 100644 --- a/github/users_keys_test.go +++ b/github/users_keys_test.go @@ -30,7 +30,7 @@ func TestUsersService_ListKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListKeys returned error: %v", err) } - want := []*Key{{ID: Ptr(int64(1))}} + want := []*Key{{ID: new(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListKeys returned %+v, want %+v", keys, want) } @@ -65,7 +65,7 @@ func TestUsersService_ListKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListKeys returned error: %v", err) } - want := []*Key{{ID: Ptr(int64(1))}} + want := []*Key{{ID: new(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListKeys returned %+v, want %+v", keys, want) } @@ -95,7 +95,7 @@ func TestUsersService_GetKey(t *testing.T) { t.Errorf("Users.GetKey returned error: %v", err) } - want := &Key{ID: Ptr(int64(1))} + want := &Key{ID: new(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.GetKey returned %+v, want %+v", key, want) } @@ -119,7 +119,7 @@ func TestUsersService_CreateKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Key{Key: Ptr("k"), Title: Ptr("t")} + input := &Key{Key: new("k"), Title: new("t")} mux.HandleFunc("/user/keys", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -133,7 +133,7 @@ func TestUsersService_CreateKey(t *testing.T) { t.Errorf("Users.CreateKey returned error: %v", err) } - want := &Key{ID: Ptr(int64(1))} + want := &Key{ID: new(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.CreateKey returned %+v, want %+v", key, want) } diff --git a/github/users_packages_test.go b/github/users_packages_test.go index 939344fd93d..013a2485988 100644 --- a/github/users_packages_test.go +++ b/github/users_packages_test.go @@ -36,19 +36,19 @@ func TestUsersService_Authenticated_ListPackages(t *testing.T) { }) ctx := t.Context() - packages, _, err := client.Users.ListPackages(ctx, "", &PackageListOptions{PackageType: Ptr("container"), Visibility: Ptr("private")}) + packages, _, err := client.Users.ListPackages(ctx, "", &PackageListOptions{PackageType: new("container"), Visibility: new("private")}) if err != nil { t.Errorf("Users.Authenticated_ListPackages returned error: %v", err) } want := []*Package{{ - ID: Ptr(int64(197)), - Name: Ptr("hello_docker"), - PackageType: Ptr("container"), - VersionCount: Ptr(int64(1)), - Visibility: Ptr("private"), - URL: Ptr("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: Ptr("https://github.com/orgs/github/packages/container/package/hello_docker"), + ID: new(int64(197)), + Name: new("hello_docker"), + PackageType: new("container"), + VersionCount: new(int64(1)), + Visibility: new("private"), + URL: new("https://api.github.com/orgs/github/packages/container/hello_docker"), + HTMLURL: new("https://github.com/orgs/github/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }} @@ -92,19 +92,19 @@ func TestUsersService_specifiedUser_ListPackages(t *testing.T) { }) ctx := t.Context() - packages, _, err := client.Users.ListPackages(ctx, "u", &PackageListOptions{PackageType: Ptr("container"), Visibility: Ptr("public")}) + packages, _, err := client.Users.ListPackages(ctx, "u", &PackageListOptions{PackageType: new("container"), Visibility: new("public")}) if err != nil { t.Errorf("Users.specifiedUser_ListPackages returned error: %v", err) } want := []*Package{{ - ID: Ptr(int64(197)), - Name: Ptr("hello_docker"), - PackageType: Ptr("container"), - VersionCount: Ptr(int64(1)), - Visibility: Ptr("public"), - URL: Ptr("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: Ptr("https://github.com/orgs/github/packages/container/package/hello_docker"), + ID: new(int64(197)), + Name: new("hello_docker"), + PackageType: new("container"), + VersionCount: new(int64(1)), + Visibility: new("public"), + URL: new("https://api.github.com/orgs/github/packages/container/hello_docker"), + HTMLURL: new("https://github.com/orgs/github/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }} @@ -156,13 +156,13 @@ func TestUsersService_specifiedUser_GetPackage(t *testing.T) { } want := &Package{ - ID: Ptr(int64(197)), - Name: Ptr("hello/hello_docker"), - PackageType: Ptr("container"), - VersionCount: Ptr(int64(1)), - Visibility: Ptr("private"), - URL: Ptr("https://api.github.com/orgs/github/packages/container/hello%2Fhello_docker"), - HTMLURL: Ptr("https://github.com/orgs/github/packages/container/package/hello%2Fhello_docker"), + ID: new(int64(197)), + Name: new("hello/hello_docker"), + PackageType: new("container"), + VersionCount: new(int64(1)), + Visibility: new("private"), + URL: new("https://api.github.com/orgs/github/packages/container/hello%2Fhello_docker"), + HTMLURL: new("https://github.com/orgs/github/packages/container/package/hello%2Fhello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -210,13 +210,13 @@ func TestUsersService_Authenticated_GetPackage(t *testing.T) { } want := &Package{ - ID: Ptr(int64(197)), - Name: Ptr("hello_docker"), - PackageType: Ptr("container"), - VersionCount: Ptr(int64(1)), - Visibility: Ptr("private"), - URL: Ptr("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: Ptr("https://github.com/orgs/github/packages/container/package/hello_docker"), + ID: new(int64(197)), + Name: new("hello_docker"), + PackageType: new("container"), + VersionCount: new(int64(1)), + Visibility: new("private"), + URL: new("https://api.github.com/orgs/github/packages/container/hello_docker"), + HTMLURL: new("https://github.com/orgs/github/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -377,13 +377,13 @@ func TestUsersService_ListPackageVersions(t *testing.T) { } want := []*PackageVersion{{ - ID: Ptr(int64(45763)), - Name: Ptr("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: Ptr("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: Ptr("https://github.com/users/octocat/packages/container/package/hello_docker"), + ID: new(int64(45763)), + Name: new("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), + URL: new("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), + PackageHTMLURL: new("https://github.com/users/octocat/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: new("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: json.RawMessage(m), }} if !cmp.Equal(packages, want) { @@ -440,13 +440,13 @@ func TestUsersService_ListUserPackageVersions(t *testing.T) { } want := []*PackageVersion{{ - ID: Ptr(int64(45763)), - Name: Ptr("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: Ptr("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: Ptr("https://github.com/users/octocat/packages/container/package/hello_docker"), + ID: new(int64(45763)), + Name: new("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), + URL: new("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), + PackageHTMLURL: new("https://github.com/users/octocat/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: new("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: json.RawMessage(m), }} if !cmp.Equal(packages, want) { @@ -503,13 +503,13 @@ func TestUsersService_Authenticated_PackageGetVersion(t *testing.T) { } want := &PackageVersion{ - ID: Ptr(int64(45763)), - Name: Ptr("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: Ptr("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: Ptr("https://github.com/users/octocat/packages/container/package/hello_docker"), + ID: new(int64(45763)), + Name: new("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), + URL: new("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), + PackageHTMLURL: new("https://github.com/users/octocat/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: new("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: json.RawMessage(m), } if !cmp.Equal(packages, want) { @@ -566,13 +566,13 @@ func TestUsersService_specifiedUser_PackageGetVersion(t *testing.T) { } want := &PackageVersion{ - ID: Ptr(int64(45763)), - Name: Ptr("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: Ptr("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: Ptr("https://github.com/users/octocat/packages/container/package/hello_docker"), + ID: new(int64(45763)), + Name: new("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), + URL: new("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), + PackageHTMLURL: new("https://github.com/users/octocat/packages/container/package/hello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: new("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: json.RawMessage(m), } if !cmp.Equal(packages, want) { diff --git a/github/users_social_accounts_test.go b/github/users_social_accounts_test.go index 5cb8631593d..4afca7f3bd7 100644 --- a/github/users_social_accounts_test.go +++ b/github/users_social_accounts_test.go @@ -34,7 +34,7 @@ func TestUsersService_ListSocialAccounts(t *testing.T) { t.Errorf("Users.ListSocialAccounts returned error: %v", err) } - want := []*SocialAccount{{Provider: Ptr("example"), URL: Ptr("https://example.com")}} + want := []*SocialAccount{{Provider: new("example"), URL: new("https://example.com")}} if !cmp.Equal(accounts, want) { t.Errorf("Users.ListSocialAccounts returned %#v, want %#v", accounts, want) } @@ -71,7 +71,7 @@ func TestUsersService_AddSocialAccounts(t *testing.T) { } want := []*SocialAccount{ - {Provider: Ptr("example"), URL: Ptr("https://example.com")}, + {Provider: new("example"), URL: new("https://example.com")}, } if !cmp.Equal(accounts, want) { t.Errorf("Users.AddSocialAccounts returned %#v, want %#v", accounts, want) @@ -135,7 +135,7 @@ func TestUsersService_ListUserSocialAccounts(t *testing.T) { t.Errorf("Users.ListUserSocialAccounts returned error: %v", err) } - want := []*SocialAccount{{Provider: Ptr("example"), URL: Ptr("https://example.com")}} + want := []*SocialAccount{{Provider: new("example"), URL: new("https://example.com")}} if !cmp.Equal(accounts, want) { t.Errorf("Users.ListUserSocialAccounts returned %#v, want %#v", accounts, want) } diff --git a/github/users_ssh_signing_keys_test.go b/github/users_ssh_signing_keys_test.go index f4c9c7f7a52..f3878342e11 100644 --- a/github/users_ssh_signing_keys_test.go +++ b/github/users_ssh_signing_keys_test.go @@ -30,7 +30,7 @@ func TestUsersService_ListSSHSigningKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListSSHSigningKeys returned error: %v", err) } - want := []*SSHSigningKey{{ID: Ptr(int64(1))}} + want := []*SSHSigningKey{{ID: new(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListSSHSigningKeys returned %+v, want %+v", keys, want) } @@ -65,7 +65,7 @@ func TestUsersService_ListSSHSigningKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListSSHSigningKeys returned error: %v", err) } - want := []*SSHSigningKey{{ID: Ptr(int64(1))}} + want := []*SSHSigningKey{{ID: new(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListSSHSigningKeys returned %+v, want %+v", keys, want) } @@ -95,7 +95,7 @@ func TestUsersService_GetSSHSigningKey(t *testing.T) { t.Errorf("Users.GetSSHSigningKey returned error: %v", err) } - want := &SSHSigningKey{ID: Ptr(int64(1))} + want := &SSHSigningKey{ID: new(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.GetSSHSigningKey returned %+v, want %+v", key, want) } @@ -119,7 +119,7 @@ func TestUsersService_CreateSSHSigningKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Key{Key: Ptr("k"), Title: Ptr("t")} + input := &Key{Key: new("k"), Title: new("t")} mux.HandleFunc("/user/ssh_signing_keys", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -133,7 +133,7 @@ func TestUsersService_CreateSSHSigningKey(t *testing.T) { t.Errorf("Users.CreateSSHSigningKey returned error: %v", err) } - want := &SSHSigningKey{ID: Ptr(int64(1))} + want := &SSHSigningKey{ID: new(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.CreateSSHSigningKey returned %+v, want %+v", key, want) } diff --git a/github/users_test.go b/github/users_test.go index 7cf364c183c..7be50124cc6 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -28,7 +28,7 @@ func TestUsersService_Get_authenticatedUser(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := &User{ID: Ptr(int64(1))} + want := &User{ID: new(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.Get returned %+v, want %+v", user, want) } @@ -63,7 +63,7 @@ func TestUsersService_Get_specifiedUser(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := &User{ID: Ptr(int64(1))} + want := &User{ID: new(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.Get returned %+v, want %+v", user, want) } @@ -93,7 +93,7 @@ func TestUsersService_GetByID(t *testing.T) { t.Fatalf("Users.GetByID returned error: %v", err) } - want := &User{ID: Ptr(int64(1))} + want := &User{ID: new(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.GetByID returned %+v, want %+v", user, want) } @@ -117,7 +117,7 @@ func TestUsersService_Update(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := UserUpdateRequest{Name: Ptr("n")} + input := UserUpdateRequest{Name: new("n")} mux.HandleFunc("/user", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -131,7 +131,7 @@ func TestUsersService_Update(t *testing.T) { t.Errorf("Users.Update returned error: %v", err) } - want := &User{ID: Ptr(int64(1))} + want := &User{ID: new(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.Update returned %+v, want %+v", user, want) } @@ -163,7 +163,7 @@ func TestUsersService_GetHovercard(t *testing.T) { t.Errorf("Users.GetHovercard returned error: %v", err) } - want := &Hovercard{Contexts: []*UserContext{{Message: Ptr("Owns this repository"), Octicon: Ptr("repo")}}} + want := &Hovercard{Contexts: []*UserContext{{Message: new("Owns this repository"), Octicon: new("repo")}}} if !cmp.Equal(hovercard, want) { t.Errorf("Users.GetHovercard returned %+v, want %+v", hovercard, want) } @@ -200,7 +200,7 @@ func TestUsersService_ListAll(t *testing.T) { t.Errorf("Users.ListAll returned error: %v", err) } - want := []*User{{ID: Ptr(int64(2))}} + want := []*User{{ID: new(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListAll returned %+v, want %+v", users, want) } @@ -230,7 +230,7 @@ func TestUsersService_ListInvitations(t *testing.T) { t.Errorf("Users.ListInvitations returned error: %v", err) } - want := []*RepositoryInvitation{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} + want := []*RepositoryInvitation{{ID: new(int64(1))}, {ID: new(int64(2))}} if !cmp.Equal(got, want) { t.Errorf("Users.ListInvitations = %+v, want %+v", got, want) } diff --git a/go.mod b/go.mod index 229ed21bb29..d4c95dba674 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/v90 -go 1.25.0 +go 1.26.0 require ( github.com/google/go-cmp v0.7.0 From 5f86d04a4fc0d5dc4e76539a61a4b13c435b7984 Mon Sep 17 00:00:00 2001 From: ajayk Date: Sun, 23 Aug 2026 08:50:47 -0700 Subject: [PATCH 2/3] feat: Require Go 1.26 and use new(expr) for pointer literals Bump go.mod to 1.26 per the N-1 support policy (Go 1.27 is current) and replace Ptr() with the new(v) builtin across tests. --- example/actionpermissions/main.go | 6 +++--- example/commitpr/main.go | 6 +++--- example/go.mod | 2 +- example/newfilewithappauth/main.go | 2 +- github/github.go | 9 +++------ github/issue_import.go | 3 +-- github/orgs_outside_collaborators_test.go | 9 +++------ github/repos_forks.go | 3 +-- github/security_advisories.go | 3 +-- otel/go.mod | 2 +- test/integration/activity_test.go | 2 +- test/integration/licences_test.go | 2 +- test/integration/repos_test.go | 18 +++++++++--------- test/integration/users_test.go | 6 +++--- tools/go.mod | 2 +- tools/metadata/main_test.go | 8 ++++---- 16 files changed, 37 insertions(+), 46 deletions(-) diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index aff4ad89da8..cfdf2fee2d4 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -47,7 +47,7 @@ func main() { fmt.Printf("Current ActionsPermissions %v\n", actionsPermissionsRepository) - actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Ptr(true), AllowedActions: github.Ptr("selected")} + actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: new(true), AllowedActions: new("selected")} _, _, err = client.Repositories.UpdateActionsPermissions(ctx, *owner, *name, *actionsPermissionsRepository) if err != nil { log.Fatal(err) @@ -62,7 +62,7 @@ func main() { fmt.Printf("Current ActionsAllowed %v\n", actionsAllowed) - actionsAllowed = &github.ActionsAllowed{GithubOwnedAllowed: github.Ptr(true), VerifiedAllowed: github.Ptr(false), PatternsAllowed: []string{"a/b"}} + actionsAllowed = &github.ActionsAllowed{GithubOwnedAllowed: new(true), VerifiedAllowed: new(false), PatternsAllowed: []string{"a/b"}} _, _, err = client.Repositories.EditActionsAllowed(ctx, *owner, *name, *actionsAllowed) if err != nil { log.Fatal(err) @@ -70,7 +70,7 @@ func main() { fmt.Printf("Current ActionsAllowed %v\n", actionsAllowed) - actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Ptr(true), AllowedActions: github.Ptr("all")} + actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: new(true), AllowedActions: new("all")} _, _, err = client.Repositories.UpdateActionsPermissions(ctx, *owner, *name, *actionsPermissionsRepository) if err != nil { log.Fatal(err) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index ec4c980112e..667fb7d7b6b 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -105,7 +105,7 @@ func getTree(ref *github.Reference) (tree *github.Tree, err error) { if err != nil { return nil, err } - entries = append(entries, &github.TreeEntry{Path: &file, Type: github.Ptr("blob"), Content: github.Ptr(string(content)), Mode: github.Ptr("100644")}) + entries = append(entries, &github.TreeEntry{Path: &file, Type: new("blob"), Content: new(string(content)), Mode: new("100644")}) } tree, _, err = client.Git.CreateTree(ctx, *sourceOwner, *sourceRepo, *ref.Object.SHA, entries) @@ -173,7 +173,7 @@ func pushCommit(ref *github.Reference, tree *github.Tree) (err error) { ref.Object.SHA = newCommit.SHA _, _, err = client.Git.UpdateRef(ctx, *sourceOwner, *sourceRepo, *ref.Ref, github.UpdateRef{ SHA: *newCommit.SHA, - Force: github.Ptr(false), + Force: new(false), }) return err } @@ -200,7 +200,7 @@ func createPR() (err error) { HeadRepo: repoBranch, Base: *prBranch, Body: prDescription, - MaintainerCanModify: github.Ptr(true), + MaintainerCanModify: new(true), } pr, _, err := client.PullRequests.Create(ctx, *prRepoOwner, *prRepo, newPR) diff --git a/example/go.mod b/example/go.mod index ea9c2173a98..a46bbc67ef4 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/v90/example -go 1.25.8 +go 1.26.0 require ( github.com/ProtonMail/go-crypto v1.4.1 diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index b18c2de888c..fb58a229993 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -75,7 +75,7 @@ func main() { "example/foo.txt", &github.RepositoryContentFileOptions{ Content: []byte("foo"), - Message: github.Ptr("sample commit"), + Message: new("sample commit"), SHA: nil, }, ) diff --git a/github/github.go b/github/github.go index 68ba6ee4de1..52adada5880 100644 --- a/github/github.go +++ b/github/github.go @@ -1262,8 +1262,7 @@ func (c *Client) bareDo(caller *http.Client, req *http.Request) (*Response, erro } // If the error type is *url.Error, sanitize its URL before returning. - var e *url.Error - if errors.As(err, &e) { + if e, ok := errors.AsType[*url.Error](err); ok { if url, err := url.Parse(e.URL); err == nil { e.URL = sanitizeURL(url).String() return response, e @@ -1290,8 +1289,7 @@ func (c *Client) bareDo(caller *http.Client, req *http.Request) (*Response, erro // added to the AcceptedError and returned. // // Issue #1022 - var aerr *AcceptedError - if errors.As(err, &aerr) { + if aerr, ok := errors.AsType[*AcceptedError](err); ok { b, readErr := io.ReadAll(io.LimitReader(resp.Body, maxErrorBodySize)) if readErr != nil { return response, readErr @@ -1352,8 +1350,7 @@ var errInvalidLocation = errors.New("invalid or empty Location header in redirec func (c *Client) bareDoUntilFound(req *http.Request, maxRedirects int) (*url.URL, *Response, error) { response, err := c.bareDoIgnoreRedirects(req) if err != nil { - var rerr *RedirectionError - if errors.As(err, &rerr) { + if rerr, ok := errors.AsType[*RedirectionError](err); ok { // If we receive a 302, transform potential relative locations into absolute and return it. if rerr.StatusCode == http.StatusFound { if rerr.Location == nil { diff --git a/github/issue_import.go b/github/issue_import.go index 9916eb6fa17..95e61d03d98 100644 --- a/github/issue_import.go +++ b/github/issue_import.go @@ -86,8 +86,7 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, bod var i *IssueImportResponse resp, err := s.client.Do(req, &i) if err != nil { - var aerr *AcceptedError - if errors.As(err, &aerr) { + if aerr, ok := errors.AsType[*AcceptedError](err); ok { if err := json.Unmarshal(aerr.Raw, &i); err != nil { return i, resp, err } diff --git a/github/orgs_outside_collaborators_test.go b/github/orgs_outside_collaborators_test.go index 7ffe1897c35..f1fb3689f64 100644 --- a/github/orgs_outside_collaborators_test.go +++ b/github/orgs_outside_collaborators_test.go @@ -104,8 +104,7 @@ func TestOrganizationsService_RemoveOutsideCollaborator_NonMember(t *testing.T) ctx := t.Context() _, err := client.Organizations.RemoveOutsideCollaborator(ctx, "o", "u") - var rerr *ErrorResponse - if !errors.As(err, &rerr) { + if rerr, ok := errors.AsType[*ErrorResponse](err); !ok { t.Error("Organizations.RemoveOutsideCollaborator did not return an error") } else if rerr.Response.StatusCode != http.StatusNotFound { t.Error("Organizations.RemoveOutsideCollaborator did not return 404 status code") @@ -124,8 +123,7 @@ func TestOrganizationsService_RemoveOutsideCollaborator_Member(t *testing.T) { ctx := t.Context() _, err := client.Organizations.RemoveOutsideCollaborator(ctx, "o", "u") - var rerr *ErrorResponse - if !errors.As(err, &rerr) { + if rerr, ok := errors.AsType[*ErrorResponse](err); !ok { t.Error("Organizations.RemoveOutsideCollaborator did not return an error") } else if rerr.Response.StatusCode != http.StatusUnprocessableEntity { t.Error("Organizations.RemoveOutsideCollaborator did not return 422 status code") @@ -170,8 +168,7 @@ func TestOrganizationsService_ConvertMemberToOutsideCollaborator_NonMemberOrLast ctx := t.Context() _, err := client.Organizations.ConvertMemberToOutsideCollaborator(ctx, "o", "u") - var rerr *ErrorResponse - if !errors.As(err, &rerr) { + if rerr, ok := errors.AsType[*ErrorResponse](err); !ok { t.Error("Organizations.ConvertMemberToOutsideCollaborator did not return an error") } else if rerr.Response.StatusCode != http.StatusForbidden { t.Error("Organizations.ConvertMemberToOutsideCollaborator did not return 403 status code") diff --git a/github/repos_forks.go b/github/repos_forks.go index b4f2e226417..7d80f0858a6 100644 --- a/github/repos_forks.go +++ b/github/repos_forks.go @@ -83,8 +83,7 @@ func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string resp, err := s.client.Do(req, &fork) if err != nil { // Persist AcceptedError's metadata to the Repository object. - var aerr *AcceptedError - if errors.As(err, &aerr) { + if aerr, ok := errors.AsType[*AcceptedError](err); ok { if err := json.Unmarshal(aerr.Raw, &fork); err != nil { return fork, resp, err } diff --git a/github/security_advisories.go b/github/security_advisories.go index f705d1adc5e..0b48469bd03 100644 --- a/github/security_advisories.go +++ b/github/security_advisories.go @@ -171,8 +171,7 @@ func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Conte var fork *Repository resp, err := s.client.Do(req, &fork) if err != nil { - var aerr *AcceptedError - if errors.As(err, &aerr) { + if aerr, ok := errors.AsType[*AcceptedError](err); ok { if err := json.Unmarshal(aerr.Raw, &fork); err != nil { return fork, resp, err } diff --git a/otel/go.mod b/otel/go.mod index 3dbd4297a24..97e21ec1785 100644 --- a/otel/go.mod +++ b/otel/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/otel/v90 -go 1.25.0 +go 1.26.0 require ( github.com/google/go-github/v90 v90.0.0 diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index 8b8e09c12e1..a2b05da8011 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -90,7 +90,7 @@ func deleteSubscription(t *testing.T) { func createSubscription(t *testing.T) { // watch the target repository - sub := &github.Subscription{Subscribed: github.Ptr(true)} + sub := &github.Subscription{Subscribed: new(true)} _, _, err := client.Activity.SetRepositorySubscription(t.Context(), owner, repo, sub) if err != nil { t.Fatalf("Activity.SetRepositorySubscription returned error: %v", err) diff --git a/test/integration/licences_test.go b/test/integration/licences_test.go index 1e3822f15fb..dc4a6ec4292 100644 --- a/test/integration/licences_test.go +++ b/test/integration/licences_test.go @@ -15,7 +15,7 @@ import ( func TestLicenses_ListIter(t *testing.T) { opts := &github.ListLicensesOptions{ - Featured: github.Ptr(true), + Featured: new(true), ListOptions: github.ListOptions{ Page: 1, PerPage: 1, diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index eb8294c3b8a..6914461c20f 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -22,7 +22,7 @@ func TestRepositories_CRUD(t *testing.T) { repo := createRandomTestRepository(t, "", true) // update the repository description - repo.Description = github.Ptr("description") + repo.Description = new("description") repo.DefaultBranch = nil // FIXME: this shouldn't be necessary _, _, err := client.Repositories.Edit(t.Context(), *repo.Owner.Login, *repo.Name, repo) if err != nil { @@ -99,9 +99,9 @@ func TestRepositories_EditBranches(t *testing.T) { // In order to be able to test these Restrictions, need to add support // for creating temporary organization repositories. Restrictions: nil, - BlockCreations: github.Ptr(false), - LockBranch: github.Ptr(false), - AllowForkSyncing: github.Ptr(false), + BlockCreations: new(false), + LockBranch: new(false), + AllowForkSyncing: new(false), } protection, _, err := client.Repositories.UpdateBranchProtection(t.Context(), *repo.Owner.Login, *repo.Name, "master", protectionRequest) @@ -119,18 +119,18 @@ func TestRepositories_EditBranches(t *testing.T) { RequiredApprovingReviewCount: 0, }, EnforceAdmins: &github.AdminEnforcement{ - URL: github.Ptr("https://api.github.com/repos/" + *repo.Owner.Login + "/" + *repo.Name + "/branches/master/protection/enforce_admins"), + URL: new("https://api.github.com/repos/" + *repo.Owner.Login + "/" + *repo.Name + "/branches/master/protection/enforce_admins"), Enabled: true, }, Restrictions: nil, BlockCreations: &github.BlockCreations{ - Enabled: github.Ptr(false), + Enabled: new(false), }, LockBranch: &github.LockBranch{ - Enabled: github.Ptr(false), + Enabled: new(false), }, AllowForkSyncing: &github.AllowForkSyncing{ - Enabled: github.Ptr(false), + Enabled: new(false), }, } if !cmp.Equal(protection, want) { @@ -192,7 +192,7 @@ func TestRepositories_Autolinks(t *testing.T) { body := github.CreateAutolinkRequest{ KeyPrefix: "TICKET-", URLTemplate: "https://example.com/TICKET?query=", - IsAlphanumeric: github.Ptr(false), + IsAlphanumeric: new(false), } actionlink, _, err := client.Repositories.CreateAutolink(t.Context(), *repo.Owner.Login, *repo.Name, body) diff --git a/test/integration/users_test.go b/test/integration/users_test.go index f490f4ac1c1..22c70bf9d35 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -181,7 +181,7 @@ func TestUsers_Keys(t *testing.T) { // Add new key _, _, err = client.Users.CreateKey(t.Context(), &github.Key{ - Title: github.Ptr("go-github test key"), + Title: new("go-github test key"), Key: &key, }) if err != nil { @@ -209,10 +209,10 @@ func TestUsers_Keys(t *testing.T) { // Verify that fetching individual key works k, _, err := client.Users.GetKey(t.Context(), id) if err != nil { - t.Fatalf("Users.GetKey(%q) returned error: %v", id, err) + t.Fatalf("Users.GetKey(%d) returned error: %v", id, err) } if *k.Key != key { - t.Fatalf("Users.GetKey(%q) returned key %v, want %v", id, *k.Key, key) + t.Fatalf("Users.GetKey(%d) returned key %v, want %v", id, *k.Key, key) } // Remove test key diff --git a/tools/go.mod b/tools/go.mod index 2b2bd53605b..7996dee6540 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,6 +1,6 @@ module tools -go 1.25.0 +go 1.26.0 require ( github.com/alecthomas/kong v1.16.1 diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 6f224e3dc6e..46848b200a1 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -360,18 +360,18 @@ func newTestServer(t *testing.T, ref string, files map[string]any) *httptest.Ser server := httptest.NewServer(mux) mux.HandleFunc( path.Join(repoPath, "commits", ref), - jsonHandler(emptyQuery, &github.RepositoryCommit{SHA: github.Ptr("s")}), + jsonHandler(emptyQuery, &github.RepositoryCommit{SHA: new("s")}), ) var descriptionsContent []*github.RepositoryContent for name, content := range files { descriptionsContent = append(descriptionsContent, &github.RepositoryContent{ - Name: github.Ptr(path.Base(path.Dir(name))), + Name: new(path.Base(path.Dir(name))), }) mux.HandleFunc( path.Join(repoPath, "contents/descriptions", name), jsonHandler(refQuery, &github.RepositoryContent{ - Name: github.Ptr(path.Base(name)), - DownloadURL: github.Ptr(server.URL + "/dl/" + name), + Name: new(path.Base(name)), + DownloadURL: new(server.URL + "/dl/" + name), }), ) mux.HandleFunc( From 4fbe7bab3bbe1c43aad794eadf1828cd8cef6eaf Mon Sep 17 00:00:00 2001 From: ajayk Date: Tue, 25 Aug 2026 16:21:54 -0700 Subject: [PATCH 3/3] address review comments --- CONTRIBUTING.md | 10 +- README.md | 8 +- github/doc.go | 6 +- github/gen-iterators.go | 2 +- github/gen-stringify-test.go | 18 +- github/github-iterators.go | 492 +++--- github/github-stringify_test.go | 1952 +++++++++++------------ github/github.go | 2 + github/github_test.go | 6 +- scrape/apps_test.go | 5 +- scrape/go.mod | 2 +- test/integration/users_test.go | 4 +- tools/check-structfield-settings/go.mod | 2 +- tools/extraneousnew/go.mod | 2 +- tools/fmtpercentv/go.mod | 2 +- tools/paramcheck/go.mod | 2 +- tools/redundantptr/go.mod | 2 +- tools/sliceofpointers/go.mod | 2 +- tools/structfield/go.mod | 2 +- 19 files changed, 1261 insertions(+), 1260 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 936c7c7349f..3cdb417b766 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -320,14 +320,14 @@ See [#3644][] and [#3887][] for background discussion. #### Creating Pointers Pointer fields are common because many request and response fields are -optional. Use the generic `Ptr` helper to take the address of a literal +optional. Use the `new` builtin to take the address of a literal instead of declaring an intermediate variable: ```go repo := &Repository{ - Name: Ptr("go-github"), - Private: Ptr(true), - ID: Ptr(int64(1)), + Name: new("go-github"), + Private: new(true), + ID: new(int64(1)), } ``` @@ -548,7 +548,7 @@ func TestRepositoriesService_GetByID(t *testing.T) { t.Fatalf("Repositories.GetByID returned error: %v", err) } - want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n")} + want := &Repository{ID: new(int64(1)), Name: new("n")} if !cmp.Equal(got, want) { t.Errorf("Repositories.GetByID returned %+v, want %+v", got, want) } diff --git a/README.md b/README.md index 6430571fb85..931e24603af 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ go-github tracks [Go's version support policy][support-policy] supporting any minor version of the latest two major releases of Go and the go directive in go.mod reflects that. We do our best not to break older versions of Go if we don't have to, but we -don't explicitly test older versions and as of Go 1.23 the go directive in +don't explicitly test older versions and as of Go 1.26 the go directive in go.mod declares a hard required _minimum_ version of Go to use with this module and this _must_ be greater than or equal to the go line of all dependencies so go-github will require the N-1 major release of Go by default. @@ -332,14 +332,14 @@ recommended when making requests using short-lived credentials such as a All structs for GitHub resources use pointer values for all non-repeated fields. This allows distinguishing between unset fields and those set to a zero-value. -Helper functions have been provided to easily create these pointers for string, +Use the `new` builtin to easily create these pointers for string, bool, and int values. For example: ```go // create a new private repository named "foo" repo := &github.Repository{ - Name: github.Ptr("foo"), - Private: github.Ptr(true), + Name: new("foo"), + Private: new(true), } client.Repositories.Create(ctx, "", repo) ``` diff --git a/github/doc.go b/github/doc.go index 5c6a907d21d..d23b2fb52fe 100644 --- a/github/doc.go +++ b/github/doc.go @@ -171,13 +171,13 @@ https://docs.github.com/rest/using-the-rest-api/best-practices-for-using-the-res All structs for GitHub resources use pointer values for all non-repeated fields. This allows distinguishing between unset fields and those set to a zero-value. -A helper function, [Ptr], has been provided to easily create these pointers for string, +Use the new builtin to easily create these pointers for string, bool, and int values. For example: // create a new private repository named "foo" repo := &github.Repository{ - Name: github.Ptr("foo"), - Private: github.Ptr(true), + Name: new("foo"), + Private: new(true), } client.Repositories.Create(ctx, "", repo) diff --git a/github/gen-iterators.go b/github/gen-iterators.go index a623cf1c151..67fe474402b 100644 --- a/github/gen-iterators.go +++ b/github/gen-iterators.go @@ -687,7 +687,7 @@ func ({{.RecvVar}} *{{.RecvType}}) {{.IterMethod}}({{.Args}}) iter.Seq2[{{.Retur if {{.OptsName}} == nil { {{.OptsName}} = &{{.OptsType}}{} } else { - {{.OptsName}} = Ptr(*{{.OptsName}}) + {{.OptsName}} = new(*{{.OptsName}}) } {{end}} diff --git a/github/gen-stringify-test.go b/github/gen-stringify-test.go index 2cd9daafdbe..0744e3ebe32 100644 --- a/github/gen-stringify-test.go +++ b/github/gen-stringify-test.go @@ -59,13 +59,13 @@ var ( switch v { case "false": return "false" - case "Ptr(false)": + case "new(false)": return "false" - case "Ptr(0.0)": + case "new(0.0)": return "0" - case "0", "Ptr(0)", "Ptr(int64(0))": + case "0", "new(0)", "new(int64(0))": return "0" - case `""`, `Ptr("")`: + case `""`, `new("")`: return `""` case "Timestamp{}", "&Timestamp{}": return "github.Timestamp{0001-01-01 00:00:00 +0000 UTC}" @@ -287,15 +287,15 @@ func (t *templateData) addIdentPtr(x *ast.Ident, receiverType, fieldName string) var namedStruct bool switch x.String() { case "int": - zeroValue = "Ptr(0)" + zeroValue = "new(0)" case "int64": - zeroValue = "Ptr(int64(0))" + zeroValue = "new(int64(0))" case "float64": - zeroValue = "Ptr(0.0)" + zeroValue = "new(0.0)" case "string": - zeroValue = `Ptr("")` + zeroValue = `new("")` case "bool": - zeroValue = "Ptr(false)" + zeroValue = "new(false)" case "Timestamp": zeroValue = "&Timestamp{}" default: diff --git a/github/github-iterators.go b/github/github-iterators.go index 6be130a1ec1..a687afe563d 100644 --- a/github/github-iterators.go +++ b/github/github-iterators.go @@ -21,7 +21,7 @@ func (s *ActionsService) ListArtifactsIter(ctx context.Context, owner string, re if opts == nil { opts = &ListArtifactsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -56,7 +56,7 @@ func (s *ActionsService) ListCacheUsageByRepoForOrgIter(ctx context.Context, org if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -91,7 +91,7 @@ func (s *ActionsService) ListCachesIter(ctx context.Context, owner string, repo if opts == nil { opts = &ActionsCacheListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -126,7 +126,7 @@ func (s *ActionsService) ListEnabledOrgsInEnterpriseIter(ctx context.Context, ow if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -161,7 +161,7 @@ func (s *ActionsService) ListEnabledReposInOrgIter(ctx context.Context, owner st if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -196,7 +196,7 @@ func (s *ActionsService) ListEnvSecretsIter(ctx context.Context, owner string, r if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -231,7 +231,7 @@ func (s *ActionsService) ListEnvVariablesIter(ctx context.Context, owner string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -266,7 +266,7 @@ func (s *ActionsService) ListHostedRunnersIter(ctx context.Context, org string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -301,7 +301,7 @@ func (s *ActionsService) ListOrgSecretsIter(ctx context.Context, org string, opt if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -336,7 +336,7 @@ func (s *ActionsService) ListOrgVariablesIter(ctx context.Context, org string, o if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -371,7 +371,7 @@ func (s *ActionsService) ListOrganizationRunnerGroupsIter(ctx context.Context, o if opts == nil { opts = &ListOrgRunnerGroupOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -406,7 +406,7 @@ func (s *ActionsService) ListOrganizationRunnersIter(ctx context.Context, org st if opts == nil { opts = &ListRunnersOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -441,7 +441,7 @@ func (s *ActionsService) ListRepoOrgSecretsIter(ctx context.Context, owner strin if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -476,7 +476,7 @@ func (s *ActionsService) ListRepoOrgVariablesIter(ctx context.Context, owner str if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -511,7 +511,7 @@ func (s *ActionsService) ListRepoSecretsIter(ctx context.Context, owner string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -546,7 +546,7 @@ func (s *ActionsService) ListRepoVariablesIter(ctx context.Context, owner string if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -581,7 +581,7 @@ func (s *ActionsService) ListRepositoriesSelfHostedRunnersAllowedInOrganizationI if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -616,7 +616,7 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroupIter(ctx context.Context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -651,7 +651,7 @@ func (s *ActionsService) ListRepositoryWorkflowRunsIter(ctx context.Context, own if opts == nil { opts = &ListWorkflowRunsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -686,7 +686,7 @@ func (s *ActionsService) ListRunnerGroupHostedRunnersIter(ctx context.Context, o if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -721,7 +721,7 @@ func (s *ActionsService) ListRunnerGroupRunnersIter(ctx context.Context, org str if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -756,7 +756,7 @@ func (s *ActionsService) ListRunnersIter(ctx context.Context, owner string, repo if opts == nil { opts = &ListRunnersOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -791,7 +791,7 @@ func (s *ActionsService) ListSelectedReposForOrgSecretIter(ctx context.Context, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -826,7 +826,7 @@ func (s *ActionsService) ListSelectedReposForOrgVariableIter(ctx context.Context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -861,7 +861,7 @@ func (s *ActionsService) ListWorkflowJobsIter(ctx context.Context, owner string, if opts == nil { opts = &ListWorkflowJobsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -896,7 +896,7 @@ func (s *ActionsService) ListWorkflowJobsAttemptIter(ctx context.Context, owner if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -931,7 +931,7 @@ func (s *ActionsService) ListWorkflowRunArtifactsIter(ctx context.Context, owner if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -966,7 +966,7 @@ func (s *ActionsService) ListWorkflowRunsByFileNameIter(ctx context.Context, own if opts == nil { opts = &ListWorkflowRunsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1001,7 +1001,7 @@ func (s *ActionsService) ListWorkflowRunsByIDIter(ctx context.Context, owner str if opts == nil { opts = &ListWorkflowRunsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1036,7 +1036,7 @@ func (s *ActionsService) ListWorkflowsIter(ctx context.Context, owner string, re if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1071,7 +1071,7 @@ func (s *ActivityService) ListEventsIter(ctx context.Context, opts *ListOptions) if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1102,7 +1102,7 @@ func (s *ActivityService) ListEventsForOrganizationIter(ctx context.Context, org if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1133,7 +1133,7 @@ func (s *ActivityService) ListEventsForRepoNetworkIter(ctx context.Context, owne if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1164,7 +1164,7 @@ func (s *ActivityService) ListEventsPerformedByUserIter(ctx context.Context, use if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1195,7 +1195,7 @@ func (s *ActivityService) ListEventsReceivedByUserIter(ctx context.Context, user if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1226,7 +1226,7 @@ func (s *ActivityService) ListIssueEventsForRepositoryIter(ctx context.Context, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1257,7 +1257,7 @@ func (s *ActivityService) ListNotificationsIter(ctx context.Context, opts *Notif if opts == nil { opts = &NotificationListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1288,7 +1288,7 @@ func (s *ActivityService) ListRepositoryEventsIter(ctx context.Context, owner st if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1319,7 +1319,7 @@ func (s *ActivityService) ListRepositoryNotificationsIter(ctx context.Context, o if opts == nil { opts = &NotificationListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1350,7 +1350,7 @@ func (s *ActivityService) ListStargazersIter(ctx context.Context, owner string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1381,7 +1381,7 @@ func (s *ActivityService) ListStarredIter(ctx context.Context, user string, opts if opts == nil { opts = &ActivityListStarredOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1412,7 +1412,7 @@ func (s *ActivityService) ListUserEventsForOrganizationIter(ctx context.Context, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1443,7 +1443,7 @@ func (s *ActivityService) ListWatchedIter(ctx context.Context, user string, opts if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1474,7 +1474,7 @@ func (s *ActivityService) ListWatchersIter(ctx context.Context, owner string, re if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1505,7 +1505,7 @@ func (s *AgentTasksService) ListIter(ctx context.Context, opts *AgentTaskListOpt if opts == nil { opts = &AgentTaskListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1540,7 +1540,7 @@ func (s *AgentTasksService) ListByRepoIter(ctx context.Context, owner string, re if opts == nil { opts = &AgentTaskListByRepoOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1575,7 +1575,7 @@ func (s *AppsService) ListHookDeliveriesIter(ctx context.Context, opts *ListCurs if opts == nil { opts = &ListCursorOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1606,7 +1606,7 @@ func (s *AppsService) ListInstallationRequestsIter(ctx context.Context, opts *Li if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1637,7 +1637,7 @@ func (s *AppsService) ListInstallationsIter(ctx context.Context, opts *ListOptio if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1668,7 +1668,7 @@ func (s *AppsService) ListReposIter(ctx context.Context, opts *ListOptions) iter if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1703,7 +1703,7 @@ func (s *AppsService) ListUserInstallationsIter(ctx context.Context, opts *ListO if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1734,7 +1734,7 @@ func (s *AppsService) ListUserReposIter(ctx context.Context, id int64, opts *Lis if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1769,7 +1769,7 @@ func (s *ChecksService) ListCheckRunAnnotationsIter(ctx context.Context, owner s if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1800,7 +1800,7 @@ func (s *ChecksService) ListCheckRunsCheckSuiteIter(ctx context.Context, owner s if opts == nil { opts = &ListCheckRunsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1835,7 +1835,7 @@ func (s *ChecksService) ListCheckRunsForRefIter(ctx context.Context, owner strin if opts == nil { opts = &ListCheckRunsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1870,7 +1870,7 @@ func (s *ChecksService) ListCheckSuitesForRefIter(ctx context.Context, owner str if opts == nil { opts = &ListCheckSuiteOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1905,7 +1905,7 @@ func (s *ClassroomService) ListAcceptedAssignmentsIter(ctx context.Context, assi if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1936,7 +1936,7 @@ func (s *ClassroomService) ListClassroomAssignmentsIter(ctx context.Context, cla if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1967,7 +1967,7 @@ func (s *ClassroomService) ListClassroomsIter(ctx context.Context, opts *ListOpt if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -1998,7 +1998,7 @@ func (s *CodeQualityService) ListFindingsIter(ctx context.Context, owner string, if opts == nil { opts = &ListCodeQualityFindingsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2029,7 +2029,7 @@ func (s *CodeScanningService) ListAlertInstancesIter(ctx context.Context, owner if opts == nil { opts = &AlertInstancesListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2060,7 +2060,7 @@ func (s *CodeScanningService) ListAlertsForOrgIter(ctx context.Context, org stri if opts == nil { opts = &AlertListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2092,7 +2092,7 @@ func (s *CodeScanningService) ListAlertsForRepoIter(ctx context.Context, owner s if opts == nil { opts = &AlertListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2124,7 +2124,7 @@ func (s *CodeScanningService) ListAnalysesForRepoIter(ctx context.Context, owner if opts == nil { opts = &AnalysesListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2155,7 +2155,7 @@ func (s *CodespacesService) ListIter(ctx context.Context, opts *ListCodespacesOp if opts == nil { opts = &ListCodespacesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2190,7 +2190,7 @@ func (s *CodespacesService) ListDevContainerConfigurationsIter(ctx context.Conte if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2225,7 +2225,7 @@ func (s *CodespacesService) ListInOrgIter(ctx context.Context, org string, opts if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2260,7 +2260,7 @@ func (s *CodespacesService) ListInRepoIter(ctx context.Context, owner string, re if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2295,7 +2295,7 @@ func (s *CodespacesService) ListOrgSecretsIter(ctx context.Context, org string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2330,7 +2330,7 @@ func (s *CodespacesService) ListRepoSecretsIter(ctx context.Context, owner strin if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2365,7 +2365,7 @@ func (s *CodespacesService) ListSelectedReposForOrgSecretIter(ctx context.Contex if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2400,7 +2400,7 @@ func (s *CodespacesService) ListSelectedReposForUserSecretIter(ctx context.Conte if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2435,7 +2435,7 @@ func (s *CodespacesService) ListUserCodespacesInOrgIter(ctx context.Context, org if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2470,7 +2470,7 @@ func (s *CodespacesService) ListUserSecretsIter(ctx context.Context, opts *ListO if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2505,7 +2505,7 @@ func (s *CopilotService) ListCopilotEnterpriseSeatsIter(ctx context.Context, ent if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2540,7 +2540,7 @@ func (s *CopilotService) ListCopilotSeatsIter(ctx context.Context, org string, o if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2575,7 +2575,7 @@ func (s *CopilotService) ListOrganizationCodingAgentRepositoriesIter(ctx context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2610,7 +2610,7 @@ func (s *DependabotService) ListOrgAlertsIter(ctx context.Context, org string, o if opts == nil { opts = &ListAlertsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2642,7 +2642,7 @@ func (s *DependabotService) ListOrgSecretsIter(ctx context.Context, org string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2677,7 +2677,7 @@ func (s *DependabotService) ListRepoAlertsIter(ctx context.Context, owner string if opts == nil { opts = &ListAlertsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2709,7 +2709,7 @@ func (s *DependabotService) ListRepoSecretsIter(ctx context.Context, owner strin if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2744,7 +2744,7 @@ func (s *DependabotService) ListSelectedReposForOrgSecretIter(ctx context.Contex if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2779,7 +2779,7 @@ func (s *EnterpriseService) ListAppAccessibleOrganizationRepositoriesIter(ctx co if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2810,7 +2810,7 @@ func (s *EnterpriseService) ListAppInstallableOrganizationsIter(ctx context.Cont if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2841,7 +2841,7 @@ func (s *EnterpriseService) ListAppInstallationsIter(ctx context.Context, enterp if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2872,7 +2872,7 @@ func (s *EnterpriseService) ListAssignmentsIter(ctx context.Context, enterprise if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2903,7 +2903,7 @@ func (s *EnterpriseService) ListCodeSecurityConfigurationRepositoriesIter(ctx co if opts == nil { opts = &ListCodeSecurityConfigurationRepositoriesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2934,7 +2934,7 @@ func (s *EnterpriseService) ListCodeSecurityConfigurationsIter(ctx context.Conte if opts == nil { opts = &ListEnterpriseCodeSecurityConfigurationOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -2965,7 +2965,7 @@ func (s *EnterpriseService) ListConsumedLicensesIter(ctx context.Context, enterp if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3000,7 +3000,7 @@ func (s *EnterpriseService) ListEnterpriseNetworkConfigurationsIter(ctx context. if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3035,7 +3035,7 @@ func (s *EnterpriseService) ListHostedRunnersIter(ctx context.Context, enterpris if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3070,7 +3070,7 @@ func (s *EnterpriseService) ListOrganizationAccessRunnerGroupIter(ctx context.Co if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3105,7 +3105,7 @@ func (s *EnterpriseService) ListOrganizationCustomPropertyValuesIter(ctx context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3136,7 +3136,7 @@ func (s *EnterpriseService) ListRepositoriesForOrgAppInstallationIter(ctx contex if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3167,7 +3167,7 @@ func (s *EnterpriseService) ListRunnerGroupRunnersIter(ctx context.Context, ente if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3202,7 +3202,7 @@ func (s *EnterpriseService) ListRunnerGroupsIter(ctx context.Context, enterprise if opts == nil { opts = &ListEnterpriseRunnerGroupOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3237,7 +3237,7 @@ func (s *EnterpriseService) ListRunnersIter(ctx context.Context, enterprise stri if opts == nil { opts = &ListRunnersOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3272,7 +3272,7 @@ func (s *EnterpriseService) ListTeamMembersIter(ctx context.Context, enterprise if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3303,7 +3303,7 @@ func (s *EnterpriseService) ListTeamsIter(ctx context.Context, enterprise string if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3334,7 +3334,7 @@ func (s *GistsService) ListIter(ctx context.Context, user string, opts *GistList if opts == nil { opts = &GistListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3365,7 +3365,7 @@ func (s *GistsService) ListAllIter(ctx context.Context, opts *GistListOptions) i if opts == nil { opts = &GistListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3396,7 +3396,7 @@ func (s *GistsService) ListCommentsIter(ctx context.Context, gistID string, opts if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3427,7 +3427,7 @@ func (s *GistsService) ListCommitsIter(ctx context.Context, id string, opts *Lis if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3458,7 +3458,7 @@ func (s *GistsService) ListForksIter(ctx context.Context, id string, opts *ListO if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3489,7 +3489,7 @@ func (s *GistsService) ListStarredIter(ctx context.Context, opts *GistListOption if opts == nil { opts = &GistListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3520,7 +3520,7 @@ func (s *IssuesService) ListAllIssuesIter(ctx context.Context, opts *ListAllIssu if opts == nil { opts = &ListAllIssuesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3551,7 +3551,7 @@ func (s *IssuesService) ListAssigneesIter(ctx context.Context, owner string, rep if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3582,7 +3582,7 @@ func (s *IssuesService) ListBlockedByIter(ctx context.Context, owner string, rep if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3613,7 +3613,7 @@ func (s *IssuesService) ListBlockingIter(ctx context.Context, owner string, repo if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3644,7 +3644,7 @@ func (s *IssuesService) ListByOrgIter(ctx context.Context, org string, opts *Iss if opts == nil { opts = &IssueListByOrgOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3675,7 +3675,7 @@ func (s *IssuesService) ListByRepoIter(ctx context.Context, owner string, repo s if opts == nil { opts = &IssueListByRepoOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3707,7 +3707,7 @@ func (s *IssuesService) ListCommentsIter(ctx context.Context, owner string, repo if opts == nil { opts = &IssueListCommentsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3738,7 +3738,7 @@ func (s *IssuesService) ListIssueEventsIter(ctx context.Context, owner string, r if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3769,7 +3769,7 @@ func (s *IssuesService) ListIssueTimelineIter(ctx context.Context, owner string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3800,7 +3800,7 @@ func (s *IssuesService) ListLabelsIter(ctx context.Context, owner string, repo s if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3831,7 +3831,7 @@ func (s *IssuesService) ListLabelsByIssueIter(ctx context.Context, owner string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3862,7 +3862,7 @@ func (s *IssuesService) ListLabelsForMilestoneIter(ctx context.Context, owner st if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3893,7 +3893,7 @@ func (s *IssuesService) ListMilestonesIter(ctx context.Context, owner string, re if opts == nil { opts = &MilestoneListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3924,7 +3924,7 @@ func (s *IssuesService) ListRepositoryEventsIter(ctx context.Context, owner stri if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3955,7 +3955,7 @@ func (s *IssuesService) ListUserIssuesIter(ctx context.Context, opts *ListUserIs if opts == nil { opts = &ListUserIssuesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -3986,7 +3986,7 @@ func (s *LicensesService) ListIter(ctx context.Context, opts *ListLicensesOption if opts == nil { opts = &ListLicensesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4017,7 +4017,7 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUserIter(ctx context.Con if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4048,7 +4048,7 @@ func (s *MarketplaceService) ListPlanAccountsForPlanIter(ctx context.Context, pl if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4079,7 +4079,7 @@ func (s *MarketplaceService) ListPlansIter(ctx context.Context, opts *ListOption if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4110,7 +4110,7 @@ func (s *MigrationService) ListMigrationsIter(ctx context.Context, org string, o if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4141,7 +4141,7 @@ func (s *MigrationService) ListUserMigrationsIter(ctx context.Context, opts *Lis if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4172,7 +4172,7 @@ func (s *OrganizationsService) ListIter(ctx context.Context, user string, opts * if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4203,7 +4203,7 @@ func (s *OrganizationsService) ListAllRepositoryRulesetsIter(ctx context.Context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4234,7 +4234,7 @@ func (s *OrganizationsService) ListAttestationsIter(ctx context.Context, org str if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4269,7 +4269,7 @@ func (s *OrganizationsService) ListBlockedUsersIter(ctx context.Context, org str if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4300,7 +4300,7 @@ func (s *OrganizationsService) ListCodeSecurityConfigurationRepositoriesIter(ctx if opts == nil { opts = &ListCodeSecurityConfigurationRepositoriesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4331,7 +4331,7 @@ func (s *OrganizationsService) ListCodeSecurityConfigurationsIter(ctx context.Co if opts == nil { opts = &ListOrgCodeSecurityConfigurationOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4362,7 +4362,7 @@ func (s *OrganizationsService) ListCredentialAuthorizationsIter(ctx context.Cont if opts == nil { opts = &CredentialAuthorizationsListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4393,7 +4393,7 @@ func (s *OrganizationsService) ListCustomPropertyValuesIter(ctx context.Context, if opts == nil { opts = &ListCustomPropertyValuesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4424,7 +4424,7 @@ func (s *OrganizationsService) ListFailedOrgInvitationsIter(ctx context.Context, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4455,7 +4455,7 @@ func (s *OrganizationsService) ListFineGrainedPersonalAccessTokenRequestsIter(ct if opts == nil { opts = &ListFineGrainedPATOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4486,7 +4486,7 @@ func (s *OrganizationsService) ListFineGrainedPersonalAccessTokensIter(ctx conte if opts == nil { opts = &ListFineGrainedPATOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4517,7 +4517,7 @@ func (s *OrganizationsService) ListHookDeliveriesIter(ctx context.Context, org s if opts == nil { opts = &ListCursorOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4548,7 +4548,7 @@ func (s *OrganizationsService) ListHooksIter(ctx context.Context, org string, op if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4579,7 +4579,7 @@ func (s *OrganizationsService) ListImmutableReleaseRepositoriesIter(ctx context. if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4614,7 +4614,7 @@ func (s *OrganizationsService) ListInstallationsIter(ctx context.Context, org st if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4649,7 +4649,7 @@ func (s *OrganizationsService) ListMembersIter(ctx context.Context, org string, if opts == nil { opts = &ListMembersOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4680,7 +4680,7 @@ func (s *OrganizationsService) ListNetworkConfigurationsIter(ctx context.Context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4715,7 +4715,7 @@ func (s *OrganizationsService) ListOrgInvitationTeamsIter(ctx context.Context, o if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4746,7 +4746,7 @@ func (s *OrganizationsService) ListOrgMembershipsIter(ctx context.Context, opts if opts == nil { opts = &ListOrgMembershipsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4777,7 +4777,7 @@ func (s *OrganizationsService) ListOutsideCollaboratorsIter(ctx context.Context, if opts == nil { opts = &ListOutsideCollaboratorsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4808,7 +4808,7 @@ func (s *OrganizationsService) ListPackagesIter(ctx context.Context, org string, if opts == nil { opts = &PackageListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4839,7 +4839,7 @@ func (s *OrganizationsService) ListPendingOrgInvitationsIter(ctx context.Context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4870,7 +4870,7 @@ func (s *OrganizationsService) ListTeamsAssignedToOrgRoleIter(ctx context.Contex if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4901,7 +4901,7 @@ func (s *OrganizationsService) ListUsersAssignedToOrgRoleIter(ctx context.Contex if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4932,7 +4932,7 @@ func (s *PrivateRegistriesService) ListOrganizationPrivateRegistriesIter(ctx con if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4967,7 +4967,7 @@ func (s *ProjectsService) ListOrganizationProjectFieldsIter(ctx context.Context, if opts == nil { opts = &ListProjectsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -4998,7 +4998,7 @@ func (s *ProjectsService) ListOrganizationProjectItemsIter(ctx context.Context, if opts == nil { opts = &ListProjectItemsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5029,7 +5029,7 @@ func (s *ProjectsService) ListOrganizationProjectViewItemsIter(ctx context.Conte if opts == nil { opts = &ListProjectItemsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5060,7 +5060,7 @@ func (s *ProjectsService) ListOrganizationProjectsIter(ctx context.Context, org if opts == nil { opts = &ListProjectsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5091,7 +5091,7 @@ func (s *ProjectsService) ListUserProjectFieldsIter(ctx context.Context, user st if opts == nil { opts = &ListProjectsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5122,7 +5122,7 @@ func (s *ProjectsService) ListUserProjectItemsIter(ctx context.Context, username if opts == nil { opts = &ListProjectItemsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5153,7 +5153,7 @@ func (s *ProjectsService) ListUserProjectViewItemsIter(ctx context.Context, user if opts == nil { opts = &ListProjectItemsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5184,7 +5184,7 @@ func (s *ProjectsService) ListUserProjectsIter(ctx context.Context, username str if opts == nil { opts = &ListProjectsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5215,7 +5215,7 @@ func (s *PullRequestsService) ListIter(ctx context.Context, owner string, repo s if opts == nil { opts = &PullRequestListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5246,7 +5246,7 @@ func (s *PullRequestsService) ListCommentsIter(ctx context.Context, owner string if opts == nil { opts = &PullRequestListCommentsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5277,7 +5277,7 @@ func (s *PullRequestsService) ListCommitsIter(ctx context.Context, owner string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5308,7 +5308,7 @@ func (s *PullRequestsService) ListFilesIter(ctx context.Context, owner string, r if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5339,7 +5339,7 @@ func (s *PullRequestsService) ListPullRequestsWithCommitIter(ctx context.Context if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5370,7 +5370,7 @@ func (s *PullRequestsService) ListReviewCommentsIter(ctx context.Context, owner if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5401,7 +5401,7 @@ func (s *PullRequestsService) ListReviewsIter(ctx context.Context, owner string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5432,7 +5432,7 @@ func (s *ReactionsService) ListCommentReactionsIter(ctx context.Context, owner s if opts == nil { opts = &ListReactionOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5463,7 +5463,7 @@ func (s *ReactionsService) ListIssueCommentReactionsIter(ctx context.Context, ow if opts == nil { opts = &ListReactionOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5494,7 +5494,7 @@ func (s *ReactionsService) ListIssueReactionsIter(ctx context.Context, owner str if opts == nil { opts = &ListReactionOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5525,7 +5525,7 @@ func (s *ReactionsService) ListPullRequestCommentReactionsIter(ctx context.Conte if opts == nil { opts = &ListReactionOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5556,7 +5556,7 @@ func (s *ReactionsService) ListReleaseReactionsIter(ctx context.Context, owner s if opts == nil { opts = &ListReactionOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5587,7 +5587,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactionsIter(ctx context.Co if opts == nil { opts = &ListReactionOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5618,7 +5618,7 @@ func (s *ReactionsService) ListTeamDiscussionReactionsIter(ctx context.Context, if opts == nil { opts = &ListReactionOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5649,7 +5649,7 @@ func (s *RepositoriesService) ListCommitComparisonFilesIter(ctx context.Context, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5684,7 +5684,7 @@ func (s *RepositoriesService) ListCombinedStatusIter(ctx context.Context, owner if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5719,7 +5719,7 @@ func (s *RepositoriesService) ListCommitFilesIter(ctx context.Context, owner str if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5754,7 +5754,7 @@ func (s *RepositoriesService) ListIter(ctx context.Context, user string, opts *R if opts == nil { opts = &RepositoryListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5785,7 +5785,7 @@ func (s *RepositoriesService) ListAllTopicsIter(ctx context.Context, owner strin if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5816,7 +5816,7 @@ func (s *RepositoriesService) ListAttestationsIter(ctx context.Context, owner st if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5851,7 +5851,7 @@ func (s *RepositoriesService) ListBranchesIter(ctx context.Context, owner string if opts == nil { opts = &BranchListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5882,7 +5882,7 @@ func (s *RepositoriesService) ListByAuthenticatedUserIter(ctx context.Context, o if opts == nil { opts = &RepositoryListByAuthenticatedUserOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5913,7 +5913,7 @@ func (s *RepositoriesService) ListByOrgIter(ctx context.Context, org string, opt if opts == nil { opts = &RepositoryListByOrgOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5944,7 +5944,7 @@ func (s *RepositoriesService) ListByUserIter(ctx context.Context, user string, o if opts == nil { opts = &RepositoryListByUserOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -5975,7 +5975,7 @@ func (s *RepositoriesService) ListCollaboratorsIter(ctx context.Context, owner s if opts == nil { opts = &ListCollaboratorsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6006,7 +6006,7 @@ func (s *RepositoriesService) ListCommentsIter(ctx context.Context, owner string if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6037,7 +6037,7 @@ func (s *RepositoriesService) ListCommitCommentsIter(ctx context.Context, owner if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6068,7 +6068,7 @@ func (s *RepositoriesService) ListCommitsIter(ctx context.Context, owner string, if opts == nil { opts = &CommitsListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6099,7 +6099,7 @@ func (s *RepositoriesService) ListContributorsIter(ctx context.Context, owner st if opts == nil { opts = &ListContributorsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6130,7 +6130,7 @@ func (s *RepositoriesService) ListCustomDeploymentRuleIntegrationsIter(ctx conte if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6165,7 +6165,7 @@ func (s *RepositoriesService) ListDeploymentBranchPoliciesIter(ctx context.Conte if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6200,7 +6200,7 @@ func (s *RepositoriesService) ListDeploymentStatusesIter(ctx context.Context, ow if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6231,7 +6231,7 @@ func (s *RepositoriesService) ListDeploymentsIter(ctx context.Context, owner str if opts == nil { opts = &DeploymentsListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6262,7 +6262,7 @@ func (s *RepositoriesService) ListEnvironmentsIter(ctx context.Context, owner st if opts == nil { opts = &EnvironmentListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6297,7 +6297,7 @@ func (s *RepositoriesService) ListForksIter(ctx context.Context, owner string, r if opts == nil { opts = &RepositoryListForksOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6328,7 +6328,7 @@ func (s *RepositoriesService) ListHookDeliveriesIter(ctx context.Context, owner if opts == nil { opts = &ListCursorOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6359,7 +6359,7 @@ func (s *RepositoriesService) ListHooksIter(ctx context.Context, owner string, r if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6390,7 +6390,7 @@ func (s *RepositoriesService) ListInvitationsIter(ctx context.Context, owner str if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6421,7 +6421,7 @@ func (s *RepositoriesService) ListKeysIter(ctx context.Context, owner string, re if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6452,7 +6452,7 @@ func (s *RepositoriesService) ListPagesBuildsIter(ctx context.Context, owner str if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6483,7 +6483,7 @@ func (s *RepositoriesService) ListPreReceiveHooksIter(ctx context.Context, owner if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6514,7 +6514,7 @@ func (s *RepositoriesService) ListReleaseAssetsIter(ctx context.Context, owner s if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6545,7 +6545,7 @@ func (s *RepositoriesService) ListReleasesIter(ctx context.Context, owner string if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6576,7 +6576,7 @@ func (s *RepositoriesService) ListRepositoryActivitiesIter(ctx context.Context, if opts == nil { opts = &ListRepositoryActivityOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6607,7 +6607,7 @@ func (s *RepositoriesService) ListStatusesIter(ctx context.Context, owner string if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6638,7 +6638,7 @@ func (s *RepositoriesService) ListTagsIter(ctx context.Context, owner string, re if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6669,7 +6669,7 @@ func (s *RepositoriesService) ListTeamsIter(ctx context.Context, owner string, r if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6700,7 +6700,7 @@ func (s *SecretScanningService) ListAlertsForEnterpriseIter(ctx context.Context, if opts == nil { opts = &SecretScanningAlertListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6732,7 +6732,7 @@ func (s *SecretScanningService) ListAlertsForOrgIter(ctx context.Context, org st if opts == nil { opts = &SecretScanningAlertListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6764,7 +6764,7 @@ func (s *SecretScanningService) ListAlertsForRepoIter(ctx context.Context, owner if opts == nil { opts = &SecretScanningAlertListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6796,7 +6796,7 @@ func (s *SecretScanningService) ListCustomPatternsForEnterpriseIter(ctx context. if opts == nil { opts = &SecretScanningCustomPatternListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6827,7 +6827,7 @@ func (s *SecretScanningService) ListCustomPatternsForOrgIter(ctx context.Context if opts == nil { opts = &SecretScanningCustomPatternListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6858,7 +6858,7 @@ func (s *SecretScanningService) ListCustomPatternsForRepoIter(ctx context.Contex if opts == nil { opts = &SecretScanningCustomPatternListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6889,7 +6889,7 @@ func (s *SecretScanningService) ListLocationsForAlertIter(ctx context.Context, o if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6920,7 +6920,7 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisoriesIter(ctx context if opts == nil { opts = &ListGlobalSecurityAdvisoriesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6951,7 +6951,7 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesIter(ctx con if opts == nil { opts = &ListRepositorySecurityAdvisoriesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -6982,7 +6982,7 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrgIter(c if opts == nil { opts = &ListRepositorySecurityAdvisoriesOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7013,7 +7013,7 @@ func (s *SubIssueService) ListByIssueIter(ctx context.Context, owner string, rep if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7044,7 +7044,7 @@ func (s *TeamsService) ListChildTeamsByParentIDIter(ctx context.Context, orgID i if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7075,7 +7075,7 @@ func (s *TeamsService) ListChildTeamsByParentSlugIter(ctx context.Context, org s if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7106,7 +7106,7 @@ func (s *TeamsService) ListCommentsByIDIter(ctx context.Context, orgID int64, te if opts == nil { opts = &DiscussionCommentListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7137,7 +7137,7 @@ func (s *TeamsService) ListCommentsBySlugIter(ctx context.Context, org string, s if opts == nil { opts = &DiscussionCommentListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7168,7 +7168,7 @@ func (s *TeamsService) ListDiscussionsByIDIter(ctx context.Context, orgID int64, if opts == nil { opts = &DiscussionListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7199,7 +7199,7 @@ func (s *TeamsService) ListDiscussionsBySlugIter(ctx context.Context, org string if opts == nil { opts = &DiscussionListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7230,7 +7230,7 @@ func (s *TeamsService) ListExternalGroupsIter(ctx context.Context, org string, o if opts == nil { opts = &ListExternalGroupsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7265,7 +7265,7 @@ func (s *TeamsService) ListIDPGroupsInOrganizationIter(ctx context.Context, org if opts == nil { opts = &ListIDPGroupsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7300,7 +7300,7 @@ func (s *TeamsService) ListPendingTeamInvitationsByIDIter(ctx context.Context, o if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7331,7 +7331,7 @@ func (s *TeamsService) ListPendingTeamInvitationsBySlugIter(ctx context.Context, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7362,7 +7362,7 @@ func (s *TeamsService) ListTeamMembersByIDIter(ctx context.Context, orgID int64, if opts == nil { opts = &TeamListTeamMembersOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7393,7 +7393,7 @@ func (s *TeamsService) ListTeamMembersBySlugIter(ctx context.Context, org string if opts == nil { opts = &TeamListTeamMembersOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7424,7 +7424,7 @@ func (s *TeamsService) ListTeamReposByIDIter(ctx context.Context, orgID int64, t if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7455,7 +7455,7 @@ func (s *TeamsService) ListTeamReposBySlugIter(ctx context.Context, org string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7486,7 +7486,7 @@ func (s *TeamsService) ListTeamsIter(ctx context.Context, org string, opts *List if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7517,7 +7517,7 @@ func (s *TeamsService) ListUserTeamsIter(ctx context.Context, opts *ListOptions) if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7548,7 +7548,7 @@ func (s *UsersService) ListAttestationsIter(ctx context.Context, user string, su if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7583,7 +7583,7 @@ func (s *UsersService) ListBlockedUsersIter(ctx context.Context, opts *ListOptio if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7614,7 +7614,7 @@ func (s *UsersService) ListEmailsIter(ctx context.Context, opts *ListOptions) it if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7645,7 +7645,7 @@ func (s *UsersService) ListFollowersIter(ctx context.Context, user string, opts if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7676,7 +7676,7 @@ func (s *UsersService) ListFollowingIter(ctx context.Context, user string, opts if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7707,7 +7707,7 @@ func (s *UsersService) ListGPGKeysIter(ctx context.Context, user string, opts *L if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7738,7 +7738,7 @@ func (s *UsersService) ListInvitationsIter(ctx context.Context, opts *ListOption if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7769,7 +7769,7 @@ func (s *UsersService) ListKeysIter(ctx context.Context, user string, opts *List if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7800,7 +7800,7 @@ func (s *UsersService) ListPackageVersionsIter(ctx context.Context, packageType if opts == nil { opts = &ListPackageVersionsOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7831,7 +7831,7 @@ func (s *UsersService) ListPackagesIter(ctx context.Context, user string, opts * if opts == nil { opts = &PackageListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7862,7 +7862,7 @@ func (s *UsersService) ListSSHSigningKeysIter(ctx context.Context, user string, if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7893,7 +7893,7 @@ func (s *UsersService) ListSocialAccountsIter(ctx context.Context, opts *ListOpt if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { @@ -7924,7 +7924,7 @@ func (s *UsersService) ListUserSocialAccountsIter(ctx context.Context, username if opts == nil { opts = &ListOptions{} } else { - opts = Ptr(*opts) + opts = new(*opts) } for { diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 6a439727b82..d0b1ecb6ace 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -16,11 +16,11 @@ import ( func TestAcceptedAssignment_String(t *testing.T) { t.Parallel() v := AcceptedAssignment{ - ID: Ptr(int64(0)), - Submitted: Ptr(false), - Passing: Ptr(false), - CommitCount: Ptr(0), - Grade: Ptr(""), + ID: new(int64(0)), + Submitted: new(false), + Passing: new(false), + CommitCount: new(0), + Grade: new(""), Repository: &Repository{}, Assignment: &ClassroomAssignment{}, } @@ -33,8 +33,8 @@ func TestAcceptedAssignment_String(t *testing.T) { func TestActionsAllowed_String(t *testing.T) { t.Parallel() v := ActionsAllowed{ - GithubOwnedAllowed: Ptr(false), - VerifiedAllowed: Ptr(false), + GithubOwnedAllowed: new(false), + VerifiedAllowed: new(false), PatternsAllowed: []string{""}, } want := `github.ActionsAllowed{GithubOwnedAllowed:false, VerifiedAllowed:false, PatternsAllowed:[""]}` @@ -46,10 +46,10 @@ func TestActionsAllowed_String(t *testing.T) { func TestActionsPermissions_String(t *testing.T) { t.Parallel() v := ActionsPermissions{ - EnabledRepositories: Ptr(""), - AllowedActions: Ptr(""), - SelectedActionsURL: Ptr(""), - SHAPinningRequired: Ptr(false), + EnabledRepositories: new(""), + AllowedActions: new(""), + SelectedActionsURL: new(""), + SHAPinningRequired: new(false), } want := `github.ActionsPermissions{EnabledRepositories:"", AllowedActions:"", SelectedActionsURL:"", SHAPinningRequired:false}` if got := v.String(); got != want { @@ -60,9 +60,9 @@ func TestActionsPermissions_String(t *testing.T) { func TestActionsPermissionsEnterprise_String(t *testing.T) { t.Parallel() v := ActionsPermissionsEnterprise{ - EnabledOrganizations: Ptr(""), - AllowedActions: Ptr(""), - SelectedActionsURL: Ptr(""), + EnabledOrganizations: new(""), + AllowedActions: new(""), + SelectedActionsURL: new(""), } want := `github.ActionsPermissionsEnterprise{EnabledOrganizations:"", AllowedActions:"", SelectedActionsURL:""}` if got := v.String(); got != want { @@ -73,10 +73,10 @@ func TestActionsPermissionsEnterprise_String(t *testing.T) { func TestActionsPermissionsRepository_String(t *testing.T) { t.Parallel() v := ActionsPermissionsRepository{ - Enabled: Ptr(false), - AllowedActions: Ptr(""), - SelectedActionsURL: Ptr(""), - SHAPinningRequired: Ptr(false), + Enabled: new(false), + AllowedActions: new(""), + SelectedActionsURL: new(""), + SHAPinningRequired: new(false), } want := `github.ActionsPermissionsRepository{Enabled:false, AllowedActions:"", SelectedActionsURL:"", SHAPinningRequired:false}` if got := v.String(); got != want { @@ -107,7 +107,7 @@ func TestAdminStats_String(t *testing.T) { func TestAdvancedSecurity_String(t *testing.T) { t.Parallel() v := AdvancedSecurity{ - Status: Ptr(""), + Status: new(""), } want := `github.AdvancedSecurity{Status:""}` if got := v.String(); got != want { @@ -118,8 +118,8 @@ func TestAdvancedSecurity_String(t *testing.T) { func TestArtifactPeriod_String(t *testing.T) { t.Parallel() v := ArtifactPeriod{ - Days: Ptr(0), - MaximumAllowedDays: Ptr(0), + Days: new(0), + MaximumAllowedDays: new(0), } want := `github.ArtifactPeriod{Days:0, MaximumAllowedDays:0}` if got := v.String(); got != want { @@ -130,17 +130,17 @@ func TestArtifactPeriod_String(t *testing.T) { func TestAssignmentGrade_String(t *testing.T) { t.Parallel() v := AssignmentGrade{ - AssignmentName: Ptr(""), - AssignmentURL: Ptr(""), - StarterCodeURL: Ptr(""), - GithubUsername: Ptr(""), - RosterIdentifier: Ptr(""), - StudentRepositoryName: Ptr(""), - StudentRepositoryURL: Ptr(""), + AssignmentName: new(""), + AssignmentURL: new(""), + StarterCodeURL: new(""), + GithubUsername: new(""), + RosterIdentifier: new(""), + StudentRepositoryName: new(""), + StudentRepositoryURL: new(""), SubmissionTimestamp: &Timestamp{}, - PointsAwarded: Ptr(0), - PointsAvailable: Ptr(0), - GroupName: Ptr(""), + PointsAwarded: new(0), + PointsAvailable: new(0), + GroupName: new(""), } want := `github.AssignmentGrade{AssignmentName:"", AssignmentURL:"", StarterCodeURL:"", GithubUsername:"", RosterIdentifier:"", StudentRepositoryName:"", StudentRepositoryURL:"", SubmissionTimestamp:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, PointsAwarded:0, PointsAvailable:0, GroupName:""}` if got := v.String(); got != want { @@ -151,18 +151,18 @@ func TestAssignmentGrade_String(t *testing.T) { func TestAuthorization_String(t *testing.T) { t.Parallel() v := Authorization{ - ID: Ptr(int64(0)), - URL: Ptr(""), + ID: new(int64(0)), + URL: new(""), Scopes: []Scope{ScopeNone}, - Token: Ptr(""), - TokenLastEight: Ptr(""), - HashedToken: Ptr(""), + Token: new(""), + TokenLastEight: new(""), + HashedToken: new(""), App: &AuthorizationApp{}, - Note: Ptr(""), - NoteURL: Ptr(""), + Note: new(""), + NoteURL: new(""), UpdatedAt: &Timestamp{}, CreatedAt: &Timestamp{}, - Fingerprint: Ptr(""), + Fingerprint: new(""), User: &User{}, } want := `github.Authorization{ID:0, URL:"", Scopes:["(no scope)"], Token:"", TokenLastEight:"", HashedToken:"", App:github.AuthorizationApp{}, Note:"", NoteURL:"", UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Fingerprint:"", User:github.User{}}` @@ -174,9 +174,9 @@ func TestAuthorization_String(t *testing.T) { func TestAuthorizationApp_String(t *testing.T) { t.Parallel() v := AuthorizationApp{ - URL: Ptr(""), - Name: Ptr(""), - ClientID: Ptr(""), + URL: new(""), + Name: new(""), + ClientID: new(""), } want := `github.AuthorizationApp{URL:"", Name:"", ClientID:""}` if got := v.String(); got != want { @@ -188,11 +188,11 @@ func TestAuthorizationRequest_String(t *testing.T) { t.Parallel() v := AuthorizationRequest{ Scopes: []Scope{ScopeNone}, - Note: Ptr(""), - NoteURL: Ptr(""), - ClientID: Ptr(""), - ClientSecret: Ptr(""), - Fingerprint: Ptr(""), + Note: new(""), + NoteURL: new(""), + ClientID: new(""), + ClientSecret: new(""), + Fingerprint: new(""), } want := `github.AuthorizationRequest{Scopes:["(no scope)"], Note:"", NoteURL:"", ClientID:"", ClientSecret:"", Fingerprint:""}` if got := v.String(); got != want { @@ -206,9 +206,9 @@ func TestAuthorizationUpdateRequest_String(t *testing.T) { Scopes: []string{""}, AddScopes: []string{""}, RemoveScopes: []string{""}, - Note: Ptr(""), - NoteURL: Ptr(""), - Fingerprint: Ptr(""), + Note: new(""), + NoteURL: new(""), + Fingerprint: new(""), } want := `github.AuthorizationUpdateRequest{Scopes:[""], AddScopes:[""], RemoveScopes:[""], Note:"", NoteURL:"", Fingerprint:""}` if got := v.String(); got != want { @@ -219,19 +219,19 @@ func TestAuthorizationUpdateRequest_String(t *testing.T) { func TestCheckRun_String(t *testing.T) { t.Parallel() v := CheckRun{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - HeadSHA: Ptr(""), - ExternalID: Ptr(""), - URL: Ptr(""), - HTMLURL: Ptr(""), - DetailsURL: Ptr(""), - Status: Ptr(""), - Conclusion: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), + HeadSHA: new(""), + ExternalID: new(""), + URL: new(""), + HTMLURL: new(""), + DetailsURL: new(""), + Status: new(""), + Conclusion: new(""), StartedAt: &Timestamp{}, CompletedAt: &Timestamp{}, Output: &CheckRunOutput{}, - Name: Ptr(""), + Name: new(""), CheckSuite: &CheckSuite{}, App: &App{}, } @@ -244,23 +244,23 @@ func TestCheckRun_String(t *testing.T) { func TestCheckSuite_String(t *testing.T) { t.Parallel() v := CheckSuite{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - HeadBranch: Ptr(""), - HeadSHA: Ptr(""), - URL: Ptr(""), - BeforeSHA: Ptr(""), - AfterSHA: Ptr(""), - Status: Ptr(""), - Conclusion: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), + HeadBranch: new(""), + HeadSHA: new(""), + URL: new(""), + BeforeSHA: new(""), + AfterSHA: new(""), + Status: new(""), + Conclusion: new(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, App: &App{}, Repository: &Repository{}, HeadCommit: &Commit{}, - LatestCheckRunsCount: Ptr(int64(0)), - Rerequestable: Ptr(false), - RunsRerequestable: Ptr(false), + LatestCheckRunsCount: new(int64(0)), + Rerequestable: new(false), + RunsRerequestable: new(false), } want := `github.CheckSuite{ID:0, NodeID:"", HeadBranch:"", HeadSHA:"", URL:"", BeforeSHA:"", AfterSHA:"", Status:"", Conclusion:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, App:github.App{}, Repository:github.Repository{}, HeadCommit:github.Commit{}, LatestCheckRunsCount:0, Rerequestable:false, RunsRerequestable:false}` if got := v.String(); got != want { @@ -271,11 +271,11 @@ func TestCheckSuite_String(t *testing.T) { func TestClassroom_String(t *testing.T) { t.Parallel() v := Classroom{ - ID: Ptr(int64(0)), - Name: Ptr(""), - Archived: Ptr(false), + ID: new(int64(0)), + Name: new(""), + Archived: new(false), Organization: &Organization{}, - URL: Ptr(""), + URL: new(""), } want := `github.Classroom{ID:0, Name:"", Archived:false, Organization:github.Organization{}, URL:""}` if got := v.String(); got != want { @@ -286,22 +286,22 @@ func TestClassroom_String(t *testing.T) { func TestClassroomAssignment_String(t *testing.T) { t.Parallel() v := ClassroomAssignment{ - ID: Ptr(int64(0)), - PublicRepo: Ptr(false), - Title: Ptr(""), - Type: Ptr(""), - InviteLink: Ptr(""), - InvitationsEnabled: Ptr(false), - Slug: Ptr(""), - StudentsAreRepoAdmins: Ptr(false), - FeedbackPullRequestsEnabled: Ptr(false), - MaxTeams: Ptr(0), - MaxMembers: Ptr(0), - Editor: Ptr(""), - Accepted: Ptr(0), - Submitted: Ptr(0), - Passing: Ptr(0), - Language: Ptr(""), + ID: new(int64(0)), + PublicRepo: new(false), + Title: new(""), + Type: new(""), + InviteLink: new(""), + InvitationsEnabled: new(false), + Slug: new(""), + StudentsAreRepoAdmins: new(false), + FeedbackPullRequestsEnabled: new(false), + MaxTeams: new(0), + MaxMembers: new(0), + Editor: new(""), + Accepted: new(0), + Submitted: new(0), + Passing: new(0), + Language: new(""), Deadline: &Timestamp{}, StarterCodeRepository: &Repository{}, Classroom: &Classroom{}, @@ -315,10 +315,10 @@ func TestClassroomAssignment_String(t *testing.T) { func TestClassroomUser_String(t *testing.T) { t.Parallel() v := ClassroomUser{ - ID: Ptr(int64(0)), - Login: Ptr(""), - AvatarURL: Ptr(""), - HTMLURL: Ptr(""), + ID: new(int64(0)), + Login: new(""), + AvatarURL: new(""), + HTMLURL: new(""), } want := `github.ClassroomUser{ID:0, Login:"", AvatarURL:"", HTMLURL:""}` if got := v.String(); got != want { @@ -329,10 +329,10 @@ func TestClassroomUser_String(t *testing.T) { func TestCodeOfConduct_String(t *testing.T) { t.Parallel() v := CodeOfConduct{ - Name: Ptr(""), - Key: Ptr(""), - URL: Ptr(""), - Body: Ptr(""), + Name: new(""), + Key: new(""), + URL: new(""), + Body: new(""), } want := `github.CodeOfConduct{Name:"", Key:"", URL:"", Body:""}` if got := v.String(); got != want { @@ -343,10 +343,10 @@ func TestCodeOfConduct_String(t *testing.T) { func TestCodeResult_String(t *testing.T) { t.Parallel() v := CodeResult{ - Name: Ptr(""), - Path: Ptr(""), - SHA: Ptr(""), - HTMLURL: Ptr(""), + Name: new(""), + Path: new(""), + SHA: new(""), + HTMLURL: new(""), Repository: &Repository{}, } want := `github.CodeResult{Name:"", Path:"", SHA:"", HTMLURL:"", Repository:github.Repository{}}` @@ -358,7 +358,7 @@ func TestCodeResult_String(t *testing.T) { func TestCodeSecurity_String(t *testing.T) { t.Parallel() v := CodeSecurity{ - Status: Ptr(""), + Status: new(""), } want := `github.CodeSecurity{Status:""}` if got := v.String(); got != want { @@ -369,12 +369,12 @@ func TestCodeSecurity_String(t *testing.T) { func TestCombinedStatus_String(t *testing.T) { t.Parallel() v := CombinedStatus{ - State: Ptr(""), - Name: Ptr(""), - SHA: Ptr(""), - TotalCount: Ptr(0), - CommitURL: Ptr(""), - RepositoryURL: Ptr(""), + State: new(""), + Name: new(""), + SHA: new(""), + TotalCount: new(0), + CommitURL: new(""), + RepositoryURL: new(""), } want := `github.CombinedStatus{State:"", Name:"", SHA:"", TotalCount:0, CommitURL:"", RepositoryURL:""}` if got := v.String(); got != want { @@ -385,10 +385,10 @@ func TestCombinedStatus_String(t *testing.T) { func TestCommentStats_String(t *testing.T) { t.Parallel() v := CommentStats{ - TotalCommitComments: Ptr(0), - TotalGistComments: Ptr(0), - TotalIssueComments: Ptr(0), - TotalPullRequestComments: Ptr(0), + TotalCommitComments: new(0), + TotalGistComments: new(0), + TotalIssueComments: new(0), + TotalPullRequestComments: new(0), } want := `github.CommentStats{TotalCommitComments:0, TotalGistComments:0, TotalIssueComments:0, TotalPullRequestComments:0}` if got := v.String(); got != want { @@ -399,16 +399,16 @@ func TestCommentStats_String(t *testing.T) { func TestCommit_String(t *testing.T) { t.Parallel() v := Commit{ - SHA: Ptr(""), + SHA: new(""), Author: &CommitAuthor{}, Committer: &CommitAuthor{}, - Message: Ptr(""), + Message: new(""), Tree: &Tree{}, - HTMLURL: Ptr(""), - URL: Ptr(""), + HTMLURL: new(""), + URL: new(""), Verification: &SignatureVerification{}, - NodeID: Ptr(""), - CommentCount: Ptr(0), + NodeID: new(""), + CommentCount: new(0), } want := `github.Commit{SHA:"", Author:github.CommitAuthor{}, Committer:github.CommitAuthor{}, Message:"", Tree:github.Tree{}, HTMLURL:"", URL:"", Verification:github.SignatureVerification{}, NodeID:"", CommentCount:0}` if got := v.String(); got != want { @@ -420,9 +420,9 @@ func TestCommitAuthor_String(t *testing.T) { t.Parallel() v := CommitAuthor{ Date: &Timestamp{}, - Name: Ptr(""), - Email: Ptr(""), - Login: Ptr(""), + Name: new(""), + Email: new(""), + Login: new(""), } want := `github.CommitAuthor{Date:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Name:"", Email:"", Login:""}` if got := v.String(); got != want { @@ -433,17 +433,17 @@ func TestCommitAuthor_String(t *testing.T) { func TestCommitFile_String(t *testing.T) { t.Parallel() v := CommitFile{ - SHA: Ptr(""), - Filename: Ptr(""), - Additions: Ptr(0), - Deletions: Ptr(0), - Changes: Ptr(0), - Status: Ptr(""), - Patch: Ptr(""), - BlobURL: Ptr(""), - RawURL: Ptr(""), - ContentsURL: Ptr(""), - PreviousFilename: Ptr(""), + SHA: new(""), + Filename: new(""), + Additions: new(0), + Deletions: new(0), + Changes: new(0), + Status: new(""), + Patch: new(""), + BlobURL: new(""), + RawURL: new(""), + ContentsURL: new(""), + PreviousFilename: new(""), } want := `github.CommitFile{SHA:"", Filename:"", Additions:0, Deletions:0, Changes:0, Status:"", Patch:"", BlobURL:"", RawURL:"", ContentsURL:"", PreviousFilename:""}` if got := v.String(); got != want { @@ -454,9 +454,9 @@ func TestCommitFile_String(t *testing.T) { func TestCommitStats_String(t *testing.T) { t.Parallel() v := CommitStats{ - Additions: Ptr(0), - Deletions: Ptr(0), - Total: Ptr(0), + Additions: new(0), + Deletions: new(0), + Total: new(0), } want := `github.CommitStats{Additions:0, Deletions:0, Total:0}` if got := v.String(); got != want { @@ -469,15 +469,15 @@ func TestCommitsComparison_String(t *testing.T) { v := CommitsComparison{ BaseCommit: &RepositoryCommit{}, MergeBaseCommit: &RepositoryCommit{}, - Status: Ptr(""), - AheadBy: Ptr(0), - BehindBy: Ptr(0), - TotalCommits: Ptr(0), - HTMLURL: Ptr(""), - PermalinkURL: Ptr(""), - DiffURL: Ptr(""), - PatchURL: Ptr(""), - URL: Ptr(""), + Status: new(""), + AheadBy: new(0), + BehindBy: new(0), + TotalCommits: new(0), + HTMLURL: new(""), + PermalinkURL: new(""), + DiffURL: new(""), + PatchURL: new(""), + URL: new(""), } want := `github.CommitsComparison{BaseCommit:github.RepositoryCommit{}, MergeBaseCommit:github.RepositoryCommit{}, Status:"", AheadBy:0, BehindBy:0, TotalCommits:0, HTMLURL:"", PermalinkURL:"", DiffURL:"", PatchURL:"", URL:""}` if got := v.String(); got != want { @@ -500,7 +500,7 @@ func TestContributorStats_String(t *testing.T) { t.Parallel() v := ContributorStats{ Author: &Contributor{}, - Total: Ptr(0), + Total: new(0), } want := `github.ContributorStats{Author:github.Contributor{}, Total:0}` if got := v.String(); got != want { @@ -512,14 +512,14 @@ func TestCreateTeamRequest_String(t *testing.T) { t.Parallel() v := CreateTeamRequest{ Name: "", - Description: Ptr(""), + Description: new(""), Maintainers: []string{""}, RepoNames: []string{""}, - Privacy: Ptr(""), - NotificationSetting: Ptr(""), - Permission: Ptr(""), - ParentTeamID: Ptr(int64(0)), - ParentTeamSlug: Ptr(""), + Privacy: new(""), + NotificationSetting: new(""), + Permission: new(""), + ParentTeamID: new(int64(0)), + ParentTeamSlug: new(""), } want := `github.CreateTeamRequest{Name:"", Description:"", Maintainers:[""], RepoNames:[""], Privacy:"", NotificationSetting:"", Permission:"", ParentTeamID:0, ParentTeamSlug:""}` if got := v.String(); got != want { @@ -530,7 +530,7 @@ func TestCreateTeamRequest_String(t *testing.T) { func TestDependabotSecurityUpdates_String(t *testing.T) { t.Parallel() v := DependabotSecurityUpdates{ - Status: Ptr(""), + Status: new(""), } want := `github.DependabotSecurityUpdates{Status:""}` if got := v.String(); got != want { @@ -542,17 +542,17 @@ func TestDiscussionComment_String(t *testing.T) { t.Parallel() v := DiscussionComment{ Author: &User{}, - Body: Ptr(""), - BodyHTML: Ptr(""), - BodyVersion: Ptr(""), + Body: new(""), + BodyHTML: new(""), + BodyVersion: new(""), CreatedAt: &Timestamp{}, LastEditedAt: &Timestamp{}, - DiscussionURL: Ptr(""), - HTMLURL: Ptr(""), - NodeID: Ptr(""), - Number: Ptr(0), + DiscussionURL: new(""), + HTMLURL: new(""), + NodeID: new(""), + Number: new(0), UpdatedAt: &Timestamp{}, - URL: Ptr(""), + URL: new(""), Reactions: &Reactions{}, } want := `github.DiscussionComment{Author:github.User{}, Body:"", BodyHTML:"", BodyVersion:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, LastEditedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, DiscussionURL:"", HTMLURL:"", NodeID:"", Number:0, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, URL:"", Reactions:github.Reactions{}}` @@ -564,13 +564,13 @@ func TestDiscussionComment_String(t *testing.T) { func TestDraftReviewComment_String(t *testing.T) { t.Parallel() v := DraftReviewComment{ - Path: Ptr(""), - Position: Ptr(0), - Body: Ptr(""), - StartSide: Ptr(""), - Side: Ptr(""), - StartLine: Ptr(0), - Line: Ptr(0), + Path: new(""), + Position: new(0), + Body: new(""), + StartSide: new(""), + Side: new(""), + StartLine: new(0), + Line: new(0), } want := `github.DraftReviewComment{Path:"", Position:0, Body:"", StartSide:"", Side:"", StartLine:0, Line:0}` if got := v.String(); got != want { @@ -581,14 +581,14 @@ func TestDraftReviewComment_String(t *testing.T) { func TestEnterprise_String(t *testing.T) { t.Parallel() v := Enterprise{ - ID: Ptr(0), - Slug: Ptr(""), - Name: Ptr(""), - NodeID: Ptr(""), - AvatarURL: Ptr(""), - Description: Ptr(""), - WebsiteURL: Ptr(""), - HTMLURL: Ptr(""), + ID: new(0), + Slug: new(""), + Name: new(""), + NodeID: new(""), + AvatarURL: new(""), + Description: new(""), + WebsiteURL: new(""), + HTMLURL: new(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, } @@ -601,13 +601,13 @@ func TestEnterprise_String(t *testing.T) { func TestEnterpriseBudget_String(t *testing.T) { t.Parallel() v := EnterpriseBudget{ - ID: Ptr(""), - BudgetType: Ptr(""), - BudgetProductSKU: Ptr(""), - BudgetScope: Ptr(""), - BudgetEntityName: Ptr(""), - BudgetAmount: Ptr(0), - PreventFurtherUsage: Ptr(false), + ID: new(""), + BudgetType: new(""), + BudgetProductSKU: new(""), + BudgetScope: new(""), + BudgetEntityName: new(""), + BudgetAmount: new(0), + PreventFurtherUsage: new(false), BudgetAlerting: &EnterpriseBudgetAlerting{}, } want := `github.EnterpriseBudget{ID:"", BudgetType:"", BudgetProductSKU:"", BudgetScope:"", BudgetEntityName:"", BudgetAmount:0, PreventFurtherUsage:false, BudgetAlerting:github.EnterpriseBudgetAlerting{}}` @@ -619,13 +619,13 @@ func TestEnterpriseBudget_String(t *testing.T) { func TestEvent_String(t *testing.T) { t.Parallel() v := Event{ - Type: Ptr(""), - Public: Ptr(false), + Type: new(""), + Public: new(false), Repo: &Repository{}, Actor: &User{}, Org: &Organization{}, CreatedAt: &Timestamp{}, - ID: Ptr(""), + ID: new(""), } want := `github.Event{Type:"", Public:false, Repo:github.Repository{}, Actor:github.User{}, Org:github.Organization{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ID:""}` if got := v.String(); got != want { @@ -636,15 +636,15 @@ func TestEvent_String(t *testing.T) { func TestGPGKey_String(t *testing.T) { t.Parallel() v := GPGKey{ - ID: Ptr(int64(0)), - PrimaryKeyID: Ptr(int64(0)), - KeyID: Ptr(""), - RawKey: Ptr(""), - PublicKey: Ptr(""), - CanSign: Ptr(false), - CanEncryptComms: Ptr(false), - CanEncryptStorage: Ptr(false), - CanCertify: Ptr(false), + ID: new(int64(0)), + PrimaryKeyID: new(int64(0)), + KeyID: new(""), + RawKey: new(""), + PublicKey: new(""), + CanSign: new(false), + CanEncryptComms: new(false), + CanEncryptStorage: new(false), + CanCertify: new(false), CreatedAt: &Timestamp{}, ExpiresAt: &Timestamp{}, } @@ -657,17 +657,17 @@ func TestGPGKey_String(t *testing.T) { func TestGist_String(t *testing.T) { t.Parallel() v := Gist{ - ID: Ptr(""), - Description: Ptr(""), - Public: Ptr(false), + ID: new(""), + Description: new(""), + Public: new(false), Owner: &User{}, - Comments: Ptr(0), - HTMLURL: Ptr(""), - GitPullURL: Ptr(""), - GitPushURL: Ptr(""), + Comments: new(0), + HTMLURL: new(""), + GitPullURL: new(""), + GitPushURL: new(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - NodeID: Ptr(""), + NodeID: new(""), } want := `github.Gist{ID:"", Description:"", Public:false, Owner:github.User{}, Comments:0, HTMLURL:"", GitPullURL:"", GitPushURL:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, NodeID:""}` if got := v.String(); got != want { @@ -678,9 +678,9 @@ func TestGist_String(t *testing.T) { func TestGistComment_String(t *testing.T) { t.Parallel() v := GistComment{ - ID: Ptr(int64(0)), - URL: Ptr(""), - Body: Ptr(""), + ID: new(int64(0)), + URL: new(""), + Body: new(""), User: &User{}, CreatedAt: &Timestamp{}, } @@ -693,12 +693,12 @@ func TestGistComment_String(t *testing.T) { func TestGistCommit_String(t *testing.T) { t.Parallel() v := GistCommit{ - URL: Ptr(""), - Version: Ptr(""), + URL: new(""), + Version: new(""), User: &User{}, ChangeStatus: &CommitStats{}, CommittedAt: &Timestamp{}, - NodeID: Ptr(""), + NodeID: new(""), } want := `github.GistCommit{URL:"", Version:"", User:github.User{}, ChangeStatus:github.CommitStats{}, CommittedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, NodeID:""}` if got := v.String(); got != want { @@ -709,12 +709,12 @@ func TestGistCommit_String(t *testing.T) { func TestGistFile_String(t *testing.T) { t.Parallel() v := GistFile{ - Size: Ptr(0), - Filename: Ptr(""), - Language: Ptr(""), - Type: Ptr(""), - RawURL: Ptr(""), - Content: Ptr(""), + Size: new(0), + Filename: new(""), + Language: new(""), + Type: new(""), + RawURL: new(""), + Content: new(""), } want := `github.GistFile{Size:0, Filename:"", Language:"", Type:"", RawURL:"", Content:""}` if got := v.String(); got != want { @@ -725,12 +725,12 @@ func TestGistFile_String(t *testing.T) { func TestGistFork_String(t *testing.T) { t.Parallel() v := GistFork{ - URL: Ptr(""), + URL: new(""), User: &User{}, - ID: Ptr(""), + ID: new(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - NodeID: Ptr(""), + NodeID: new(""), } want := `github.GistFork{URL:"", User:github.User{}, ID:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, NodeID:""}` if got := v.String(); got != want { @@ -741,9 +741,9 @@ func TestGistFork_String(t *testing.T) { func TestGistStats_String(t *testing.T) { t.Parallel() v := GistStats{ - TotalGists: Ptr(0), - PrivateGists: Ptr(0), - PublicGists: Ptr(0), + TotalGists: new(0), + PrivateGists: new(0), + PublicGists: new(0), } want := `github.GistStats{TotalGists:0, PrivateGists:0, PublicGists:0}` if got := v.String(); got != want { @@ -754,9 +754,9 @@ func TestGistStats_String(t *testing.T) { func TestGitObject_String(t *testing.T) { t.Parallel() v := GitObject{ - Type: Ptr(""), - SHA: Ptr(""), - URL: Ptr(""), + Type: new(""), + SHA: new(""), + URL: new(""), } want := `github.GitObject{Type:"", SHA:"", URL:""}` if got := v.String(); got != want { @@ -767,8 +767,8 @@ func TestGitObject_String(t *testing.T) { func TestGitignore_String(t *testing.T) { t.Parallel() v := Gitignore{ - Name: Ptr(""), - Source: Ptr(""), + Name: new(""), + Source: new(""), } want := `github.Gitignore{Name:"", Source:""}` if got := v.String(); got != want { @@ -779,8 +779,8 @@ func TestGitignore_String(t *testing.T) { func TestGrant_String(t *testing.T) { t.Parallel() v := Grant{ - ID: Ptr(int64(0)), - URL: Ptr(""), + ID: new(int64(0)), + URL: new(""), App: &AuthorizationApp{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, @@ -795,13 +795,13 @@ func TestGrant_String(t *testing.T) { func TestHeadCommit_String(t *testing.T) { t.Parallel() v := HeadCommit{ - Message: Ptr(""), + Message: new(""), Author: &CommitAuthor{}, - URL: Ptr(""), - Distinct: Ptr(false), - SHA: Ptr(""), - ID: Ptr(""), - TreeID: Ptr(""), + URL: new(""), + Distinct: new(false), + SHA: new(""), + ID: new(""), + TreeID: new(""), Timestamp: &Timestamp{}, Committer: &CommitAuthor{}, Added: []string{""}, @@ -819,15 +819,15 @@ func TestHook_String(t *testing.T) { v := Hook{ CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - URL: Ptr(""), - ID: Ptr(int64(0)), - Type: Ptr(""), - Name: Ptr(""), - TestURL: Ptr(""), - PingURL: Ptr(""), + URL: new(""), + ID: new(int64(0)), + Type: new(""), + Name: new(""), + TestURL: new(""), + PingURL: new(""), Config: &HookConfig{}, Events: []string{""}, - Active: Ptr(false), + Active: new(false), } want := `github.Hook{CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, URL:"", ID:0, Type:"", Name:"", TestURL:"", PingURL:"", Config:github.HookConfig{}, Events:[""], Active:false}` if got := v.String(); got != want { @@ -838,17 +838,17 @@ func TestHook_String(t *testing.T) { func TestHookDelivery_String(t *testing.T) { t.Parallel() v := HookDelivery{ - ID: Ptr(int64(0)), - GUID: Ptr(""), + ID: new(int64(0)), + GUID: new(""), DeliveredAt: &Timestamp{}, - Redelivery: Ptr(false), - Duration: Ptr(0.0), - Status: Ptr(""), - StatusCode: Ptr(0), - Event: Ptr(""), - Action: Ptr(""), - InstallationID: Ptr(int64(0)), - RepositoryID: Ptr(int64(0)), + Redelivery: new(false), + Duration: new(0.0), + Status: new(""), + StatusCode: new(0), + Event: new(""), + Action: new(""), + InstallationID: new(int64(0)), + RepositoryID: new(int64(0)), Request: &HookRequest{}, Response: &HookResponse{}, } @@ -861,9 +861,9 @@ func TestHookDelivery_String(t *testing.T) { func TestHookStats_String(t *testing.T) { t.Parallel() v := HookStats{ - TotalHooks: Ptr(0), - ActiveHooks: Ptr(0), - InactiveHooks: Ptr(0), + TotalHooks: new(0), + ActiveHooks: new(0), + InactiveHooks: new(0), } want := `github.HookStats{TotalHooks:0, ActiveHooks:0, InactiveHooks:0}` if got := v.String(); got != want { @@ -874,28 +874,28 @@ func TestHookStats_String(t *testing.T) { func TestImport_String(t *testing.T) { t.Parallel() v := Import{ - VCSURL: Ptr(""), - VCS: Ptr(""), - VCSUsername: Ptr(""), - VCSPassword: Ptr(""), - TFVCProject: Ptr(""), - UseLFS: Ptr(""), - HasLargeFiles: Ptr(false), - LargeFilesSize: Ptr(0), - LargeFilesCount: Ptr(0), - Status: Ptr(""), - CommitCount: Ptr(0), - StatusText: Ptr(""), - AuthorsCount: Ptr(0), - Percent: Ptr(0), - PushPercent: Ptr(0), - URL: Ptr(""), - HTMLURL: Ptr(""), - AuthorsURL: Ptr(""), - RepositoryURL: Ptr(""), - Message: Ptr(""), - FailedStep: Ptr(""), - HumanName: Ptr(""), + VCSURL: new(""), + VCS: new(""), + VCSUsername: new(""), + VCSPassword: new(""), + TFVCProject: new(""), + UseLFS: new(""), + HasLargeFiles: new(false), + LargeFilesSize: new(0), + LargeFilesCount: new(0), + Status: new(""), + CommitCount: new(0), + StatusText: new(""), + AuthorsCount: new(0), + Percent: new(0), + PushPercent: new(0), + URL: new(""), + HTMLURL: new(""), + AuthorsURL: new(""), + RepositoryURL: new(""), + Message: new(""), + FailedStep: new(""), + HumanName: new(""), } want := `github.Import{VCSURL:"", VCS:"", VCSUsername:"", VCSPassword:"", TFVCProject:"", UseLFS:"", HasLargeFiles:false, LargeFilesSize:0, LargeFilesCount:0, Status:"", CommitCount:0, StatusText:"", AuthorsCount:0, Percent:0, PushPercent:0, URL:"", HTMLURL:"", AuthorsURL:"", RepositoryURL:"", Message:"", FailedStep:"", HumanName:""}` if got := v.String(); got != want { @@ -906,25 +906,25 @@ func TestImport_String(t *testing.T) { func TestInstallation_String(t *testing.T) { t.Parallel() v := Installation{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - ClientID: Ptr(""), - AppID: Ptr(int64(0)), - AppSlug: Ptr(""), - TargetID: Ptr(int64(0)), + ID: new(int64(0)), + NodeID: new(""), + ClientID: new(""), + AppID: new(int64(0)), + AppSlug: new(""), + TargetID: new(int64(0)), Account: &User{}, - AccessTokensURL: Ptr(""), - RepositoriesURL: Ptr(""), - HTMLURL: Ptr(""), - TargetType: Ptr(""), - SingleFileName: Ptr(""), - RepositorySelection: Ptr(""), + AccessTokensURL: new(""), + RepositoriesURL: new(""), + HTMLURL: new(""), + TargetType: new(""), + SingleFileName: new(""), + RepositorySelection: new(""), Events: []string{""}, SingleFilePaths: []string{""}, Permissions: &InstallationPermissions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - HasMultipleSingleFiles: Ptr(false), + HasMultipleSingleFiles: new(false), SuspendedBy: &User{}, SuspendedAt: &Timestamp{}, } @@ -937,17 +937,17 @@ func TestInstallation_String(t *testing.T) { func TestInvitation_String(t *testing.T) { t.Parallel() v := Invitation{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - Login: Ptr(""), - Email: Ptr(""), - Role: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), + Login: new(""), + Email: new(""), + Role: new(""), CreatedAt: &Timestamp{}, Inviter: &User{}, - TeamCount: Ptr(0), - InvitationTeamURL: Ptr(""), + TeamCount: new(0), + InvitationTeamURL: new(""), FailedAt: &Timestamp{}, - FailedReason: Ptr(""), + FailedReason: new(""), } want := `github.Invitation{ID:0, NodeID:"", Login:"", Email:"", Role:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Inviter:github.User{}, TeamCount:0, InvitationTeamURL:"", FailedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, FailedReason:""}` if got := v.String(); got != want { @@ -958,40 +958,40 @@ func TestInvitation_String(t *testing.T) { func TestIssue_String(t *testing.T) { t.Parallel() v := Issue{ - ID: Ptr(int64(0)), - Number: Ptr(0), - State: Ptr(""), - StateReason: Ptr(""), - Locked: Ptr(false), - Title: Ptr(""), - Body: Ptr(""), - AuthorAssociation: Ptr(""), + ID: new(int64(0)), + Number: new(0), + State: new(""), + StateReason: new(""), + Locked: new(false), + Title: new(""), + Body: new(""), + AuthorAssociation: new(""), User: &User{}, Assignee: &User{}, - Comments: Ptr(0), + Comments: new(0), ClosedAt: &Timestamp{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, ClosedBy: &User{}, - URL: Ptr(""), - HTMLURL: Ptr(""), - CommentsURL: Ptr(""), - EventsURL: Ptr(""), - LabelsURL: Ptr(""), - RepositoryURL: Ptr(""), - ParentIssueURL: Ptr(""), + URL: new(""), + HTMLURL: new(""), + CommentsURL: new(""), + EventsURL: new(""), + LabelsURL: new(""), + RepositoryURL: new(""), + ParentIssueURL: new(""), Milestone: &Milestone{}, PullRequestLinks: &PullRequestLinks{}, Repository: &Repository{}, Reactions: &Reactions{}, - NodeID: Ptr(""), - Draft: Ptr(false), + NodeID: new(""), + Draft: new(false), Type: &IssueType{}, PinnedComment: &IssueComment{}, PerformedViaGithubApp: &App{}, IssueDependenciesSummary: &IssueDependenciesSummary{}, SubIssuesSummary: &SubIssuesSummary{}, - ActiveLockReason: Ptr(""), + ActiveLockReason: new(""), } want := `github.Issue{ID:0, Number:0, State:"", StateReason:"", Locked:false, Title:"", Body:"", AuthorAssociation:"", User:github.User{}, Assignee:github.User{}, Comments:0, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedBy:github.User{}, URL:"", HTMLURL:"", CommentsURL:"", EventsURL:"", LabelsURL:"", RepositoryURL:"", ParentIssueURL:"", Milestone:github.Milestone{}, PullRequestLinks:github.PullRequestLinks{}, Repository:github.Repository{}, Reactions:github.Reactions{}, NodeID:"", Draft:false, Type:github.IssueType{}, PinnedComment:github.IssueComment{}, PerformedViaGithubApp:github.App{}, IssueDependenciesSummary:github.IssueDependenciesSummary{}, SubIssuesSummary:github.SubIssuesSummary{}, ActiveLockReason:""}` if got := v.String(); got != want { @@ -1002,20 +1002,20 @@ func TestIssue_String(t *testing.T) { func TestIssueComment_String(t *testing.T) { t.Parallel() v := IssueComment{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - Body: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), + Body: new(""), User: &User{}, Reactions: &Reactions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - AuthorAssociation: Ptr(""), + AuthorAssociation: new(""), PerformedViaGithubApp: &App{}, Pin: &PinnedIssueComment{}, Minimized: &MinimizedIssueComment{}, - URL: Ptr(""), - HTMLURL: Ptr(""), - IssueURL: Ptr(""), + URL: new(""), + HTMLURL: new(""), + IssueURL: new(""), } want := `github.IssueComment{ID:0, NodeID:"", Body:"", User:github.User{}, Reactions:github.Reactions{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, AuthorAssociation:"", PerformedViaGithubApp:github.App{}, Pin:github.PinnedIssueComment{}, Minimized:github.MinimizedIssueComment{}, URL:"", HTMLURL:"", IssueURL:""}` if got := v.String(); got != want { @@ -1026,9 +1026,9 @@ func TestIssueComment_String(t *testing.T) { func TestIssueStats_String(t *testing.T) { t.Parallel() v := IssueStats{ - TotalIssues: Ptr(0), - OpenIssues: Ptr(0), - ClosedIssues: Ptr(0), + TotalIssues: new(0), + OpenIssues: new(0), + ClosedIssues: new(0), } want := `github.IssueStats{TotalIssues:0, OpenIssues:0, ClosedIssues:0}` if got := v.String(); got != want { @@ -1039,14 +1039,14 @@ func TestIssueStats_String(t *testing.T) { func TestKey_String(t *testing.T) { t.Parallel() v := Key{ - ID: Ptr(int64(0)), - Key: Ptr(""), - URL: Ptr(""), - Title: Ptr(""), - ReadOnly: Ptr(false), - Verified: Ptr(false), + ID: new(int64(0)), + Key: new(""), + URL: new(""), + Title: new(""), + ReadOnly: new(false), + Verified: new(false), CreatedAt: &Timestamp{}, - AddedBy: Ptr(""), + AddedBy: new(""), LastUsed: &Timestamp{}, } want := `github.Key{ID:0, Key:"", URL:"", Title:"", ReadOnly:false, Verified:false, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, AddedBy:"", LastUsed:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` @@ -1062,7 +1062,7 @@ func TestLabel_String(t *testing.T) { URL: "", Name: "", Color: "", - Description: Ptr(""), + Description: new(""), Default: false, NodeID: "", } @@ -1075,13 +1075,13 @@ func TestLabel_String(t *testing.T) { func TestLabelResult_String(t *testing.T) { t.Parallel() v := LabelResult{ - ID: Ptr(int64(0)), - URL: Ptr(""), - Name: Ptr(""), - Color: Ptr(""), - Default: Ptr(false), - Description: Ptr(""), - Score: Ptr(0.0), + ID: new(int64(0)), + URL: new(""), + Name: new(""), + Color: new(""), + Default: new(false), + Description: new(""), + Score: new(0.0), } want := `github.LabelResult{ID:0, URL:"", Name:"", Color:"", Default:false, Description:"", Score:0}` if got := v.String(); got != want { @@ -1092,10 +1092,10 @@ func TestLabelResult_String(t *testing.T) { func TestLargeFile_String(t *testing.T) { t.Parallel() v := LargeFile{ - RefName: Ptr(""), - Path: Ptr(""), - OID: Ptr(""), - Size: Ptr(0), + RefName: new(""), + Path: new(""), + OID: new(""), + Size: new(0), } want := `github.LargeFile{RefName:"", Path:"", OID:"", Size:0}` if got := v.String(); got != want { @@ -1106,15 +1106,15 @@ func TestLargeFile_String(t *testing.T) { func TestLicense_String(t *testing.T) { t.Parallel() v := License{ - Key: Ptr(""), - Name: Ptr(""), - URL: Ptr(""), - SPDXID: Ptr(""), - HTMLURL: Ptr(""), - Featured: Ptr(false), - Description: Ptr(""), - Implementation: Ptr(""), - Body: Ptr(""), + Key: new(""), + Name: new(""), + URL: new(""), + SPDXID: new(""), + HTMLURL: new(""), + Featured: new(false), + Description: new(""), + Implementation: new(""), + Body: new(""), } want := `github.License{Key:"", Name:"", URL:"", SPDXID:"", HTMLURL:"", Featured:false, Description:"", Implementation:"", Body:""}` if got := v.String(); got != want { @@ -1125,10 +1125,10 @@ func TestLicense_String(t *testing.T) { func TestMembership_String(t *testing.T) { t.Parallel() v := Membership{ - URL: Ptr(""), - State: Ptr(""), - Role: Ptr(""), - OrganizationURL: Ptr(""), + URL: new(""), + State: new(""), + Role: new(""), + OrganizationURL: new(""), Organization: &Organization{}, User: &User{}, } @@ -1141,14 +1141,14 @@ func TestMembership_String(t *testing.T) { func TestMigration_String(t *testing.T) { t.Parallel() v := Migration{ - ID: Ptr(int64(0)), - GUID: Ptr(""), - State: Ptr(""), - LockRepositories: Ptr(false), - ExcludeAttachments: Ptr(false), - URL: Ptr(""), - CreatedAt: Ptr(""), - UpdatedAt: Ptr(""), + ID: new(int64(0)), + GUID: new(""), + State: new(""), + LockRepositories: new(false), + ExcludeAttachments: new(false), + URL: new(""), + CreatedAt: new(""), + UpdatedAt: new(""), } want := `github.Migration{ID:0, GUID:"", State:"", LockRepositories:false, ExcludeAttachments:false, URL:"", CreatedAt:"", UpdatedAt:""}` if got := v.String(); got != want { @@ -1159,22 +1159,22 @@ func TestMigration_String(t *testing.T) { func TestMilestone_String(t *testing.T) { t.Parallel() v := Milestone{ - URL: Ptr(""), - HTMLURL: Ptr(""), - LabelsURL: Ptr(""), - ID: Ptr(int64(0)), - Number: Ptr(0), - State: Ptr(""), - Title: Ptr(""), - Description: Ptr(""), + URL: new(""), + HTMLURL: new(""), + LabelsURL: new(""), + ID: new(int64(0)), + Number: new(0), + State: new(""), + Title: new(""), + Description: new(""), Creator: &User{}, - OpenIssues: Ptr(0), - ClosedIssues: Ptr(0), + OpenIssues: new(0), + ClosedIssues: new(0), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, ClosedAt: &Timestamp{}, DueOn: &Timestamp{}, - NodeID: Ptr(""), + NodeID: new(""), } want := `github.Milestone{URL:"", HTMLURL:"", LabelsURL:"", ID:0, Number:0, State:"", Title:"", Description:"", Creator:github.User{}, OpenIssues:0, ClosedIssues:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, DueOn:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, NodeID:""}` if got := v.String(); got != want { @@ -1185,9 +1185,9 @@ func TestMilestone_String(t *testing.T) { func TestMilestoneStats_String(t *testing.T) { t.Parallel() v := MilestoneStats{ - TotalMilestones: Ptr(0), - OpenMilestones: Ptr(0), - ClosedMilestones: Ptr(0), + TotalMilestones: new(0), + OpenMilestones: new(0), + ClosedMilestones: new(0), } want := `github.MilestoneStats{TotalMilestones:0, OpenMilestones:0, ClosedMilestones:0}` if got := v.String(); got != want { @@ -1198,9 +1198,9 @@ func TestMilestoneStats_String(t *testing.T) { func TestOAuthAPP_String(t *testing.T) { t.Parallel() v := OAuthAPP{ - URL: Ptr(""), - Name: Ptr(""), - ClientID: Ptr(""), + URL: new(""), + Name: new(""), + ClientID: new(""), } want := `github.OAuthAPP{URL:"", Name:"", ClientID:""}` if got := v.String(); got != want { @@ -1211,10 +1211,10 @@ func TestOAuthAPP_String(t *testing.T) { func TestOrgStats_String(t *testing.T) { t.Parallel() v := OrgStats{ - TotalOrgs: Ptr(0), - DisabledOrgs: Ptr(0), - TotalTeams: Ptr(0), - TotalTeamMembers: Ptr(0), + TotalOrgs: new(0), + DisabledOrgs: new(0), + TotalTeams: new(0), + TotalTeamMembers: new(0), } want := `github.OrgStats{TotalOrgs:0, DisabledOrgs:0, TotalTeams:0, TotalTeamMembers:0}` if got := v.String(); got != want { @@ -1225,75 +1225,75 @@ func TestOrgStats_String(t *testing.T) { func TestOrganization_String(t *testing.T) { t.Parallel() v := Organization{ - Login: Ptr(""), - ID: Ptr(int64(0)), - NodeID: Ptr(""), - AvatarURL: Ptr(""), - HTMLURL: Ptr(""), - Name: Ptr(""), - Company: Ptr(""), - Blog: Ptr(""), - Location: Ptr(""), - Email: Ptr(""), - TwitterUsername: Ptr(""), - Description: Ptr(""), - PublicRepos: Ptr(0), - PublicGists: Ptr(0), - Followers: Ptr(0), - Following: Ptr(0), + Login: new(""), + ID: new(int64(0)), + NodeID: new(""), + AvatarURL: new(""), + HTMLURL: new(""), + Name: new(""), + Company: new(""), + Blog: new(""), + Location: new(""), + Email: new(""), + TwitterUsername: new(""), + Description: new(""), + PublicRepos: new(0), + PublicGists: new(0), + Followers: new(0), + Following: new(0), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, ArchivedAt: &Timestamp{}, - TotalPrivateRepos: Ptr(int64(0)), - OwnedPrivateRepos: Ptr(int64(0)), - PrivateGists: Ptr(0), - DiskUsage: Ptr(0), - Collaborators: Ptr(0), - BillingEmail: Ptr(""), - Type: Ptr(""), + TotalPrivateRepos: new(int64(0)), + OwnedPrivateRepos: new(int64(0)), + PrivateGists: new(0), + DiskUsage: new(0), + Collaborators: new(0), + BillingEmail: new(""), + Type: new(""), Plan: &Plan{}, - TwoFactorRequirementEnabled: Ptr(false), - IsVerified: Ptr(false), - HasOrganizationProjects: Ptr(false), - HasRepositoryProjects: Ptr(false), - DefaultRepoPermission: Ptr(""), - DefaultRepoSettings: Ptr(""), - MembersCanCreateRepos: Ptr(false), - MembersCanCreatePublicRepos: Ptr(false), - MembersCanCreatePrivateRepos: Ptr(false), - MembersCanCreateInternalRepos: Ptr(false), - MembersCanForkPrivateRepos: Ptr(false), - DeployKeysEnabledForRepositories: Ptr(false), - MembersAllowedRepositoryCreationType: Ptr(""), - MembersCanCreatePages: Ptr(false), - MembersCanCreatePublicPages: Ptr(false), - MembersCanCreatePrivatePages: Ptr(false), - WebCommitSignoffRequired: Ptr(false), - AdvancedSecurityEnabledForNewRepos: Ptr(false), - DependabotAlertsEnabledForNewRepos: Ptr(false), - DependabotSecurityUpdatesEnabledForNewRepos: Ptr(false), - DependencyGraphEnabledForNewRepos: Ptr(false), - SecretScanningEnabledForNewRepos: Ptr(false), - SecretScanningPushProtectionEnabledForNewRepos: Ptr(false), - SecretScanningValidityChecksEnabled: Ptr(false), - SecretScanningPushProtectionCustomLinkEnabled: Ptr(false), - SecretScanningPushProtectionCustomLink: Ptr(""), - MembersCanDeleteRepositories: Ptr(false), - MembersCanChangeRepoVisibility: Ptr(false), - MembersCanInviteOutsideCollaborators: Ptr(false), - MembersCanDeleteIssues: Ptr(false), - DisplayCommenterFullNameSettingEnabled: Ptr(false), - ReadersCanCreateDiscussions: Ptr(false), - MembersCanCreateTeams: Ptr(false), - MembersCanViewDependencyInsights: Ptr(false), - DefaultRepositoryBranch: Ptr(""), - URL: Ptr(""), - EventsURL: Ptr(""), - HooksURL: Ptr(""), - IssuesURL: Ptr(""), - MembersURL: Ptr(""), - PublicMembersURL: Ptr(""), - ReposURL: Ptr(""), + TwoFactorRequirementEnabled: new(false), + IsVerified: new(false), + HasOrganizationProjects: new(false), + HasRepositoryProjects: new(false), + DefaultRepoPermission: new(""), + DefaultRepoSettings: new(""), + MembersCanCreateRepos: new(false), + MembersCanCreatePublicRepos: new(false), + MembersCanCreatePrivateRepos: new(false), + MembersCanCreateInternalRepos: new(false), + MembersCanForkPrivateRepos: new(false), + DeployKeysEnabledForRepositories: new(false), + MembersAllowedRepositoryCreationType: new(""), + MembersCanCreatePages: new(false), + MembersCanCreatePublicPages: new(false), + MembersCanCreatePrivatePages: new(false), + WebCommitSignoffRequired: new(false), + AdvancedSecurityEnabledForNewRepos: new(false), + DependabotAlertsEnabledForNewRepos: new(false), + DependabotSecurityUpdatesEnabledForNewRepos: new(false), + DependencyGraphEnabledForNewRepos: new(false), + SecretScanningEnabledForNewRepos: new(false), + SecretScanningPushProtectionEnabledForNewRepos: new(false), + SecretScanningValidityChecksEnabled: new(false), + SecretScanningPushProtectionCustomLinkEnabled: new(false), + SecretScanningPushProtectionCustomLink: new(""), + MembersCanDeleteRepositories: new(false), + MembersCanChangeRepoVisibility: new(false), + MembersCanInviteOutsideCollaborators: new(false), + MembersCanDeleteIssues: new(false), + DisplayCommenterFullNameSettingEnabled: new(false), + ReadersCanCreateDiscussions: new(false), + MembersCanCreateTeams: new(false), + MembersCanViewDependencyInsights: new(false), + DefaultRepositoryBranch: new(""), + URL: new(""), + EventsURL: new(""), + HooksURL: new(""), + IssuesURL: new(""), + MembersURL: new(""), + PublicMembersURL: new(""), + ReposURL: new(""), } want := `github.Organization{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", Name:"", Company:"", Blog:"", Location:"", Email:"", TwitterUsername:"", Description:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ArchivedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, BillingEmail:"", Type:"", Plan:github.Plan{}, TwoFactorRequirementEnabled:false, IsVerified:false, HasOrganizationProjects:false, HasRepositoryProjects:false, DefaultRepoPermission:"", DefaultRepoSettings:"", MembersCanCreateRepos:false, MembersCanCreatePublicRepos:false, MembersCanCreatePrivateRepos:false, MembersCanCreateInternalRepos:false, MembersCanForkPrivateRepos:false, DeployKeysEnabledForRepositories:false, MembersAllowedRepositoryCreationType:"", MembersCanCreatePages:false, MembersCanCreatePublicPages:false, MembersCanCreatePrivatePages:false, WebCommitSignoffRequired:false, AdvancedSecurityEnabledForNewRepos:false, DependabotAlertsEnabledForNewRepos:false, DependabotSecurityUpdatesEnabledForNewRepos:false, DependencyGraphEnabledForNewRepos:false, SecretScanningEnabledForNewRepos:false, SecretScanningPushProtectionEnabledForNewRepos:false, SecretScanningValidityChecksEnabled:false, SecretScanningPushProtectionCustomLinkEnabled:false, SecretScanningPushProtectionCustomLink:"", MembersCanDeleteRepositories:false, MembersCanChangeRepoVisibility:false, MembersCanInviteOutsideCollaborators:false, MembersCanDeleteIssues:false, DisplayCommenterFullNameSettingEnabled:false, ReadersCanCreateDiscussions:false, MembersCanCreateTeams:false, MembersCanViewDependencyInsights:false, DefaultRepositoryBranch:"", URL:"", EventsURL:"", HooksURL:"", IssuesURL:"", MembersURL:"", PublicMembersURL:"", ReposURL:""}` if got := v.String(); got != want { @@ -1304,22 +1304,22 @@ func TestOrganization_String(t *testing.T) { func TestPackage_String(t *testing.T) { t.Parallel() v := Package{ - ID: Ptr(int64(0)), - Name: Ptr(""), - PackageType: Ptr(""), - HTMLURL: Ptr(""), - Visibility: Ptr(""), + ID: new(int64(0)), + Name: new(""), + PackageType: new(""), + HTMLURL: new(""), + Visibility: new(""), Owner: &User{}, Repository: &Repository{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - Namespace: Ptr(""), - Description: Ptr(""), - Ecosystem: Ptr(""), + Namespace: new(""), + Description: new(""), + Ecosystem: new(""), PackageVersion: &PackageVersion{}, Registry: &PackageRegistry{}, - URL: Ptr(""), - VersionCount: Ptr(int64(0)), + URL: new(""), + VersionCount: new(int64(0)), } want := `github.Package{ID:0, Name:"", PackageType:"", HTMLURL:"", Visibility:"", Owner:github.User{}, Repository:github.Repository{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Namespace:"", Description:"", Ecosystem:"", PackageVersion:github.PackageVersion{}, Registry:github.PackageRegistry{}, URL:"", VersionCount:0}` if got := v.String(); got != want { @@ -1352,8 +1352,8 @@ func TestPackageEventContainerMetadata_String(t *testing.T) { func TestPackageEventContainerMetadataTag_String(t *testing.T) { t.Parallel() v := PackageEventContainerMetadataTag{ - Name: Ptr(""), - Digest: Ptr(""), + Name: new(""), + Digest: new(""), } want := `github.PackageEventContainerMetadataTag{Name:"", Digest:""}` if got := v.String(); got != want { @@ -1364,16 +1364,16 @@ func TestPackageEventContainerMetadataTag_String(t *testing.T) { func TestPackageFile_String(t *testing.T) { t.Parallel() v := PackageFile{ - DownloadURL: Ptr(""), - ID: Ptr(int64(0)), - Name: Ptr(""), - SHA256: Ptr(""), - SHA1: Ptr(""), - MD5: Ptr(""), - ContentType: Ptr(""), - State: Ptr(""), + DownloadURL: new(""), + ID: new(int64(0)), + Name: new(""), + SHA256: new(""), + SHA1: new(""), + MD5: new(""), + ContentType: new(""), + State: new(""), Author: &User{}, - Size: Ptr(int64(0)), + Size: new(int64(0)), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, } @@ -1386,7 +1386,7 @@ func TestPackageFile_String(t *testing.T) { func TestPackageMetadata_String(t *testing.T) { t.Parallel() v := PackageMetadata{ - PackageType: Ptr(""), + PackageType: new(""), Container: &PackageContainerMetadata{}, } want := `github.PackageMetadata{PackageType:"", Container:github.PackageContainerMetadata{}}` @@ -1398,30 +1398,30 @@ func TestPackageMetadata_String(t *testing.T) { func TestPackageNPMMetadata_String(t *testing.T) { t.Parallel() v := PackageNPMMetadata{ - Name: Ptr(""), - Version: Ptr(""), - NPMUser: Ptr(""), - Description: Ptr(""), - GitHead: Ptr(""), - Homepage: Ptr(""), - License: Ptr(""), - Main: Ptr(""), - ID: Ptr(""), - NodeVersion: Ptr(""), - NPMVersion: Ptr(""), - HasShrinkwrap: Ptr(false), + Name: new(""), + Version: new(""), + NPMUser: new(""), + Description: new(""), + GitHead: new(""), + Homepage: new(""), + License: new(""), + Main: new(""), + ID: new(""), + NodeVersion: new(""), + NPMVersion: new(""), + HasShrinkwrap: new(false), Maintainers: []any{nil}, Contributors: []any{nil}, Keywords: []string{""}, Files: []string{""}, OS: []string{""}, CPU: []string{""}, - Readme: Ptr(""), - InstallationCommand: Ptr(""), - ReleaseID: Ptr(int64(0)), - CommitOID: Ptr(""), - PublishedViaActions: Ptr(false), - DeletedByID: Ptr(int64(0)), + Readme: new(""), + InstallationCommand: new(""), + ReleaseID: new(int64(0)), + CommitOID: new(""), + PublishedViaActions: new(false), + DeletedByID: new(int64(0)), } want := `github.PackageNPMMetadata{Name:"", Version:"", NPMUser:"", Description:"", GitHead:"", Homepage:"", License:"", Main:"", ID:"", NodeVersion:"", NPMVersion:"", HasShrinkwrap:false, Maintainers:[], Contributors:[], Keywords:[""], Files:[""], OS:[""], CPU:[""], Readme:"", InstallationCommand:"", ReleaseID:0, CommitOID:"", PublishedViaActions:false, DeletedByID:0}` if got := v.String(); got != want { @@ -1432,7 +1432,7 @@ func TestPackageNPMMetadata_String(t *testing.T) { func TestPackageNugetMetadata_String(t *testing.T) { t.Parallel() v := PackageNugetMetadata{ - Name: Ptr(""), + Name: new(""), } want := `github.PackageNugetMetadata{Name:""}` if got := v.String(); got != want { @@ -1443,11 +1443,11 @@ func TestPackageNugetMetadata_String(t *testing.T) { func TestPackageRegistry_String(t *testing.T) { t.Parallel() v := PackageRegistry{ - AboutURL: Ptr(""), - Name: Ptr(""), - Type: Ptr(""), - URL: Ptr(""), - Vendor: Ptr(""), + AboutURL: new(""), + Name: new(""), + Type: new(""), + URL: new(""), + Vendor: new(""), } want := `github.PackageRegistry{AboutURL:"", Name:"", Type:"", URL:"", Vendor:""}` if got := v.String(); got != want { @@ -1458,15 +1458,15 @@ func TestPackageRegistry_String(t *testing.T) { func TestPackageRelease_String(t *testing.T) { t.Parallel() v := PackageRelease{ - URL: Ptr(""), - HTMLURL: Ptr(""), - ID: Ptr(int64(0)), - TagName: Ptr(""), - TargetCommitish: Ptr(""), - Name: Ptr(""), - Draft: Ptr(false), + URL: new(""), + HTMLURL: new(""), + ID: new(int64(0)), + TagName: new(""), + TargetCommitish: new(""), + Name: new(""), + Draft: new(false), Author: &User{}, - Prerelease: Ptr(false), + Prerelease: new(false), CreatedAt: &Timestamp{}, PublishedAt: &Timestamp{}, } @@ -1479,32 +1479,32 @@ func TestPackageRelease_String(t *testing.T) { func TestPackageVersion_String(t *testing.T) { t.Parallel() v := PackageVersion{ - ID: Ptr(int64(0)), - Name: Ptr(""), - URL: Ptr(""), - PackageHTMLURL: Ptr(""), - License: Ptr(""), - Description: Ptr(""), + ID: new(int64(0)), + Name: new(""), + URL: new(""), + PackageHTMLURL: new(""), + License: new(""), + Description: new(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - Version: Ptr(""), - Summary: Ptr(""), - BodyHTML: Ptr(""), + Version: new(""), + Summary: new(""), + BodyHTML: new(""), Release: &PackageRelease{}, - Manifest: Ptr(""), - HTMLURL: Ptr(""), - TagName: Ptr(""), - TargetCommitish: Ptr(""), - TargetOID: Ptr(""), - Draft: Ptr(false), - Prerelease: Ptr(false), + Manifest: new(""), + HTMLURL: new(""), + TagName: new(""), + TargetCommitish: new(""), + TargetOID: new(""), + Draft: new(false), + Prerelease: new(false), ContainerMetadata: &PackageEventContainerMetadata{}, DockerMetadata: []any{nil}, NPMMetadata: &PackageNPMMetadata{}, - PackageURL: Ptr(""), + PackageURL: new(""), Author: &User{}, - SourceURL: Ptr(""), - InstallationCommand: Ptr(""), + SourceURL: new(""), + InstallationCommand: new(""), DeletedAt: &Timestamp{}, } want := `github.PackageVersion{ID:0, Name:"", URL:"", PackageHTMLURL:"", License:"", Description:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Version:"", Summary:"", BodyHTML:"", Release:github.PackageRelease{}, Manifest:"", HTMLURL:"", TagName:"", TargetCommitish:"", TargetOID:"", Draft:false, Prerelease:false, ContainerMetadata:github.PackageEventContainerMetadata{}, DockerMetadata:[], NPMMetadata:github.PackageNPMMetadata{}, PackageURL:"", Author:github.User{}, SourceURL:"", InstallationCommand:"", DeletedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` @@ -1528,13 +1528,13 @@ func TestPackageVersionBody_String(t *testing.T) { func TestPackageVersionBodyInfo_String(t *testing.T) { t.Parallel() v := PackageVersionBodyInfo{ - Type: Ptr(""), - OID: Ptr(""), - Mode: Ptr(int64(0)), - Name: Ptr(""), - Path: Ptr(""), - Size: Ptr(int64(0)), - Collection: Ptr(false), + Type: new(""), + OID: new(""), + Mode: new(int64(0)), + Name: new(""), + Path: new(""), + Size: new(int64(0)), + Collection: new(false), } want := `github.PackageVersionBodyInfo{Type:"", OID:"", Mode:0, Name:"", Path:"", Size:0, Collection:false}` if got := v.String(); got != want { @@ -1545,7 +1545,7 @@ func TestPackageVersionBodyInfo_String(t *testing.T) { func TestPageStats_String(t *testing.T) { t.Parallel() v := PageStats{ - TotalPages: Ptr(0), + TotalPages: new(0), } want := `github.PageStats{TotalPages:0}` if got := v.String(); got != want { @@ -1556,12 +1556,12 @@ func TestPageStats_String(t *testing.T) { func TestPlan_String(t *testing.T) { t.Parallel() v := Plan{ - Name: Ptr(""), - Space: Ptr(0), - Collaborators: Ptr(0), - PrivateRepos: Ptr(int64(0)), - FilledSeats: Ptr(0), - Seats: Ptr(0), + Name: new(""), + Space: new(0), + Collaborators: new(0), + PrivateRepos: new(int64(0)), + FilledSeats: new(0), + Seats: new(0), } want := `github.Plan{Name:"", Space:0, Collaborators:0, PrivateRepos:0, FilledSeats:0, Seats:0}` if got := v.String(); got != want { @@ -1572,10 +1572,10 @@ func TestPlan_String(t *testing.T) { func TestPreReceiveHook_String(t *testing.T) { t.Parallel() v := PreReceiveHook{ - ID: Ptr(int64(0)), - Name: Ptr(""), - Enforcement: Ptr(""), - ConfigURL: Ptr(""), + ID: new(int64(0)), + Name: new(""), + Enforcement: new(""), + ConfigURL: new(""), } want := `github.PreReceiveHook{ID:0, Name:"", Enforcement:"", ConfigURL:""}` if got := v.String(); got != want { @@ -1586,31 +1586,31 @@ func TestPreReceiveHook_String(t *testing.T) { func TestProjectV2_String(t *testing.T) { t.Parallel() v := ProjectV2{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), Owner: &User{}, Creator: &User{}, - Title: Ptr(""), - Description: Ptr(""), - Public: Ptr(false), + Title: new(""), + Description: new(""), + Public: new(false), ClosedAt: &Timestamp{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, DeletedAt: &Timestamp{}, - Number: Ptr(0), - ShortDescription: Ptr(""), + Number: new(0), + ShortDescription: new(""), DeletedBy: &User{}, - State: Ptr(""), + State: new(""), LatestStatusUpdate: &ProjectV2StatusUpdate{}, - IsTemplate: Ptr(false), - URL: Ptr(""), - HTMLURL: Ptr(""), - ColumnsURL: Ptr(""), - OwnerURL: Ptr(""), - Name: Ptr(""), - Body: Ptr(""), - OrganizationPermission: Ptr(""), - Private: Ptr(false), + IsTemplate: new(false), + URL: new(""), + HTMLURL: new(""), + ColumnsURL: new(""), + OwnerURL: new(""), + Name: new(""), + Body: new(""), + OrganizationPermission: new(""), + Private: new(false), } want := `github.ProjectV2{ID:0, NodeID:"", Owner:github.User{}, Creator:github.User{}, Title:"", Description:"", Public:false, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, DeletedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Number:0, ShortDescription:"", DeletedBy:github.User{}, State:"", LatestStatusUpdate:github.ProjectV2StatusUpdate{}, IsTemplate:false, URL:"", HTMLURL:"", ColumnsURL:"", OwnerURL:"", Name:"", Body:"", OrganizationPermission:"", Private:false}` if got := v.String(); got != want { @@ -1621,51 +1621,51 @@ func TestProjectV2_String(t *testing.T) { func TestPullRequest_String(t *testing.T) { t.Parallel() v := PullRequest{ - ID: Ptr(int64(0)), - Number: Ptr(0), - State: Ptr(""), - Locked: Ptr(false), - Title: Ptr(""), - Body: Ptr(""), + ID: new(int64(0)), + Number: new(0), + State: new(""), + Locked: new(false), + Title: new(""), + Body: new(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, ClosedAt: &Timestamp{}, MergedAt: &Timestamp{}, User: &User{}, - Draft: Ptr(false), - URL: Ptr(""), - HTMLURL: Ptr(""), - IssueURL: Ptr(""), - StatusesURL: Ptr(""), - DiffURL: Ptr(""), - PatchURL: Ptr(""), - CommitsURL: Ptr(""), - CommentsURL: Ptr(""), - ReviewCommentsURL: Ptr(""), - ReviewCommentURL: Ptr(""), + Draft: new(false), + URL: new(""), + HTMLURL: new(""), + IssueURL: new(""), + StatusesURL: new(""), + DiffURL: new(""), + PatchURL: new(""), + CommitsURL: new(""), + CommentsURL: new(""), + ReviewCommentsURL: new(""), + ReviewCommentURL: new(""), Assignee: &User{}, Milestone: &Milestone{}, - AuthorAssociation: Ptr(""), - NodeID: Ptr(""), + AuthorAssociation: new(""), + NodeID: new(""), AutoMerge: &PullRequestAutoMerge{}, - Merged: Ptr(false), - Mergeable: Ptr(false), - MergeableState: Ptr(""), - Rebaseable: Ptr(false), + Merged: new(false), + Mergeable: new(false), + MergeableState: new(""), + Rebaseable: new(false), MergedBy: &User{}, - MergeCommitSHA: Ptr(""), - Comments: Ptr(0), - Commits: Ptr(0), - Additions: Ptr(0), - Deletions: Ptr(0), - ChangedFiles: Ptr(0), - MaintainerCanModify: Ptr(false), - ReviewComments: Ptr(0), + MergeCommitSHA: new(""), + Comments: new(0), + Commits: new(0), + Additions: new(0), + Deletions: new(0), + ChangedFiles: new(0), + MaintainerCanModify: new(false), + ReviewComments: new(0), Links: &PRLinks{}, Head: &PullRequestBranch{}, Base: &PullRequestBranch{}, Stack: &PullRequestStack{}, - ActiveLockReason: Ptr(""), + ActiveLockReason: new(""), } want := `github.PullRequest{ID:0, Number:0, State:"", Locked:false, Title:"", Body:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, MergedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, User:github.User{}, Draft:false, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", Assignee:github.User{}, Milestone:github.Milestone{}, AuthorAssociation:"", NodeID:"", AutoMerge:github.PullRequestAutoMerge{}, Merged:false, Mergeable:false, MergeableState:"", Rebaseable:false, MergedBy:github.User{}, MergeCommitSHA:"", Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, MaintainerCanModify:false, ReviewComments:0, Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, Stack:github.PullRequestStack{}, ActiveLockReason:""}` if got := v.String(); got != want { @@ -1676,32 +1676,32 @@ func TestPullRequest_String(t *testing.T) { func TestPullRequestComment_String(t *testing.T) { t.Parallel() v := PullRequestComment{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - InReplyTo: Ptr(int64(0)), - Body: Ptr(""), - Path: Ptr(""), - DiffHunk: Ptr(""), - PullRequestReviewID: Ptr(int64(0)), - Position: Ptr(0), - OriginalPosition: Ptr(0), - StartLine: Ptr(0), - Line: Ptr(0), - OriginalLine: Ptr(0), - OriginalStartLine: Ptr(0), - Side: Ptr(""), - StartSide: Ptr(""), - CommitID: Ptr(""), - OriginalCommitID: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), + InReplyTo: new(int64(0)), + Body: new(""), + Path: new(""), + DiffHunk: new(""), + PullRequestReviewID: new(int64(0)), + Position: new(0), + OriginalPosition: new(0), + StartLine: new(0), + Line: new(0), + OriginalLine: new(0), + OriginalStartLine: new(0), + Side: new(""), + StartSide: new(""), + CommitID: new(""), + OriginalCommitID: new(""), User: &User{}, Reactions: &Reactions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - AuthorAssociation: Ptr(""), - URL: Ptr(""), - HTMLURL: Ptr(""), - PullRequestURL: Ptr(""), - SubjectType: Ptr(""), + AuthorAssociation: new(""), + URL: new(""), + HTMLURL: new(""), + PullRequestURL: new(""), + SubjectType: new(""), } want := `github.PullRequestComment{ID:0, NodeID:"", InReplyTo:0, Body:"", Path:"", DiffHunk:"", PullRequestReviewID:0, Position:0, OriginalPosition:0, StartLine:0, Line:0, OriginalLine:0, OriginalStartLine:0, Side:"", StartSide:"", CommitID:"", OriginalCommitID:"", User:github.User{}, Reactions:github.Reactions{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, AuthorAssociation:"", URL:"", HTMLURL:"", PullRequestURL:"", SubjectType:""}` if got := v.String(); got != want { @@ -1713,7 +1713,7 @@ func TestPullRequestDismissReviewRequest_String(t *testing.T) { t.Parallel() v := PullRequestDismissReviewRequest{ Message: "", - Event: Ptr(""), + Event: new(""), } want := `github.PullRequestDismissReviewRequest{Message:"", Event:""}` if got := v.String(); got != want { @@ -1724,16 +1724,16 @@ func TestPullRequestDismissReviewRequest_String(t *testing.T) { func TestPullRequestReview_String(t *testing.T) { t.Parallel() v := PullRequestReview{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), User: &User{}, - Body: Ptr(""), + Body: new(""), SubmittedAt: &Timestamp{}, - CommitID: Ptr(""), - HTMLURL: Ptr(""), - PullRequestURL: Ptr(""), - State: Ptr(""), - AuthorAssociation: Ptr(""), + CommitID: new(""), + HTMLURL: new(""), + PullRequestURL: new(""), + State: new(""), + AuthorAssociation: new(""), } want := `github.PullRequestReview{ID:0, NodeID:"", User:github.User{}, Body:"", SubmittedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CommitID:"", HTMLURL:"", PullRequestURL:"", State:"", AuthorAssociation:""}` if got := v.String(); got != want { @@ -1744,10 +1744,10 @@ func TestPullRequestReview_String(t *testing.T) { func TestPullRequestReviewRequest_String(t *testing.T) { t.Parallel() v := PullRequestReviewRequest{ - NodeID: Ptr(""), - CommitID: Ptr(""), - Body: Ptr(""), - Event: Ptr(""), + NodeID: new(""), + CommitID: new(""), + Body: new(""), + Event: new(""), } want := `github.PullRequestReviewRequest{NodeID:"", CommitID:"", Body:"", Event:""}` if got := v.String(); got != want { @@ -1758,8 +1758,8 @@ func TestPullRequestReviewRequest_String(t *testing.T) { func TestPullRequestThread_String(t *testing.T) { t.Parallel() v := PullRequestThread{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), } want := `github.PullRequestThread{ID:0, NodeID:""}` if got := v.String(); got != want { @@ -1770,10 +1770,10 @@ func TestPullRequestThread_String(t *testing.T) { func TestPullStats_String(t *testing.T) { t.Parallel() v := PullStats{ - TotalPulls: Ptr(0), - MergedPulls: Ptr(0), - MergeablePulls: Ptr(0), - UnmergeablePulls: Ptr(0), + TotalPulls: new(0), + MergedPulls: new(0), + MergeablePulls: new(0), + UnmergeablePulls: new(0), } want := `github.PullStats{TotalPulls:0, MergedPulls:0, MergeablePulls:0, UnmergeablePulls:0}` if got := v.String(); got != want { @@ -1784,19 +1784,19 @@ func TestPullStats_String(t *testing.T) { func TestPushEvent_String(t *testing.T) { t.Parallel() v := PushEvent{ - PushID: Ptr(int64(0)), - Head: Ptr(""), - Ref: Ptr(""), - Size: Ptr(0), - Before: Ptr(""), - DistinctSize: Ptr(0), - Action: Ptr(""), - After: Ptr(""), - Created: Ptr(false), - Deleted: Ptr(false), - Forced: Ptr(false), - BaseRef: Ptr(""), - Compare: Ptr(""), + PushID: new(int64(0)), + Head: new(""), + Ref: new(""), + Size: new(0), + Before: new(""), + DistinctSize: new(0), + Action: new(""), + After: new(""), + Created: new(false), + Deleted: new(false), + Forced: new(false), + BaseRef: new(""), + Compare: new(""), Repo: &PushEventRepository{}, HeadCommit: &HeadCommit{}, Pusher: &CommitAuthor{}, @@ -1828,10 +1828,10 @@ func TestRate_String(t *testing.T) { func TestReaction_String(t *testing.T) { t.Parallel() v := Reaction{ - ID: Ptr(int64(0)), + ID: new(int64(0)), User: &User{}, - NodeID: Ptr(""), - Content: Ptr(""), + NodeID: new(""), + Content: new(""), CreatedAt: &Timestamp{}, } want := `github.Reaction{ID:0, User:github.User{}, NodeID:"", Content:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` @@ -1843,10 +1843,10 @@ func TestReaction_String(t *testing.T) { func TestReference_String(t *testing.T) { t.Parallel() v := Reference{ - Ref: Ptr(""), - URL: Ptr(""), + Ref: new(""), + URL: new(""), Object: &GitObject{}, - NodeID: Ptr(""), + NodeID: new(""), } want := `github.Reference{Ref:"", URL:"", Object:github.GitObject{}, NodeID:""}` if got := v.String(); got != want { @@ -1857,20 +1857,20 @@ func TestReference_String(t *testing.T) { func TestReleaseAsset_String(t *testing.T) { t.Parallel() v := ReleaseAsset{ - ID: Ptr(int64(0)), - URL: Ptr(""), - Name: Ptr(""), - Label: Ptr(""), - State: Ptr(""), - ContentType: Ptr(""), - Size: Ptr(0), - DownloadCount: Ptr(0), + ID: new(int64(0)), + URL: new(""), + Name: new(""), + Label: new(""), + State: new(""), + ContentType: new(""), + Size: new(0), + DownloadCount: new(0), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - BrowserDownloadURL: Ptr(""), + BrowserDownloadURL: new(""), Uploader: &User{}, - NodeID: Ptr(""), - Digest: Ptr(""), + NodeID: new(""), + Digest: new(""), } want := `github.ReleaseAsset{ID:0, URL:"", Name:"", Label:"", State:"", ContentType:"", Size:0, DownloadCount:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, BrowserDownloadURL:"", Uploader:github.User{}, NodeID:"", Digest:""}` if got := v.String(); got != want { @@ -1881,8 +1881,8 @@ func TestReleaseAsset_String(t *testing.T) { func TestRename_String(t *testing.T) { t.Parallel() v := Rename{ - From: Ptr(""), - To: Ptr(""), + From: new(""), + To: new(""), } want := `github.Rename{From:"", To:""}` if got := v.String(); got != want { @@ -1893,12 +1893,12 @@ func TestRename_String(t *testing.T) { func TestRepoStats_String(t *testing.T) { t.Parallel() v := RepoStats{ - TotalRepos: Ptr(0), - RootRepos: Ptr(0), - ForkRepos: Ptr(0), - OrgRepos: Ptr(0), - TotalPushes: Ptr(0), - TotalWikis: Ptr(0), + TotalRepos: new(0), + RootRepos: new(0), + ForkRepos: new(0), + OrgRepos: new(0), + TotalPushes: new(0), + TotalWikis: new(0), } want := `github.RepoStats{TotalRepos:0, RootRepos:0, ForkRepos:0, OrgRepos:0, TotalPushes:0, TotalWikis:0}` if got := v.String(); got != want { @@ -1909,14 +1909,14 @@ func TestRepoStats_String(t *testing.T) { func TestRepoStatus_String(t *testing.T) { t.Parallel() v := RepoStatus{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - URL: Ptr(""), - State: Ptr(""), - TargetURL: Ptr(""), - Description: Ptr(""), - Context: Ptr(""), - AvatarURL: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), + URL: new(""), + State: new(""), + TargetURL: new(""), + Description: new(""), + Context: new(""), + AvatarURL: new(""), Creator: &User{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, @@ -1930,112 +1930,112 @@ func TestRepoStatus_String(t *testing.T) { func TestRepository_String(t *testing.T) { t.Parallel() v := Repository{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), + ID: new(int64(0)), + NodeID: new(""), Owner: &User{}, - Name: Ptr(""), - FullName: Ptr(""), - Description: Ptr(""), - Homepage: Ptr(""), + Name: new(""), + FullName: new(""), + Description: new(""), + Homepage: new(""), CodeOfConduct: &CodeOfConduct{}, - DefaultBranch: Ptr(""), - MasterBranch: Ptr(""), + DefaultBranch: new(""), + MasterBranch: new(""), CreatedAt: &Timestamp{}, PushedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - HTMLURL: Ptr(""), - CloneURL: Ptr(""), - GitURL: Ptr(""), - MirrorURL: Ptr(""), - SSHURL: Ptr(""), - SVNURL: Ptr(""), - Language: Ptr(""), - Fork: Ptr(false), - ForksCount: Ptr(0), - NetworkCount: Ptr(0), - OpenIssuesCount: Ptr(0), - OpenIssues: Ptr(0), - StargazersCount: Ptr(0), - SubscribersCount: Ptr(0), - WatchersCount: Ptr(0), - Watchers: Ptr(0), - Size: Ptr(0), - AutoInit: Ptr(false), + HTMLURL: new(""), + CloneURL: new(""), + GitURL: new(""), + MirrorURL: new(""), + SSHURL: new(""), + SVNURL: new(""), + Language: new(""), + Fork: new(false), + ForksCount: new(0), + NetworkCount: new(0), + OpenIssuesCount: new(0), + OpenIssues: new(0), + StargazersCount: new(0), + SubscribersCount: new(0), + WatchersCount: new(0), + Watchers: new(0), + Size: new(0), + AutoInit: new(false), Parent: &Repository{}, Source: &Repository{}, TemplateRepository: &Repository{}, Organization: &Organization{}, Permissions: &RepositoryPermissions{}, - AllowRebaseMerge: Ptr(false), - AllowUpdateBranch: Ptr(false), - AllowSquashMerge: Ptr(false), - AllowMergeCommit: Ptr(false), - AllowAutoMerge: Ptr(false), - AllowForking: Ptr(false), - WebCommitSignoffRequired: Ptr(false), - DeleteBranchOnMerge: Ptr(false), - UseSquashPRTitleAsDefault: Ptr(false), - SquashMergeCommitTitle: Ptr(""), - SquashMergeCommitMessage: Ptr(""), - MergeCommitTitle: Ptr(""), - MergeCommitMessage: Ptr(""), + AllowRebaseMerge: new(false), + AllowUpdateBranch: new(false), + AllowSquashMerge: new(false), + AllowMergeCommit: new(false), + AllowAutoMerge: new(false), + AllowForking: new(false), + WebCommitSignoffRequired: new(false), + DeleteBranchOnMerge: new(false), + UseSquashPRTitleAsDefault: new(false), + SquashMergeCommitTitle: new(""), + SquashMergeCommitMessage: new(""), + MergeCommitTitle: new(""), + MergeCommitMessage: new(""), Topics: []string{""}, - Archived: Ptr(false), - Disabled: Ptr(false), + Archived: new(false), + Disabled: new(false), License: &License{}, - Private: Ptr(false), - HasIssues: Ptr(false), - HasWiki: Ptr(false), - HasPages: Ptr(false), - HasProjects: Ptr(false), - HasDownloads: Ptr(false), - HasDiscussions: Ptr(false), - HasPullRequests: Ptr(false), - PullRequestCreationPolicy: Ptr(""), - IsTemplate: Ptr(false), - LicenseTemplate: Ptr(""), - GitignoreTemplate: Ptr(""), + Private: new(false), + HasIssues: new(false), + HasWiki: new(false), + HasPages: new(false), + HasProjects: new(false), + HasDownloads: new(false), + HasDiscussions: new(false), + HasPullRequests: new(false), + PullRequestCreationPolicy: new(""), + IsTemplate: new(false), + LicenseTemplate: new(""), + GitignoreTemplate: new(""), SecurityAndAnalysis: &SecurityAndAnalysis{}, - TeamID: Ptr(int64(0)), - URL: Ptr(""), - ArchiveURL: Ptr(""), - AssigneesURL: Ptr(""), - BlobsURL: Ptr(""), - BranchesURL: Ptr(""), - CollaboratorsURL: Ptr(""), - CommentsURL: Ptr(""), - CommitsURL: Ptr(""), - CompareURL: Ptr(""), - ContentsURL: Ptr(""), - ContributorsURL: Ptr(""), - DeploymentsURL: Ptr(""), - DownloadsURL: Ptr(""), - EventsURL: Ptr(""), - ForksURL: Ptr(""), - GitCommitsURL: Ptr(""), - GitRefsURL: Ptr(""), - GitTagsURL: Ptr(""), - HooksURL: Ptr(""), - IssueCommentURL: Ptr(""), - IssueEventsURL: Ptr(""), - IssuesURL: Ptr(""), - KeysURL: Ptr(""), - LabelsURL: Ptr(""), - LanguagesURL: Ptr(""), - MergesURL: Ptr(""), - MilestonesURL: Ptr(""), - NotificationsURL: Ptr(""), - PullsURL: Ptr(""), - ReleasesURL: Ptr(""), - StargazersURL: Ptr(""), - StatusesURL: Ptr(""), - SubscribersURL: Ptr(""), - SubscriptionURL: Ptr(""), - TagsURL: Ptr(""), - TreesURL: Ptr(""), - TeamsURL: Ptr(""), - Visibility: Ptr(""), - RoleName: Ptr(""), + TeamID: new(int64(0)), + URL: new(""), + ArchiveURL: new(""), + AssigneesURL: new(""), + BlobsURL: new(""), + BranchesURL: new(""), + CollaboratorsURL: new(""), + CommentsURL: new(""), + CommitsURL: new(""), + CompareURL: new(""), + ContentsURL: new(""), + ContributorsURL: new(""), + DeploymentsURL: new(""), + DownloadsURL: new(""), + EventsURL: new(""), + ForksURL: new(""), + GitCommitsURL: new(""), + GitRefsURL: new(""), + GitTagsURL: new(""), + HooksURL: new(""), + IssueCommentURL: new(""), + IssueEventsURL: new(""), + IssuesURL: new(""), + KeysURL: new(""), + LabelsURL: new(""), + LanguagesURL: new(""), + MergesURL: new(""), + MilestonesURL: new(""), + NotificationsURL: new(""), + PullsURL: new(""), + ReleasesURL: new(""), + StargazersURL: new(""), + StatusesURL: new(""), + SubscribersURL: new(""), + SubscriptionURL: new(""), + TagsURL: new(""), + TreesURL: new(""), + TeamsURL: new(""), + Visibility: new(""), + RoleName: new(""), } want := `github.Repository{ID:0, NodeID:"", Owner:github.User{}, Name:"", FullName:"", Description:"", Homepage:"", CodeOfConduct:github.CodeOfConduct{}, DefaultBranch:"", MasterBranch:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, PushedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, HTMLURL:"", CloneURL:"", GitURL:"", MirrorURL:"", SSHURL:"", SVNURL:"", Language:"", Fork:false, ForksCount:0, NetworkCount:0, OpenIssuesCount:0, OpenIssues:0, StargazersCount:0, SubscribersCount:0, WatchersCount:0, Watchers:0, Size:0, AutoInit:false, Parent:github.Repository{}, Source:github.Repository{}, TemplateRepository:github.Repository{}, Organization:github.Organization{}, Permissions:github.RepositoryPermissions{}, AllowRebaseMerge:false, AllowUpdateBranch:false, AllowSquashMerge:false, AllowMergeCommit:false, AllowAutoMerge:false, AllowForking:false, WebCommitSignoffRequired:false, DeleteBranchOnMerge:false, UseSquashPRTitleAsDefault:false, SquashMergeCommitTitle:"", SquashMergeCommitMessage:"", MergeCommitTitle:"", MergeCommitMessage:"", Topics:[""], Archived:false, Disabled:false, License:github.License{}, Private:false, HasIssues:false, HasWiki:false, HasPages:false, HasProjects:false, HasDownloads:false, HasDiscussions:false, HasPullRequests:false, PullRequestCreationPolicy:"", IsTemplate:false, LicenseTemplate:"", GitignoreTemplate:"", SecurityAndAnalysis:github.SecurityAndAnalysis{}, TeamID:0, URL:"", ArchiveURL:"", AssigneesURL:"", BlobsURL:"", BranchesURL:"", CollaboratorsURL:"", CommentsURL:"", CommitsURL:"", CompareURL:"", ContentsURL:"", ContributorsURL:"", DeploymentsURL:"", DownloadsURL:"", EventsURL:"", ForksURL:"", GitCommitsURL:"", GitRefsURL:"", GitTagsURL:"", HooksURL:"", IssueCommentURL:"", IssueEventsURL:"", IssuesURL:"", KeysURL:"", LabelsURL:"", LanguagesURL:"", MergesURL:"", MilestonesURL:"", NotificationsURL:"", PullsURL:"", ReleasesURL:"", StargazersURL:"", StatusesURL:"", SubscribersURL:"", SubscriptionURL:"", TagsURL:"", TreesURL:"", TeamsURL:"", Visibility:"", RoleName:""}` if got := v.String(); got != want { @@ -2046,18 +2046,18 @@ func TestRepository_String(t *testing.T) { func TestRepositoryComment_String(t *testing.T) { t.Parallel() v := RepositoryComment{ - HTMLURL: Ptr(""), - URL: Ptr(""), - ID: Ptr(int64(0)), - NodeID: Ptr(""), - CommitID: Ptr(""), + HTMLURL: new(""), + URL: new(""), + ID: new(int64(0)), + NodeID: new(""), + CommitID: new(""), User: &User{}, Reactions: &Reactions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - Body: Ptr(""), - Path: Ptr(""), - Position: Ptr(0), + Body: new(""), + Path: new(""), + Position: new(0), } want := `github.RepositoryComment{HTMLURL:"", URL:"", ID:0, NodeID:"", CommitID:"", User:github.User{}, Reactions:github.Reactions{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Body:"", Path:"", Position:0}` if got := v.String(); got != want { @@ -2068,14 +2068,14 @@ func TestRepositoryComment_String(t *testing.T) { func TestRepositoryCommit_String(t *testing.T) { t.Parallel() v := RepositoryCommit{ - NodeID: Ptr(""), - SHA: Ptr(""), + NodeID: new(""), + SHA: new(""), Commit: &Commit{}, Author: &User{}, Committer: &User{}, - HTMLURL: Ptr(""), - URL: Ptr(""), - CommentsURL: Ptr(""), + HTMLURL: new(""), + URL: new(""), + CommentsURL: new(""), Stats: &CommitStats{}, } want := `github.RepositoryCommit{NodeID:"", SHA:"", Commit:github.Commit{}, Author:github.User{}, Committer:github.User{}, HTMLURL:"", URL:"", CommentsURL:"", Stats:github.CommitStats{}}` @@ -2087,19 +2087,19 @@ func TestRepositoryCommit_String(t *testing.T) { func TestRepositoryContent_String(t *testing.T) { t.Parallel() v := RepositoryContent{ - Type: Ptr(""), - Target: Ptr(""), - Encoding: Ptr(""), - Size: Ptr(0), - Name: Ptr(""), - Path: Ptr(""), - Content: Ptr(""), - SHA: Ptr(""), - URL: Ptr(""), - GitURL: Ptr(""), - HTMLURL: Ptr(""), - DownloadURL: Ptr(""), - SubmoduleGitURL: Ptr(""), + Type: new(""), + Target: new(""), + Encoding: new(""), + Size: new(0), + Name: new(""), + Path: new(""), + Content: new(""), + SHA: new(""), + URL: new(""), + GitURL: new(""), + HTMLURL: new(""), + DownloadURL: new(""), + SubmoduleGitURL: new(""), } want := `github.RepositoryContent{Type:"", Target:"", Encoding:"", Size:0, Name:"", Path:"", Content:"", SHA:"", URL:"", GitURL:"", HTMLURL:"", DownloadURL:"", SubmoduleGitURL:""}` if got := v.String(); got != want { @@ -2110,17 +2110,17 @@ func TestRepositoryContent_String(t *testing.T) { func TestRepositoryLicense_String(t *testing.T) { t.Parallel() v := RepositoryLicense{ - Name: Ptr(""), - Path: Ptr(""), - SHA: Ptr(""), - Size: Ptr(0), - URL: Ptr(""), - HTMLURL: Ptr(""), - GitURL: Ptr(""), - DownloadURL: Ptr(""), - Type: Ptr(""), - Content: Ptr(""), - Encoding: Ptr(""), + Name: new(""), + Path: new(""), + SHA: new(""), + Size: new(0), + URL: new(""), + HTMLURL: new(""), + GitURL: new(""), + DownloadURL: new(""), + Type: new(""), + Content: new(""), + Encoding: new(""), License: &License{}, } want := `github.RepositoryLicense{Name:"", Path:"", SHA:"", Size:0, URL:"", HTMLURL:"", GitURL:"", DownloadURL:"", Type:"", Content:"", Encoding:"", License:github.License{}}` @@ -2146,11 +2146,11 @@ func TestRepositoryRelease_String(t *testing.T) { v := RepositoryRelease{ TagName: "", TargetCommitish: "", - Name: Ptr(""), - Body: Ptr(""), + Name: new(""), + Body: new(""), Draft: false, Prerelease: false, - Immutable: Ptr(false), + Immutable: new(false), ID: 0, CreatedAt: Timestamp{}, PublishedAt: &Timestamp{}, @@ -2159,14 +2159,14 @@ func TestRepositoryRelease_String(t *testing.T) { HTMLURL: "", AssetsURL: "", UploadURL: "", - ZipballURL: Ptr(""), - TarballURL: Ptr(""), + ZipballURL: new(""), + TarballURL: new(""), Author: &User{}, NodeID: "", - BodyHTML: Ptr(""), - BodyText: Ptr(""), - MentionsCount: Ptr(0), - DiscussionURL: Ptr(""), + BodyHTML: new(""), + BodyText: new(""), + MentionsCount: new(0), + DiscussionURL: new(""), Reactions: &Reactions{}, } want := `github.RepositoryRelease{TagName:"", TargetCommitish:"", Name:"", Body:"", Draft:false, Prerelease:false, Immutable:false, ID:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, PublishedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, URL:"", HTMLURL:"", AssetsURL:"", UploadURL:"", ZipballURL:"", TarballURL:"", Author:github.User{}, NodeID:"", BodyHTML:"", BodyText:"", MentionsCount:0, DiscussionURL:"", Reactions:github.Reactions{}}` @@ -2189,9 +2189,9 @@ func TestSBOM_String(t *testing.T) { func TestSSHSigningKey_String(t *testing.T) { t.Parallel() v := SSHSigningKey{ - ID: Ptr(int64(0)), - Key: Ptr(""), - Title: Ptr(""), + ID: new(int64(0)), + Key: new(""), + Title: new(""), CreatedAt: &Timestamp{}, } want := `github.SSHSigningKey{ID:0, Key:"", Title:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` @@ -2203,7 +2203,7 @@ func TestSSHSigningKey_String(t *testing.T) { func TestSecretScanning_String(t *testing.T) { t.Parallel() v := SecretScanning{ - Status: Ptr(""), + Status: new(""), } want := `github.SecretScanning{Status:""}` if got := v.String(); got != want { @@ -2214,7 +2214,7 @@ func TestSecretScanning_String(t *testing.T) { func TestSecretScanningPushProtection_String(t *testing.T) { t.Parallel() v := SecretScanningPushProtection{ - Status: Ptr(""), + Status: new(""), } want := `github.SecretScanningPushProtection{Status:""}` if got := v.String(); got != want { @@ -2241,7 +2241,7 @@ func TestSecurityAndAnalysis_String(t *testing.T) { func TestSelfHostRunnerPermissionsEnterprise_String(t *testing.T) { t.Parallel() v := SelfHostRunnerPermissionsEnterprise{ - DisableSelfHostedRunnersForAllOrgs: Ptr(false), + DisableSelfHostedRunnersForAllOrgs: new(false), } want := `github.SelfHostRunnerPermissionsEnterprise{DisableSelfHostedRunnersForAllOrgs:false}` if got := v.String(); got != want { @@ -2252,8 +2252,8 @@ func TestSelfHostRunnerPermissionsEnterprise_String(t *testing.T) { func TestSelfHostedRunnersSettingsOrganization_String(t *testing.T) { t.Parallel() v := SelfHostedRunnersSettingsOrganization{ - EnabledRepositories: Ptr(""), - SelectedRepositoriesURL: Ptr(""), + EnabledRepositories: new(""), + SelectedRepositoriesURL: new(""), } want := `github.SelfHostedRunnersSettingsOrganization{EnabledRepositories:"", SelectedRepositoriesURL:""}` if got := v.String(); got != want { @@ -2264,13 +2264,13 @@ func TestSelfHostedRunnersSettingsOrganization_String(t *testing.T) { func TestSourceImportAuthor_String(t *testing.T) { t.Parallel() v := SourceImportAuthor{ - ID: Ptr(int64(0)), - RemoteID: Ptr(""), - RemoteName: Ptr(""), - Email: Ptr(""), - Name: Ptr(""), - URL: Ptr(""), - ImportURL: Ptr(""), + ID: new(int64(0)), + RemoteID: new(""), + RemoteName: new(""), + Email: new(""), + Name: new(""), + URL: new(""), + ImportURL: new(""), } want := `github.SourceImportAuthor{ID:0, RemoteID:"", RemoteName:"", Email:"", Name:"", URL:"", ImportURL:""}` if got := v.String(); got != want { @@ -2281,26 +2281,26 @@ func TestSourceImportAuthor_String(t *testing.T) { func TestTeam_String(t *testing.T) { t.Parallel() v := Team{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - Name: Ptr(""), - Description: Ptr(""), - URL: Ptr(""), - Slug: Ptr(""), - Permission: Ptr(""), - Privacy: Ptr(""), - NotificationSetting: Ptr(""), - MembersCount: Ptr(0), - ReposCount: Ptr(0), + ID: new(int64(0)), + NodeID: new(""), + Name: new(""), + Description: new(""), + URL: new(""), + Slug: new(""), + Permission: new(""), + Privacy: new(""), + NotificationSetting: new(""), + MembersCount: new(0), + ReposCount: new(0), Organization: &Organization{}, - HTMLURL: Ptr(""), - MembersURL: Ptr(""), - RepositoriesURL: Ptr(""), + HTMLURL: new(""), + MembersURL: new(""), + RepositoriesURL: new(""), Parent: &Team{}, - LDAPDN: Ptr(""), - Assignment: Ptr(""), - Type: Ptr(""), - AccessSource: Ptr(""), + LDAPDN: new(""), + Assignment: new(""), + Type: new(""), + AccessSource: new(""), } want := `github.Team{ID:0, NodeID:"", Name:"", Description:"", URL:"", Slug:"", Permission:"", Privacy:"", NotificationSetting:"", MembersCount:0, ReposCount:0, Organization:github.Organization{}, HTMLURL:"", MembersURL:"", RepositoriesURL:"", Parent:github.Team{}, LDAPDN:"", Assignment:"", Type:"", AccessSource:""}` if got := v.String(); got != want { @@ -2312,22 +2312,22 @@ func TestTeamDiscussion_String(t *testing.T) { t.Parallel() v := TeamDiscussion{ Author: &User{}, - Body: Ptr(""), - BodyHTML: Ptr(""), - BodyVersion: Ptr(""), - CommentsCount: Ptr(0), - CommentsURL: Ptr(""), + Body: new(""), + BodyHTML: new(""), + BodyVersion: new(""), + CommentsCount: new(0), + CommentsURL: new(""), CreatedAt: &Timestamp{}, LastEditedAt: &Timestamp{}, - HTMLURL: Ptr(""), - NodeID: Ptr(""), - Number: Ptr(0), - Pinned: Ptr(false), - Private: Ptr(false), - TeamURL: Ptr(""), - Title: Ptr(""), + HTMLURL: new(""), + NodeID: new(""), + Number: new(0), + Pinned: new(false), + Private: new(false), + TeamURL: new(""), + Title: new(""), UpdatedAt: &Timestamp{}, - URL: Ptr(""), + URL: new(""), Reactions: &Reactions{}, } want := `github.TeamDiscussion{Author:github.User{}, Body:"", BodyHTML:"", BodyVersion:"", CommentsCount:0, CommentsURL:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, LastEditedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, HTMLURL:"", NodeID:"", Number:0, Pinned:false, Private:false, TeamURL:"", Title:"", UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, URL:"", Reactions:github.Reactions{}}` @@ -2339,16 +2339,16 @@ func TestTeamDiscussion_String(t *testing.T) { func TestTeamLDAPMapping_String(t *testing.T) { t.Parallel() v := TeamLDAPMapping{ - ID: Ptr(int64(0)), - LDAPDN: Ptr(""), - URL: Ptr(""), - Name: Ptr(""), - Slug: Ptr(""), - Description: Ptr(""), - Privacy: Ptr(""), - Permission: Ptr(""), - MembersURL: Ptr(""), - RepositoriesURL: Ptr(""), + ID: new(int64(0)), + LDAPDN: new(""), + URL: new(""), + Name: new(""), + Slug: new(""), + Description: new(""), + Privacy: new(""), + Permission: new(""), + MembersURL: new(""), + RepositoriesURL: new(""), } want := `github.TeamLDAPMapping{ID:0, LDAPDN:"", URL:"", Name:"", Slug:"", Description:"", Privacy:"", Permission:"", MembersURL:"", RepositoriesURL:""}` if got := v.String(); got != want { @@ -2359,10 +2359,10 @@ func TestTeamLDAPMapping_String(t *testing.T) { func TestTextMatch_String(t *testing.T) { t.Parallel() v := TextMatch{ - ObjectURL: Ptr(""), - ObjectType: Ptr(""), - Property: Ptr(""), - Fragment: Ptr(""), + ObjectURL: new(""), + ObjectType: new(""), + Property: new(""), + Fragment: new(""), } want := `github.TextMatch{ObjectURL:"", ObjectType:"", Property:"", Fragment:""}` if got := v.String(); got != want { @@ -2373,8 +2373,8 @@ func TestTextMatch_String(t *testing.T) { func TestTree_String(t *testing.T) { t.Parallel() v := Tree{ - SHA: Ptr(""), - Truncated: Ptr(false), + SHA: new(""), + Truncated: new(false), } want := `github.Tree{SHA:"", Truncated:false}` if got := v.String(); got != want { @@ -2385,13 +2385,13 @@ func TestTree_String(t *testing.T) { func TestTreeEntry_String(t *testing.T) { t.Parallel() v := TreeEntry{ - SHA: Ptr(""), - Path: Ptr(""), - Mode: Ptr(""), - Type: Ptr(""), - Size: Ptr(0), - Content: Ptr(""), - URL: Ptr(""), + SHA: new(""), + Path: new(""), + Mode: new(""), + Type: new(""), + Size: new(0), + Content: new(""), + URL: new(""), } want := `github.TreeEntry{SHA:"", Path:"", Mode:"", Type:"", Size:0, Content:"", URL:""}` if got := v.String(); got != want { @@ -2402,13 +2402,13 @@ func TestTreeEntry_String(t *testing.T) { func TestUpdateTeamRequest_String(t *testing.T) { t.Parallel() v := UpdateTeamRequest{ - Name: Ptr(""), - Description: Ptr(""), - Privacy: Ptr(""), - NotificationSetting: Ptr(""), - Permission: Ptr(""), - ParentTeamID: Ptr(int64(0)), - ParentTeamSlug: Ptr(""), + Name: new(""), + Description: new(""), + Privacy: new(""), + NotificationSetting: new(""), + Permission: new(""), + ParentTeamID: new(int64(0)), + ParentTeamSlug: new(""), RemoveParentTeam: false, } want := `github.UpdateTeamRequest{Name:"", Description:"", Privacy:"", NotificationSetting:"", Permission:"", ParentTeamID:0, ParentTeamSlug:"", RemoveParentTeam:false}` @@ -2420,55 +2420,55 @@ func TestUpdateTeamRequest_String(t *testing.T) { func TestUser_String(t *testing.T) { t.Parallel() v := User{ - Login: Ptr(""), - ID: Ptr(int64(0)), - UserViewType: Ptr(""), - NodeID: Ptr(""), - AvatarURL: Ptr(""), - HTMLURL: Ptr(""), - GravatarID: Ptr(""), - Name: Ptr(""), - Company: Ptr(""), - Blog: Ptr(""), - Location: Ptr(""), - Email: Ptr(""), - NotificationEmail: Ptr(""), - Hireable: Ptr(false), - Bio: Ptr(""), - TwitterUsername: Ptr(""), - PublicRepos: Ptr(0), - PublicGists: Ptr(0), - Followers: Ptr(0), - Following: Ptr(0), + Login: new(""), + ID: new(int64(0)), + UserViewType: new(""), + NodeID: new(""), + AvatarURL: new(""), + HTMLURL: new(""), + GravatarID: new(""), + Name: new(""), + Company: new(""), + Blog: new(""), + Location: new(""), + Email: new(""), + NotificationEmail: new(""), + Hireable: new(false), + Bio: new(""), + TwitterUsername: new(""), + PublicRepos: new(0), + PublicGists: new(0), + Followers: new(0), + Following: new(0), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, SuspendedAt: &Timestamp{}, - Type: Ptr(""), - SiteAdmin: Ptr(false), - TotalPrivateRepos: Ptr(int64(0)), - OwnedPrivateRepos: Ptr(int64(0)), - PrivateGists: Ptr(0), - DiskUsage: Ptr(0), - Collaborators: Ptr(0), - TwoFactorAuthentication: Ptr(false), + Type: new(""), + SiteAdmin: new(false), + TotalPrivateRepos: new(int64(0)), + OwnedPrivateRepos: new(int64(0)), + PrivateGists: new(0), + DiskUsage: new(0), + Collaborators: new(0), + TwoFactorAuthentication: new(false), Plan: &Plan{}, - BusinessPlus: Ptr(false), - LdapDn: Ptr(""), - URL: Ptr(""), - EventsURL: Ptr(""), - FollowingURL: Ptr(""), - FollowersURL: Ptr(""), - GistsURL: Ptr(""), - OrganizationsURL: Ptr(""), - ReceivedEventsURL: Ptr(""), - ReposURL: Ptr(""), - StarredURL: Ptr(""), - SubscriptionsURL: Ptr(""), + BusinessPlus: new(false), + LdapDn: new(""), + URL: new(""), + EventsURL: new(""), + FollowingURL: new(""), + FollowersURL: new(""), + GistsURL: new(""), + OrganizationsURL: new(""), + ReceivedEventsURL: new(""), + ReposURL: new(""), + StarredURL: new(""), + SubscriptionsURL: new(""), Permissions: &RepositoryPermissions{}, - RoleName: Ptr(""), - Assignment: Ptr(""), - Role: Ptr(""), - Inherited: Ptr(false), + RoleName: new(""), + Assignment: new(""), + Role: new(""), + Inherited: new(false), } want := `github.User{Login:"", ID:0, UserViewType:"", NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", NotificationEmail:"", Hireable:false, Bio:"", TwitterUsername:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, BusinessPlus:false, LdapDn:"", URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:"", Permissions:github.RepositoryPermissions{}, RoleName:"", Assignment:"", Role:"", Inherited:false}` if got := v.String(); got != want { @@ -2479,23 +2479,23 @@ func TestUser_String(t *testing.T) { func TestUserLDAPMapping_String(t *testing.T) { t.Parallel() v := UserLDAPMapping{ - ID: Ptr(int64(0)), - LDAPDN: Ptr(""), - Login: Ptr(""), - AvatarURL: Ptr(""), - GravatarID: Ptr(""), - Type: Ptr(""), - SiteAdmin: Ptr(false), - URL: Ptr(""), - EventsURL: Ptr(""), - FollowingURL: Ptr(""), - FollowersURL: Ptr(""), - GistsURL: Ptr(""), - OrganizationsURL: Ptr(""), - ReceivedEventsURL: Ptr(""), - ReposURL: Ptr(""), - StarredURL: Ptr(""), - SubscriptionsURL: Ptr(""), + ID: new(int64(0)), + LDAPDN: new(""), + Login: new(""), + AvatarURL: new(""), + GravatarID: new(""), + Type: new(""), + SiteAdmin: new(false), + URL: new(""), + EventsURL: new(""), + FollowingURL: new(""), + FollowersURL: new(""), + GistsURL: new(""), + OrganizationsURL: new(""), + ReceivedEventsURL: new(""), + ReposURL: new(""), + StarredURL: new(""), + SubscriptionsURL: new(""), } want := `github.UserLDAPMapping{ID:0, LDAPDN:"", Login:"", AvatarURL:"", GravatarID:"", Type:"", SiteAdmin:false, URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:""}` if got := v.String(); got != want { @@ -2506,14 +2506,14 @@ func TestUserLDAPMapping_String(t *testing.T) { func TestUserMigration_String(t *testing.T) { t.Parallel() v := UserMigration{ - ID: Ptr(int64(0)), - GUID: Ptr(""), - State: Ptr(""), - LockRepositories: Ptr(false), - ExcludeAttachments: Ptr(false), - URL: Ptr(""), - CreatedAt: Ptr(""), - UpdatedAt: Ptr(""), + ID: new(int64(0)), + GUID: new(""), + State: new(""), + LockRepositories: new(false), + ExcludeAttachments: new(false), + URL: new(""), + CreatedAt: new(""), + UpdatedAt: new(""), } want := `github.UserMigration{ID:0, GUID:"", State:"", LockRepositories:false, ExcludeAttachments:false, URL:"", CreatedAt:"", UpdatedAt:""}` if got := v.String(); got != want { @@ -2524,9 +2524,9 @@ func TestUserMigration_String(t *testing.T) { func TestUserStats_String(t *testing.T) { t.Parallel() v := UserStats{ - TotalUsers: Ptr(0), - AdminUsers: Ptr(0), - SuspendedUsers: Ptr(0), + TotalUsers: new(0), + AdminUsers: new(0), + SuspendedUsers: new(0), } want := `github.UserStats{TotalUsers:0, AdminUsers:0, SuspendedUsers:0}` if got := v.String(); got != want { @@ -2538,7 +2538,7 @@ func TestWeeklyCommitActivity_String(t *testing.T) { t.Parallel() v := WeeklyCommitActivity{ Days: []int{0}, - Total: Ptr(0), + Total: new(0), Week: &Timestamp{}, } want := `github.WeeklyCommitActivity{Days:[0], Total:0, Week:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` @@ -2551,9 +2551,9 @@ func TestWeeklyStats_String(t *testing.T) { t.Parallel() v := WeeklyStats{ Week: &Timestamp{}, - Additions: Ptr(0), - Deletions: Ptr(0), - Commits: Ptr(0), + Additions: new(0), + Deletions: new(0), + Commits: new(0), } want := `github.WeeklyStats{Week:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Additions:0, Deletions:0, Commits:0}` if got := v.String(); got != want { @@ -2564,10 +2564,10 @@ func TestWeeklyStats_String(t *testing.T) { func TestWorkflowsPermissions_String(t *testing.T) { t.Parallel() v := WorkflowsPermissions{ - RunWorkflowsFromForkPullRequests: Ptr(false), - SendWriteTokensToWorkflows: Ptr(false), - SendSecretsAndVariables: Ptr(false), - RequireApprovalForForkPRWorkflows: Ptr(false), + RunWorkflowsFromForkPullRequests: new(false), + SendWriteTokensToWorkflows: new(false), + SendSecretsAndVariables: new(false), + RequireApprovalForForkPRWorkflows: new(false), } want := `github.WorkflowsPermissions{RunWorkflowsFromForkPullRequests:false, SendWriteTokensToWorkflows:false, SendSecretsAndVariables:false, RequireApprovalForForkPRWorkflows:false}` if got := v.String(); got != want { diff --git a/github/github.go b/github/github.go index 52adada5880..9e2b13bfe3c 100644 --- a/github/github.go +++ b/github/github.go @@ -2168,6 +2168,8 @@ func (c *Client) checkRedirectHost(location string) error { // Ptr is a helper routine that allocates a new T value // to store v and returns a pointer to it. // +// Deprecated: use the new builtin instead. +// //go:fix inline func Ptr[T any](v T) *T { return new(v) diff --git a/github/github_test.go b/github/github_test.go index 393e9250390..b213d5abe8c 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -969,7 +969,7 @@ func Test_newClient(t *testing.T) { opts: clientOptions{ httpClient: &http.Client{Transport: &http.Transport{IdleConnTimeout: 5 * time.Second}}, transport: &http.Transport{IdleConnTimeout: 10 * time.Second}, - timeout: Ptr(15 * time.Second), + timeout: new(15 * time.Second), apiVersionMin: new(api20221128), apiVersionMax: new(api20221128), userAgent: new("CustomUserAgent/1.0"), @@ -977,7 +977,7 @@ func Test_newClient(t *testing.T) { uploadURL: mustParseURL(t, "https://custom-upload-url/api/uploads/"), disableRateLimitCheck: true, rateLimitRedirectionalEndpoints: true, - maxSecondaryRateLimitRetryAfterDuration: Ptr(2 * time.Minute), + maxSecondaryRateLimitRetryAfterDuration: new(2 * time.Minute), }, wantErr: "", }, @@ -986,7 +986,7 @@ func Test_newClient(t *testing.T) { opts: clientOptions{ disableRateLimitCheck: false, rateLimitRedirectionalEndpoints: true, - maxSecondaryRateLimitRetryAfterDuration: Ptr(2 * time.Minute), + maxSecondaryRateLimitRetryAfterDuration: new(2 * time.Minute), }, wantErr: "", }, diff --git a/scrape/apps_test.go b/scrape/apps_test.go index 9e557ab83b4..1440a4d144a 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -10,7 +10,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v90/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { @@ -99,7 +98,7 @@ func Test_CreateApp(t *testing.T) { }) resp, err := client.CreateApp(&AppManifest{ - URL: github.Ptr("https://example.com"), + URL: new("https://example.com"), HookAttributes: map[string]string{ "url": "https://example.com/hook", }, @@ -121,7 +120,7 @@ func Test_CreateAppWithOrg(t *testing.T) { }) if _, err := client.CreateApp(&AppManifest{ - URL: github.Ptr("https://example.com"), + URL: new("https://example.com"), HookAttributes: map[string]string{ "url": "https://example.com/hook", }, diff --git a/scrape/go.mod b/scrape/go.mod index 1da1a25bd87..f69e7ce3066 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/scrape -go 1.25.0 +go 1.26.0 require ( github.com/PuerkitoBio/goquery v1.12.0 diff --git a/test/integration/users_test.go b/test/integration/users_test.go index 22c70bf9d35..53e847aad45 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -209,10 +209,10 @@ func TestUsers_Keys(t *testing.T) { // Verify that fetching individual key works k, _, err := client.Users.GetKey(t.Context(), id) if err != nil { - t.Fatalf("Users.GetKey(%d) returned error: %v", id, err) + t.Fatalf("Users.GetKey(%v) returned error: %v", id, err) } if *k.Key != key { - t.Fatalf("Users.GetKey(%d) returned key %v, want %v", id, *k.Key, key) + t.Fatalf("Users.GetKey(%v) returned key %v, want %v", id, *k.Key, key) } // Remove test key diff --git a/tools/check-structfield-settings/go.mod b/tools/check-structfield-settings/go.mod index 11a20b269a1..f93fd3f0988 100644 --- a/tools/check-structfield-settings/go.mod +++ b/tools/check-structfield-settings/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/v90/tools/check-structfield-settings -go 1.25.0 +go 1.26.0 require ( github.com/golangci/plugin-module-register v0.1.2 diff --git a/tools/extraneousnew/go.mod b/tools/extraneousnew/go.mod index 77409cf6a38..ef67be985e8 100644 --- a/tools/extraneousnew/go.mod +++ b/tools/extraneousnew/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/v90/tools/extraneousnew -go 1.25.0 +go 1.26.0 require ( github.com/golangci/plugin-module-register v0.1.2 diff --git a/tools/fmtpercentv/go.mod b/tools/fmtpercentv/go.mod index a930070f607..2ec8d70d7f7 100644 --- a/tools/fmtpercentv/go.mod +++ b/tools/fmtpercentv/go.mod @@ -1,6 +1,6 @@ module tools/fmtpercentv -go 1.25.0 +go 1.26.0 require ( github.com/golangci/plugin-module-register v0.1.2 diff --git a/tools/paramcheck/go.mod b/tools/paramcheck/go.mod index 94099cbe7be..426d1a7db42 100644 --- a/tools/paramcheck/go.mod +++ b/tools/paramcheck/go.mod @@ -1,6 +1,6 @@ module tools/paramcheck -go 1.25.0 +go 1.26.0 require ( github.com/golangci/plugin-module-register v0.1.2 diff --git a/tools/redundantptr/go.mod b/tools/redundantptr/go.mod index 3caf7d1d8b2..4b989304529 100644 --- a/tools/redundantptr/go.mod +++ b/tools/redundantptr/go.mod @@ -1,6 +1,6 @@ module tools/redundantptr -go 1.25.0 +go 1.26.0 require ( github.com/golangci/plugin-module-register v0.1.2 diff --git a/tools/sliceofpointers/go.mod b/tools/sliceofpointers/go.mod index aba8ab577a5..725bc9e0e4d 100644 --- a/tools/sliceofpointers/go.mod +++ b/tools/sliceofpointers/go.mod @@ -1,6 +1,6 @@ module tools/sliceofpointers -go 1.25.0 +go 1.26.0 require ( github.com/golangci/plugin-module-register v0.1.2 diff --git a/tools/structfield/go.mod b/tools/structfield/go.mod index 8df68cff6ce..5b937807e3d 100644 --- a/tools/structfield/go.mod +++ b/tools/structfield/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/v90/tools/structfield -go 1.25.0 +go 1.26.0 require ( github.com/golangci/plugin-module-register v0.1.2