From 5ea12860f4ce39179cd9e1d1d4c739d5a49d006f Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Fri, 22 Nov 2024 14:56:35 +0200 Subject: [PATCH 1/2] feat: add github.Ptr to use instead of Bool,Int64,String --- github/github.go | 10 ++++++++++ github/github_test.go | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/github/github.go b/github/github.go index 042a0b52e7a..ecbffe054ca 100644 --- a/github/github.go +++ b/github/github.go @@ -1579,20 +1579,30 @@ func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u stri return resp, err } +// Ptr is a helper routine that allocates a new T value +// to store v and returns a pointer to it. +func Ptr[T any](v T) *T { + return &v +} + // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. +// Ptr can be used instead. func Bool(v bool) *bool { return &v } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. +// Ptr can be used instead. func Int(v int) *int { return &v } // Int64 is a helper routine that allocates a new int64 value // to store v and returns a pointer to it. +// Ptr can be used instead. func Int64(v int64) *int64 { return &v } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. +// Ptr can be used instead. func String(v string) *string { return &v } // roundTripperFunc creates a RoundTripper (transport). diff --git a/github/github_test.go b/github/github_test.go index 73afa2d1968..695d188ab7e 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -2878,3 +2878,18 @@ func TestClientCopy_leak_transport(t *testing.T) { assertNoDiff(t, "Bearer bob", bob.GetLogin()) } + +func TestPtr(t *testing.T) { + t.Parallel() + equal := func(t *testing.T, want, got any) { + t.Helper() + if !reflect.DeepEqual(want, got) { + t.Errorf("want %#v, got %#v", want, got) + } + } + + equal(t, true, *Ptr(true)) + equal(t, int(10), *Ptr(int(10))) + equal(t, int64(-10), *Ptr(int64(-10))) + equal(t, "str", *Ptr("str")) +} From d2545da66f788d1f87ac853160466d40394e0e5e Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Fri, 22 Nov 2024 20:39:17 +0200 Subject: [PATCH 2/2] feat: Deprecate and replace Bool,Int,Int64,String with Ptr using generics --- README.md | 4 +- example/actionpermissions/main.go | 6 +- example/commitpr/main.go | 6 +- example/newfilewithappauth/main.go | 2 +- github/actions_artifacts_test.go | 66 +- github/actions_cache_test.go | 38 +- github/actions_oidc_test.go | 8 +- github/actions_permissions_enterprise_test.go | 22 +- github/actions_permissions_orgs_test.go | 32 +- github/actions_required_workflows_test.go | 60 +- github/actions_runner_groups_test.go | 142 +- github/actions_runners_test.go | 116 +- github/actions_secrets.go | 2 +- github/actions_secrets_test.go | 40 +- github/actions_variables_test.go | 26 +- github/actions_workflow_jobs_test.go | 108 +- github/actions_workflow_runs_test.go | 494 +- github/actions_workflows_test.go | 70 +- github/activity_events_test.go | 24 +- github/activity_notifications_test.go | 42 +- github/activity_star_test.go | 44 +- github/activity_test.go | 112 +- github/activity_watching_test.go | 24 +- github/admin_orgs_test.go | 26 +- github/admin_stats_test.go | 204 +- github/admin_test.go | 136 +- github/admin_users_test.go | 58 +- github/apps.go | 2 +- github/apps_hooks_deliveries_test.go | 6 +- github/apps_hooks_test.go | 24 +- github/apps_installation_test.go | 14 +- github/apps_manifest_test.go | 64 +- github/apps_marketplace_test.go | 166 +- github/apps_test.go | 616 +- github/authorizations_test.go | 92 +- github/billing_test.go | 8 +- github/checks_test.go | 692 +- github/code_scanning_test.go | 630 +- github/codesofconduct_test.go | 22 +- github/codespaces_secrets_test.go | 10 +- github/codespaces_test.go | 84 +- github/copilot_test.go | 324 +- github/dependabot_alerts_test.go | 30 +- github/dependabot_secrets_test.go | 14 +- github/dependency_graph_snapshots_test.go | 42 +- github/dependency_graph_test.go | 6 +- github/doc.go | 4 +- .../enterprise_actions_runner_groups_test.go | 148 +- github/enterprise_actions_runners_test.go | 26 +- github/enterprise_audit_log_test.go | 14 +- ...erprise_code_security_and_analysis_test.go | 20 +- github/event_test.go | 66 +- github/event_types_test.go | 13610 ++++++++-------- github/examples_test.go | 16 +- github/gen-stringify-test.go | 19 +- github/gists_comments_test.go | 46 +- github/gists_test.go | 202 +- github/git_blobs_test.go | 24 +- github/git_commits_test.go | 164 +- github/git_refs.go | 2 +- github/git_refs_test.go | 156 +- github/git_tags_test.go | 50 +- github/git_trees_test.go | 118 +- github/github-stringify_test.go | 1720 +- github/github.go | 12 +- github/github_test.go | 2 +- github/gitignore_test.go | 6 +- github/interactions_orgs.go | 2 +- github/interactions_orgs_test.go | 6 +- github/interactions_repos.go | 2 +- github/interactions_repos_test.go | 6 +- github/interactions_test.go | 4 +- github/issue_import_test.go | 68 +- github/issues_assignees_test.go | 6 +- github/issues_comments_test.go | 66 +- github/issues_events_test.go | 300 +- github/issues_labels_test.go | 36 +- github/issues_milestones_test.go | 66 +- github/issues_test.go | 104 +- github/issues_timeline_test.go | 132 +- github/licenses_test.go | 70 +- github/markdown.go | 6 +- github/markdown_test.go | 12 +- github/meta_test.go | 4 +- github/migrations.go | 4 +- github/migrations_source_import_test.go | 106 +- github/migrations_test.go | 46 +- github/migrations_user.go | 4 +- github/migrations_user_test.go | 46 +- github/orgs_actions_allowed_test.go | 6 +- github/orgs_actions_permissions_test.go | 6 +- github/orgs_audit_log_test.go | 62 +- .../orgs_codesecurity_configurations_test.go | 34 +- github/orgs_credential_authorizations_test.go | 8 +- github/orgs_custom_repository_roles_test.go | 42 +- github/orgs_hooks_configuration_test.go | 16 +- github/orgs_hooks_deliveries_test.go | 6 +- github/orgs_hooks_test.go | 8 +- github/orgs_members_test.go | 208 +- github/orgs_organization_roles_test.go | 64 +- github/orgs_outside_collaborators_test.go | 2 +- github/orgs_packages_test.go | 90 +- github/orgs_personal_access_tokens_test.go | 48 +- github/orgs_projects_test.go | 6 +- github/orgs_properties_test.go | 58 +- github/orgs_rules_test.go | 242 +- github/orgs_security_managers_test.go | 2 +- github/orgs_test.go | 74 +- github/orgs_users_blocking_test.go | 2 +- github/packages_test.go | 472 +- github/projects_test.go | 208 +- github/pulls_comments_test.go | 104 +- github/pulls_reviewers_test.go | 66 +- github/pulls_reviews_test.go | 118 +- github/pulls_test.go | 542 +- github/pulls_threads_test.go | 90 +- github/reactions.go | 14 +- github/reactions_test.go | 52 +- github/repos_actions_access_test.go | 6 +- github/repos_actions_allowed_test.go | 6 +- github/repos_actions_permissions_test.go | 18 +- github/repos_autolinks_test.go | 32 +- github/repos_codeowners_test.go | 6 +- github/repos_collaborators_test.go | 140 +- github/repos_comments_test.go | 82 +- github/repos_commits_test.go | 246 +- github/repos_community_health_test.go | 184 +- github/repos_contents_test.go | 172 +- .../repos_deployment_branch_policies_test.go | 20 +- .../repos_deployment_protection_rules_test.go | 42 +- github/repos_deployments_test.go | 148 +- github/repos_environments.go | 4 +- github/repos_environments_test.go | 130 +- github/repos_forks_test.go | 6 +- github/repos_hooks_configuration_test.go | 16 +- github/repos_hooks_deliveries_test.go | 32 +- github/repos_hooks_test.go | 108 +- github/repos_invitations_test.go | 30 +- github/repos_keys_test.go | 8 +- github/repos_merging_test.go | 24 +- github/repos_pages_test.go | 166 +- github/repos_prereceive_hooks_test.go | 14 +- github/repos_projects_test.go | 6 +- github/repos_releases_test.go | 162 +- github/repos_rules_test.go | 36 +- github/repos_stats.go | 10 +- github/repos_stats_test.go | 42 +- github/repos_statuses_test.go | 56 +- github/repos_tags_test.go | 8 +- github/repos_test.go | 322 +- github/repos_traffic_test.go | 64 +- github/scim_test.go | 90 +- github/search_test.go | 270 +- github/secret_scanning_test.go | 180 +- github/security_advisories_test.go | 844 +- github/strings_test.go | 94 +- github/teams_discussion_comments_test.go | 96 +- github/teams_discussions_test.go | 196 +- github/teams_members_test.go | 16 +- github/teams_test.go | 308 +- github/users_administration_test.go | 4 +- github/users_blocking_test.go | 2 +- github/users_emails_test.go | 18 +- github/users_followers_test.go | 8 +- github/users_gpg_keys_test.go | 34 +- github/users_keys_test.go | 22 +- github/users_packages_test.go | 112 +- github/users_projects_test.go | 8 +- github/users_ssh_signing_keys_test.go | 16 +- github/users_test.go | 122 +- test/integration/activity_test.go | 2 +- test/integration/github_test.go | 4 +- test/integration/repos_test.go | 22 +- test/integration/users_test.go | 4 +- tools/metadata/main_test.go | 8 +- 175 files changed, 14878 insertions(+), 14877 deletions(-) diff --git a/README.md b/README.md index 1ed18de71f2..0eb2836bc41 100644 --- a/README.md +++ b/README.md @@ -279,8 +279,8 @@ bool, and int values. For example: ```go // create a new private repository named "foo" repo := &github.Repository{ - Name: github.String("foo"), - Private: github.Bool(true), + Name: github.Ptr("foo"), + Private: github.Ptr(true), } client.Repositories.Create(ctx, "", repo) ``` diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index a41561718a2..ce89ea288a6 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -44,7 +44,7 @@ func main() { fmt.Printf("Current ActionsPermissions %s\n", actionsPermissionsRepository.String()) - actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Bool(true), AllowedActions: github.String("selected")} + actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Ptr(true), AllowedActions: github.Ptr("selected")} _, _, err = client.Repositories.EditActionsPermissions(ctx, *owner, *name, *actionsPermissionsRepository) if err != nil { log.Fatal(err) @@ -59,7 +59,7 @@ func main() { fmt.Printf("Current ActionsAllowed %s\n", actionsAllowed.String()) - actionsAllowed = &github.ActionsAllowed{GithubOwnedAllowed: github.Bool(true), VerifiedAllowed: github.Bool(false), PatternsAllowed: []string{"a/b"}} + actionsAllowed = &github.ActionsAllowed{GithubOwnedAllowed: github.Ptr(true), VerifiedAllowed: github.Ptr(false), PatternsAllowed: []string{"a/b"}} _, _, err = client.Repositories.EditActionsAllowed(ctx, *owner, *name, *actionsAllowed) if err != nil { log.Fatal(err) @@ -67,7 +67,7 @@ func main() { fmt.Printf("Current ActionsAllowed %s\n", actionsAllowed.String()) - actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Bool(true), AllowedActions: github.String("all")} + actionsPermissionsRepository = &github.ActionsPermissionsRepository{Enabled: github.Ptr(true), AllowedActions: github.Ptr("all")} _, _, err = client.Repositories.EditActionsPermissions(ctx, *owner, *name, *actionsPermissionsRepository) if err != nil { log.Fatal(err) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 56562beb367..9b104843f50 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -81,7 +81,7 @@ func getRef() (ref *github.Reference, err error) { if baseRef, _, err = client.Git.GetRef(ctx, *sourceOwner, *sourceRepo, "refs/heads/"+*baseBranch); err != nil { return nil, err } - newRef := &github.Reference{Ref: github.String("refs/heads/" + *commitBranch), Object: &github.GitObject{SHA: baseRef.Object.SHA}} + newRef := &github.Reference{Ref: github.Ptr("refs/heads/" + *commitBranch), Object: &github.GitObject{SHA: baseRef.Object.SHA}} ref, _, err = client.Git.CreateRef(ctx, *sourceOwner, *sourceRepo, newRef) return ref, err } @@ -98,7 +98,7 @@ func getTree(ref *github.Reference) (tree *github.Tree, err error) { if err != nil { return nil, err } - entries = append(entries, &github.TreeEntry{Path: github.String(file), Type: github.String("blob"), Content: github.String(string(content)), Mode: github.String("100644")}) + entries = append(entries, &github.TreeEntry{Path: github.Ptr(file), Type: github.Ptr("blob"), Content: github.Ptr(string(content)), Mode: github.Ptr("100644")}) } tree, _, err = client.Git.CreateTree(ctx, *sourceOwner, *sourceRepo, *ref.Object.SHA, entries) @@ -190,7 +190,7 @@ func createPR() (err error) { HeadRepo: repoBranch, Base: prBranch, Body: prDescription, - MaintainerCanModify: github.Bool(true), + MaintainerCanModify: github.Ptr(true), } pr, _, err := client.PullRequests.Create(ctx, *prRepoOwner, *prRepo, newPR) diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index fd4f4d76ff0..3581fd1cda5 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -79,7 +79,7 @@ func main() { "example/foo.txt", &github.RepositoryContentFileOptions{ Content: []byte("foo"), - Message: github.String("sample commit"), + Message: github.Ptr("sample commit"), SHA: nil, }) if err != nil { diff --git a/github/actions_artifacts_test.go b/github/actions_artifacts_test.go index 751b6e26ca2..5ac5a8f2bd1 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: String("TheArtifact"), + Name: Ptr("TheArtifact"), ListOptions: ListOptions{Page: 2}, } ctx := context.Background() @@ -41,7 +41,7 @@ func TestActionsService_ListArtifacts(t *testing.T) { t.Errorf("Actions.ListArtifacts returned error: %v", err) } - want := &ArtifactList{TotalCount: Int64(1), Artifacts: []*Artifact{{ID: Int64(1)}}} + want := &ArtifactList{TotalCount: Ptr(int64(1)), Artifacts: []*Artifact{{ID: Ptr(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: Int64(1), Artifacts: []*Artifact{{ID: Int64(1)}}} + want := &ArtifactList{TotalCount: Ptr(int64(1)), Artifacts: []*Artifact{{ID: Ptr(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: Int64(1), - NodeID: String("xyz"), - Name: String("a"), - SizeInBytes: Int64(5), - ArchiveDownloadURL: String("u"), + ID: Ptr(int64(1)), + NodeID: Ptr("xyz"), + Name: Ptr("a"), + SizeInBytes: Ptr(int64(5)), + ArchiveDownloadURL: Ptr("u"), } if !cmp.Equal(artifact, want) { t.Errorf("Actions.GetArtifact returned %+v, want %+v", artifact, want) @@ -438,22 +438,22 @@ func TestArtifact_Marshal(t *testing.T) { testJSONMarshal(t, &Artifact{}, "{}") u := &Artifact{ - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - SizeInBytes: Int64(1), - URL: String("u"), - ArchiveDownloadURL: String("a"), - Expired: Bool(false), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + SizeInBytes: Ptr(int64(1)), + URL: Ptr("u"), + ArchiveDownloadURL: Ptr("a"), + Expired: Ptr(false), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, ExpiresAt: &Timestamp{referenceTime}, WorkflowRun: &ArtifactWorkflowRun{ - ID: Int64(1), - RepositoryID: Int64(1), - HeadRepositoryID: Int64(1), - HeadBranch: String("b"), - HeadSHA: String("s"), + ID: Ptr(int64(1)), + RepositoryID: Ptr(int64(1)), + HeadRepositoryID: Ptr(int64(1)), + HeadBranch: Ptr("b"), + HeadSHA: Ptr("s"), }, } @@ -485,25 +485,25 @@ func TestArtifactList_Marshal(t *testing.T) { testJSONMarshal(t, &ArtifactList{}, "{}") u := &ArtifactList{ - TotalCount: Int64(1), + TotalCount: Ptr(int64(1)), Artifacts: []*Artifact{ { - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - SizeInBytes: Int64(1), - URL: String("u"), - ArchiveDownloadURL: String("a"), - Expired: Bool(false), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + SizeInBytes: Ptr(int64(1)), + URL: Ptr("u"), + ArchiveDownloadURL: Ptr("a"), + Expired: Ptr(false), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, ExpiresAt: &Timestamp{referenceTime}, WorkflowRun: &ArtifactWorkflowRun{ - ID: Int64(1), - RepositoryID: Int64(1), - HeadRepositoryID: Int64(1), - HeadBranch: String("b"), - HeadSHA: String("s"), + ID: Ptr(int64(1)), + RepositoryID: Ptr(int64(1)), + HeadRepositoryID: Ptr(int64(1)), + HeadBranch: Ptr("b"), + HeadSHA: Ptr("s"), }, }, }, diff --git a/github/actions_cache_test.go b/github/actions_cache_test.go index cac64065c0f..4831b612c4a 100644 --- a/github/actions_cache_test.go +++ b/github/actions_cache_test.go @@ -36,7 +36,7 @@ func TestActionsService_ListCaches(t *testing.T) { t.Errorf("Actions.ListCaches returned error: %v", err) } - want := &ActionsCacheList{TotalCount: 1, ActionsCaches: []*ActionsCache{{ID: Int64(1)}}} + want := &ActionsCacheList{TotalCount: 1, ActionsCaches: []*ActionsCache{{ID: Ptr(int64(1))}}} if !cmp.Equal(cacheList, want) { t.Errorf("Actions.ListCaches returned %+v, want %+v", cacheList, want) } @@ -106,19 +106,19 @@ func TestActionsService_DeleteCachesByKey(t *testing.T) { }) ctx := context.Background() - _, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", String("main")) + _, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("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", String("\n")) + _, err = client.Actions.DeleteCachesByKey(ctx, "\n", "\n", "\n", Ptr("\n")) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", String("main")) + return client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main")) }) } @@ -127,7 +127,7 @@ func TestActionsService_DeleteCachesByKey_invalidOwner(t *testing.T) { client, _, _ := setup(t) ctx := context.Background() - _, err := client.Actions.DeleteCachesByKey(ctx, "%", "r", "1", String("main")) + _, err := client.Actions.DeleteCachesByKey(ctx, "%", "r", "1", Ptr("main")) testURLParseError(t, err) } @@ -136,7 +136,7 @@ func TestActionsService_DeleteCachesByKey_invalidRepo(t *testing.T) { client, _, _ := setup(t) ctx := context.Background() - _, err := client.Actions.DeleteCachesByKey(ctx, "o", "%", "1", String("main")) + _, err := client.Actions.DeleteCachesByKey(ctx, "o", "%", "1", Ptr("main")) testURLParseError(t, err) } func TestActionsService_DeleteCachesByKey_notFound(t *testing.T) { @@ -149,7 +149,7 @@ func TestActionsService_DeleteCachesByKey_notFound(t *testing.T) { }) ctx := context.Background() - resp, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", String("main")) + resp, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main")) if err == nil { t.Errorf("Expected HTTP 404 response") } @@ -521,13 +521,13 @@ func TestActionsCache_Marshal(t *testing.T) { testJSONMarshal(t, &ActionsCache{}, "{}") u := &ActionsCache{ - ID: Int64(1), - Ref: String("refAction"), - Key: String("key1"), - Version: String("alpha"), + ID: Ptr(int64(1)), + Ref: Ptr("refAction"), + Key: Ptr("key1"), + Version: Ptr("alpha"), LastAccessedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, - SizeInBytes: Int64(1), + SizeInBytes: Ptr(int64(1)), } want := `{ @@ -551,19 +551,19 @@ func TestActionsCacheList_Marshal(t *testing.T) { TotalCount: 2, ActionsCaches: []*ActionsCache{ { - ID: Int64(1), - Key: String("key1"), - Version: String("alpha"), + ID: Ptr(int64(1)), + Key: Ptr("key1"), + Version: Ptr("alpha"), LastAccessedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, - SizeInBytes: Int64(1), + SizeInBytes: Ptr(int64(1)), }, { - ID: Int64(2), - Ref: String("refAction"), + ID: Ptr(int64(2)), + Ref: Ptr("refAction"), LastAccessedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, - SizeInBytes: Int64(1), + SizeInBytes: Ptr(int64(1)), }, }, } diff --git a/github/actions_oidc_test.go b/github/actions_oidc_test.go index 4ad00a75371..dd8764946f0 100644 --- a/github/actions_oidc_test.go +++ b/github/actions_oidc_test.go @@ -64,7 +64,7 @@ func TestActionsService_GetRepoOIDCSubjectClaimCustomTemplate(t *testing.T) { t.Errorf("Actions.GetRepoOIDCSubjectClaimCustomTemplate returned error: %v", err) } - want := &OIDCSubjectClaimCustomTemplate{UseDefault: Bool(false), IncludeClaimKeys: []string{"repo", "context"}} + want := &OIDCSubjectClaimCustomTemplate{UseDefault: Ptr(false), IncludeClaimKeys: []string{"repo", "context"}} if !cmp.Equal(template, want) { t.Errorf("Actions.GetOrgOIDCSubjectClaimCustomTemplate returned %+v, want %+v", template, want) } @@ -128,7 +128,7 @@ func TestActionsService_SetRepoOIDCSubjectClaimCustomTemplate(t *testing.T) { }) input := &OIDCSubjectClaimCustomTemplate{ - UseDefault: Bool(false), + UseDefault: Ptr(false), IncludeClaimKeys: []string{"repo", "context"}, } ctx := context.Background() @@ -161,7 +161,7 @@ func TestActionService_SetRepoOIDCSubjectClaimCustomTemplateToDefault(t *testing }) input := &OIDCSubjectClaimCustomTemplate{ - UseDefault: Bool(true), + UseDefault: Ptr(true), } ctx := context.Background() _, err := client.Actions.SetRepoOIDCSubjectClaimCustomTemplate(ctx, "o", "r", input) @@ -185,7 +185,7 @@ func TestOIDCSubjectClaimCustomTemplate_Marshal(t *testing.T) { testJSONMarshal(t, &OIDCSubjectClaimCustomTemplate{}, "{}") u := &OIDCSubjectClaimCustomTemplate{ - UseDefault: Bool(false), + UseDefault: Ptr(false), IncludeClaimKeys: []string{"s"}, } diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index 3ec9ab1163a..30c29a38eb3 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -29,7 +29,7 @@ func TestActionsService_GetActionsPermissionsInEnterprise(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsPermissionsInEnterprise returned error: %v", err) } - want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("all")} + want := &ActionsPermissionsEnterprise{EnabledOrganizations: Ptr("all"), AllowedActions: Ptr("all")} if !cmp.Equal(ent, want) { t.Errorf("Actions.GetActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) } @@ -53,7 +53,7 @@ func TestActionsService_EditActionsPermissionsInEnterprise(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("selected")} + input := &ActionsPermissionsEnterprise{EnabledOrganizations: Ptr("all"), AllowedActions: Ptr("selected")} mux.HandleFunc("/enterprises/e/actions/permissions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsPermissionsEnterprise) @@ -73,7 +73,7 @@ func TestActionsService_EditActionsPermissionsInEnterprise(t *testing.T) { t.Errorf("Actions.EditActionsPermissionsInEnterprise returned error: %v", err) } - want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("selected")} + want := &ActionsPermissionsEnterprise{EnabledOrganizations: Ptr("all"), AllowedActions: Ptr("selected")} if !cmp.Equal(ent, want) { t.Errorf("Actions.EditActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) } @@ -115,8 +115,8 @@ func TestActionsService_ListEnabledOrgsInEnterprise(t *testing.T) { } want := &ActionsEnabledOnEnterpriseRepos{TotalCount: int(2), Organizations: []*Organization{ - {ID: Int64(2)}, - {ID: Int64(3)}, + {ID: Ptr(int64(2))}, + {ID: Ptr(int64(3))}, }} if !cmp.Equal(got, want) { t.Errorf("Actions.ListEnabledOrgsInEnterprise returned %+v, want %+v", got, want) @@ -234,7 +234,7 @@ func TestActionsService_GetActionsAllowedInEnterprise(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsAllowedInEnterprise returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(ent, want) { t.Errorf("Actions.GetActionsAllowedInEnterprise returned %+v, want %+v", ent, want) } @@ -258,7 +258,7 @@ func TestActionsService_EditActionsAllowedInEnterprise(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/enterprises/e/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsAllowed) @@ -278,7 +278,7 @@ func TestActionsService_EditActionsAllowedInEnterprise(t *testing.T) { t.Errorf("Actions.EditActionsAllowedInEnterprise returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(ent, want) { t.Errorf("Actions.EditActionsAllowedInEnterprise returned %+v, want %+v", ent, want) } @@ -312,7 +312,7 @@ func TestActionsService_GetDefaultWorkflowPermissionsInEnterprise(t *testing.T) if err != nil { t.Errorf("Actions.GetDefaultWorkflowPermissionsInEnterprise returned error: %v", err) } - want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} if !cmp.Equal(ent, want) { t.Errorf("Actions.GetDefaultWorkflowPermissionsInEnterprise returned %+v, want %+v", ent, want) } @@ -336,7 +336,7 @@ func TestActionsService_EditDefaultWorkflowPermissionsInEnterprise(t *testing.T) t.Parallel() client, mux, _ := setup(t) - input := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + input := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} mux.HandleFunc("/enterprises/e/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { v := new(DefaultWorkflowPermissionEnterprise) @@ -356,7 +356,7 @@ func TestActionsService_EditDefaultWorkflowPermissionsInEnterprise(t *testing.T) t.Errorf("Actions.EditDefaultWorkflowPermissionsInEnterprise returned error: %v", err) } - want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} if !cmp.Equal(ent, want) { t.Errorf("Actions.EditDefaultWorkflowPermissionsInEnterprise returned %+v, want %+v", ent, want) } diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index 4b778400fcb..c485b749b4b 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -29,7 +29,7 @@ func TestActionsService_GetActionsPermissions(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("all")} + want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("all")} if !cmp.Equal(org, want) { t.Errorf("Actions.GetActionsPermissions returned %+v, want %+v", org, want) } @@ -53,7 +53,7 @@ func TestActionsService_EditActionsPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("selected")} + input := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected")} mux.HandleFunc("/orgs/o/actions/permissions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsPermissions) @@ -73,7 +73,7 @@ func TestActionsService_EditActionsPermissions(t *testing.T) { t.Errorf("Actions.EditActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("selected")} + want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected")} if !cmp.Equal(org, want) { t.Errorf("Actions.EditActionsPermissions returned %+v, want %+v", org, want) } @@ -115,8 +115,8 @@ func TestActionsService_ListEnabledReposInOrg(t *testing.T) { } want := &ActionsEnabledOnOrgRepos{TotalCount: int(2), Repositories: []*Repository{ - {ID: Int64(2)}, - {ID: Int64(3)}, + {ID: Ptr(int64(2))}, + {ID: Ptr(int64(3))}, }} if !cmp.Equal(got, want) { t.Errorf("Actions.ListEnabledRepos returned %+v, want %+v", got, want) @@ -234,7 +234,7 @@ func TestActionsService_GetActionsAllowed(t *testing.T) { if err != nil { t.Errorf("Actions.GetActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Actions.GetActionsAllowed returned %+v, want %+v", org, want) } @@ -258,7 +258,7 @@ func TestActionsService_EditActionsAllowed(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsAllowed) @@ -278,7 +278,7 @@ func TestActionsService_EditActionsAllowed(t *testing.T) { t.Errorf("Actions.EditActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Actions.EditActionsAllowed returned %+v, want %+v", org, want) } @@ -303,8 +303,8 @@ func TestActionsAllowed_Marshal(t *testing.T) { testJSONMarshal(t, &ActionsAllowed{}, "{}") u := &ActionsAllowed{ - GithubOwnedAllowed: Bool(false), - VerifiedAllowed: Bool(false), + GithubOwnedAllowed: Ptr(false), + VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"s"}, } @@ -324,9 +324,9 @@ func TestActionsPermissions_Marshal(t *testing.T) { testJSONMarshal(t, &ActionsPermissions{}, "{}") u := &ActionsPermissions{ - EnabledRepositories: String("e"), - AllowedActions: String("a"), - SelectedActionsURL: String("sau"), + EnabledRepositories: Ptr("e"), + AllowedActions: Ptr("a"), + SelectedActionsURL: Ptr("sau"), } want := `{ @@ -352,7 +352,7 @@ func TestActionsService_GetDefaultWorkflowPermissionsInOrganization(t *testing.T if err != nil { t.Errorf("Actions.GetDefaultWorkflowPermissionsInOrganization returned error: %v", err) } - want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} if !cmp.Equal(org, want) { t.Errorf("Actions.GetDefaultWorkflowPermissionsInOrganization returned %+v, want %+v", org, want) } @@ -376,7 +376,7 @@ func TestActionsService_EditDefaultWorkflowPermissionsInOrganization(t *testing. t.Parallel() client, mux, _ := setup(t) - input := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + input := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} mux.HandleFunc("/orgs/o/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { v := new(DefaultWorkflowPermissionOrganization) @@ -396,7 +396,7 @@ func TestActionsService_EditDefaultWorkflowPermissionsInOrganization(t *testing. t.Errorf("Actions.EditDefaultWorkflowPermissionsInOrganization returned error: %v", err) } - want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} if !cmp.Equal(org, want) { t.Errorf("Actions.EditDefaultWorkflowPermissionsInOrganization returned %+v, want %+v", org, want) } diff --git a/github/actions_required_workflows_test.go b/github/actions_required_workflows_test.go index 98c9b90751e..5d7e72c6883 100644 --- a/github/actions_required_workflows_test.go +++ b/github/actions_required_workflows_test.go @@ -56,10 +56,10 @@ func TestActionsService_ListOrgRequiredWorkflows(t *testing.T) { } want := &OrgRequiredWorkflows{ - TotalCount: Int(4), + TotalCount: Ptr(4), RequiredWorkflows: []*OrgRequiredWorkflow{ - {ID: Int64(30433642), Name: String("Required CI"), Path: String(".github/workflows/ci.yml"), Scope: String("selected"), Ref: String("refs/head/main"), State: String("active"), SelectedRepositoriesURL: String("https://api.github.com/organizations/org/actions/required_workflows/1/repositories"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}}, - {ID: Int64(30433643), Name: String("Required Linter"), Path: String(".github/workflows/lint.yml"), Scope: String("all"), Ref: String("refs/head/main"), State: String("active"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}}, + {ID: Ptr(int64(30433642)), Name: Ptr("Required CI"), Path: Ptr(".github/workflows/ci.yml"), Scope: Ptr("selected"), Ref: Ptr("refs/head/main"), State: Ptr("active"), SelectedRepositoriesURL: Ptr("https://api.github.com/organizations/org/actions/required_workflows/1/repositories"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}}, + {ID: Ptr(int64(30433643)), Name: Ptr("Required Linter"), Path: Ptr(".github/workflows/lint.yml"), Scope: Ptr("all"), Ref: Ptr("refs/head/main"), State: Ptr("active"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}}, }, } if !cmp.Equal(jobs, want) { @@ -104,9 +104,9 @@ func TestActionsService_CreateRequiredWorkflow(t *testing.T) { "url": "https://api.github.com/repos/o/Hello-World"}}`) }) input := &CreateUpdateRequiredWorkflowOptions{ - WorkflowFilePath: String(".github/workflows/ci.yaml"), - RepositoryID: Int64(53), - Scope: String("selected"), + WorkflowFilePath: Ptr(".github/workflows/ci.yaml"), + RepositoryID: Ptr(int64(53)), + Scope: Ptr("selected"), SelectedRepositoryIDs: &SelectedRepoIDs{32, 91}, } ctx := context.Background() @@ -115,16 +115,16 @@ func TestActionsService_CreateRequiredWorkflow(t *testing.T) { t.Errorf("Actions.CreateRequiredWorkflow returned error: %v", err) } want := &OrgRequiredWorkflow{ - ID: Int64(2), - Name: String("Required CI"), - Path: String(".github/workflows/ci.yml"), - Scope: String("selected"), - Ref: String("refs/head/main"), - State: String("active"), - SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/required_workflows/2/repositories"), + ID: Ptr(int64(2)), + Name: Ptr("Required CI"), + Path: Ptr(".github/workflows/ci.yml"), + Scope: Ptr("selected"), + Ref: Ptr("refs/head/main"), + State: Ptr("active"), + SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/required_workflows/2/repositories"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, - Repository: &Repository{ID: Int64(53), URL: String("https://api.github.com/repos/o/Hello-World"), Name: String("Hello-World")}, + Repository: &Repository{ID: Ptr(int64(53)), URL: Ptr("https://api.github.com/repos/o/Hello-World"), Name: Ptr("Hello-World")}, } if !cmp.Equal(requiredWokflow, want) { @@ -177,7 +177,7 @@ func TestActionsService_GetRequiredWorkflowByID(t *testing.T) { } want := &OrgRequiredWorkflow{ - ID: Int64(12345), Name: String("Required CI"), Path: String(".github/workflows/ci.yml"), Scope: String("selected"), Ref: String("refs/head/main"), State: String("active"), SelectedRepositoriesURL: String("https://api.github.com/orgs/o/actions/required_workflows/12345/repositories"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, Repository: &Repository{ID: Int64(1296269), URL: String("https://api.github.com/repos/o/Hello-World"), Name: String("Hello-World")}, + ID: Ptr(int64(12345)), Name: Ptr("Required CI"), Path: Ptr(".github/workflows/ci.yml"), Scope: Ptr("selected"), Ref: Ptr("refs/head/main"), State: Ptr("active"), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/o/actions/required_workflows/12345/repositories"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, Repository: &Repository{ID: Ptr(int64(1296269)), URL: Ptr("https://api.github.com/repos/o/Hello-World"), Name: Ptr("Hello-World")}, } if !cmp.Equal(jobs, want) { t.Errorf("Actions.GetRequiredWorkflowByID returned %+v, want %+v", jobs, want) @@ -221,9 +221,9 @@ func TestActionsService_UpdateRequiredWorkflow(t *testing.T) { "url": "https://api.github.com/repos/o/Hello-World"}}`) }) input := &CreateUpdateRequiredWorkflowOptions{ - WorkflowFilePath: String(".github/workflows/ci.yaml"), - RepositoryID: Int64(53), - Scope: String("selected"), + WorkflowFilePath: Ptr(".github/workflows/ci.yaml"), + RepositoryID: Ptr(int64(53)), + Scope: Ptr("selected"), SelectedRepositoryIDs: &SelectedRepoIDs{32, 91}, } ctx := context.Background() @@ -234,16 +234,16 @@ func TestActionsService_UpdateRequiredWorkflow(t *testing.T) { t.Errorf("Actions.UpdateRequiredWorkflow returned error: %v", err) } want := &OrgRequiredWorkflow{ - ID: Int64(12345), - Name: String("Required CI"), - Path: String(".github/workflows/ci.yml"), - Scope: String("selected"), - Ref: String("refs/head/main"), - State: String("active"), - SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/required_workflows/12345/repositories"), + ID: Ptr(int64(12345)), + Name: Ptr("Required CI"), + Path: Ptr(".github/workflows/ci.yml"), + Scope: Ptr("selected"), + Ref: Ptr("refs/head/main"), + State: Ptr("active"), + SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/required_workflows/12345/repositories"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, - Repository: &Repository{ID: Int64(53), URL: String("https://api.github.com/repos/o/Hello-World"), Name: String("Hello-World")}, + Repository: &Repository{ID: Ptr(int64(53)), URL: Ptr("https://api.github.com/repos/o/Hello-World"), Name: Ptr("Hello-World")}, } if !cmp.Equal(requiredWokflow, want) { @@ -315,9 +315,9 @@ func TestActionsService_ListRequiredWorkflowSelectedRepos(t *testing.T) { } want := &RequiredWorkflowSelectedRepos{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ - {ID: Int64(1296269), URL: String("https://api.github.com/repos/o/Hello-World"), Name: String("Hello-World")}, + {ID: Ptr(int64(1296269)), URL: Ptr("https://api.github.com/repos/o/Hello-World"), Name: Ptr("Hello-World")}, }, } if !cmp.Equal(jobs, want) { @@ -455,9 +455,9 @@ func TestActionsService_ListRepoRequiredWorkflows(t *testing.T) { } want := &RepoRequiredWorkflows{ - TotalCount: Int(1), + TotalCount: Ptr(1), RequiredWorkflows: []*RepoRequiredWorkflow{ - {ID: Int64(30433642), NodeID: String("MDg6V29ya2Zsb3cxNjEzMzU="), Name: String("Required CI"), Path: String(".github/workflows/ci.yml"), State: String("active"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, URL: String("https://api.github.com/repos/o/r/actions/required_workflows/161335"), BadgeURL: String("https://github.com/o/r/workflows/required/o/hello-world/.github/workflows/required_ci.yaml/badge.svg"), HTMLURL: String("https://github.com/o/r/blob/master/o/hello-world/.github/workflows/required_ci.yaml"), SourceRepository: &Repository{ID: Int64(1296269), URL: String("https://api.github.com/repos/o/Hello-World"), Name: String("Hello-World")}}, + {ID: Ptr(int64(30433642)), NodeID: Ptr("MDg6V29ya2Zsb3cxNjEzMzU="), Name: Ptr("Required CI"), Path: Ptr(".github/workflows/ci.yml"), State: Ptr("active"), CreatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 22, 19, 33, 8, 0, time.UTC)}, URL: Ptr("https://api.github.com/repos/o/r/actions/required_workflows/161335"), BadgeURL: Ptr("https://github.com/o/r/workflows/required/o/hello-world/.github/workflows/required_ci.yaml/badge.svg"), HTMLURL: Ptr("https://github.com/o/r/blob/master/o/hello-world/.github/workflows/required_ci.yaml"), SourceRepository: &Repository{ID: Ptr(int64(1296269)), URL: Ptr("https://api.github.com/repos/o/Hello-World"), Name: Ptr("Hello-World")}}, }, } if !cmp.Equal(jobs, want) { diff --git a/github/actions_runner_groups_test.go b/github/actions_runner_groups_test.go index c051bbc1213..c7154b74e0a 100644 --- a/github/actions_runner_groups_test.go +++ b/github/actions_runner_groups_test.go @@ -34,9 +34,9 @@ func TestActionsService_ListOrganizationRunnerGroups(t *testing.T) { want := &RunnerGroups{ TotalCount: 3, RunnerGroups: []*RunnerGroup{ - {ID: Int64(1), Name: String("Default"), Visibility: String("all"), Default: Bool(true), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(true), SelectedWorkflows: []string{"a", "b"}}, - {ID: Int64(2), Name: String("octo-runner-group"), Visibility: String("selected"), Default: Bool(false), SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, - {ID: Int64(3), Name: String("expensive-hardware"), Visibility: String("private"), Default: Bool(false), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + {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{}}, }, } if !cmp.Equal(groups, want) { @@ -78,9 +78,9 @@ func TestActionsService_ListOrganizationRunnerGroupsVisibleToRepo(t *testing.T) want := &RunnerGroups{ TotalCount: 3, RunnerGroups: []*RunnerGroup{ - {ID: Int64(1), Name: String("Default"), Visibility: String("all"), Default: Bool(true), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, - {ID: Int64(2), Name: String("octo-runner-group"), Visibility: String("selected"), Default: Bool(false), SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, - {ID: Int64(3), Name: String("expensive-hardware"), Visibility: String("private"), Default: Bool(false), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + {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{}}, }, } if !cmp.Equal(groups, want) { @@ -118,15 +118,15 @@ func TestActionsService_GetOrganizationRunnerGroup(t *testing.T) { } want := &RunnerGroup{ - ID: Int64(2), - Name: String("octo-runner-group"), - Visibility: String("selected"), - Default: Bool(false), - SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), - RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), - Inherited: Bool(false), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + 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(false), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } @@ -185,10 +185,10 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) { ctx := context.Background() req := CreateRunnerGroupRequest{ - Name: String("octo-runner-group"), - Visibility: String("selected"), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + Name: Ptr("octo-runner-group"), + Visibility: Ptr("selected"), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } group, _, err := client.Actions.CreateOrganizationRunnerGroup(ctx, "o", req) @@ -197,15 +197,15 @@ func TestActionsService_CreateOrganizationRunnerGroup(t *testing.T) { } want := &RunnerGroup{ - ID: Int64(2), - Name: String("octo-runner-group"), - Visibility: String("selected"), - Default: Bool(false), - SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), - RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), - Inherited: Bool(false), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + 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(false), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } @@ -239,10 +239,10 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) { ctx := context.Background() req := UpdateRunnerGroupRequest{ - Name: String("octo-runner-group"), - Visibility: String("selected"), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + Name: Ptr("octo-runner-group"), + Visibility: Ptr("selected"), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } group, _, err := client.Actions.UpdateOrganizationRunnerGroup(ctx, "o", 2, req) @@ -251,15 +251,15 @@ func TestActionsService_UpdateOrganizationRunnerGroup(t *testing.T) { } want := &RunnerGroup{ - ID: Int64(2), - Name: String("octo-runner-group"), - Visibility: String("selected"), - Default: Bool(false), - SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), - RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), - Inherited: Bool(false), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + 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(false), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } @@ -300,9 +300,9 @@ func TestActionsService_ListRepositoryAccessRunnerGroup(t *testing.T) { } want := &ListRepositories{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ - {ID: Int64(43), NodeID: String("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: String("Hello-World"), FullName: String("octocat/Hello-World")}, + {ID: Ptr(int64(43)), NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: Ptr("Hello-World"), FullName: Ptr("octocat/Hello-World")}, }, } if !cmp.Equal(groups, want) { @@ -426,8 +426,8 @@ func TestActionsService_ListRunnerGroupRunners(t *testing.T) { want := &Runners{ TotalCount: 2, Runners: []*Runner{ - {ID: Int64(23), Name: String("MBP"), OS: String("macos"), Status: String("online")}, - {ID: Int64(24), Name: String("iMac"), OS: String("macos"), Status: String("offline")}, + {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")}, }, } if !cmp.Equal(runners, want) { @@ -536,15 +536,15 @@ func TestRunnerGroup_Marshal(t *testing.T) { testJSONMarshal(t, &RunnerGroup{}, "{}") u := &RunnerGroup{ - ID: Int64(1), - Name: String("n"), - Visibility: String("v"), - Default: Bool(true), - SelectedRepositoriesURL: String("s"), - RunnersURL: String("r"), - Inherited: Bool(true), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Visibility: Ptr("v"), + Default: Ptr(true), + SelectedRepositoriesURL: Ptr("s"), + RunnersURL: Ptr("r"), + Inherited: Ptr(true), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } @@ -572,15 +572,15 @@ func TestRunnerGroups_Marshal(t *testing.T) { TotalCount: int(1), RunnerGroups: []*RunnerGroup{ { - ID: Int64(1), - Name: String("n"), - Visibility: String("v"), - Default: Bool(true), - SelectedRepositoriesURL: String("s"), - RunnersURL: String("r"), - Inherited: Bool(true), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Visibility: Ptr("v"), + Default: Ptr(true), + SelectedRepositoriesURL: Ptr("s"), + RunnersURL: Ptr("r"), + Inherited: Ptr(true), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, }, }, @@ -610,12 +610,12 @@ func TestCreateRunnerGroupRequest_Marshal(t *testing.T) { testJSONMarshal(t, &CreateRunnerGroupRequest{}, "{}") u := &CreateRunnerGroupRequest{ - Name: String("n"), - Visibility: String("v"), + Name: Ptr("n"), + Visibility: Ptr("v"), SelectedRepositoryIDs: []int64{1}, Runners: []int64{1}, - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(true), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(true), SelectedWorkflows: []string{"a", "b"}, } @@ -637,10 +637,10 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) { testJSONMarshal(t, &UpdateRunnerGroupRequest{}, "{}") u := &UpdateRunnerGroupRequest{ - Name: String("n"), - Visibility: String("v"), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + Name: Ptr("n"), + Visibility: Ptr("v"), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index 06b824da45b..4c174d3c878 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -32,11 +32,11 @@ func TestActionsService_ListRunnerApplicationDownloads(t *testing.T) { } want := []*RunnerApplicationDownload{ - {OS: String("osx"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: String("actions-runner-osx-x64-2.164.0.tar.gz")}, - {OS: String("linux"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: String("actions-runner-linux-x64-2.164.0.tar.gz")}, - {OS: String("linux"), Architecture: String("arm"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: String("actions-runner-linux-arm-2.164.0.tar.gz")}, - {OS: String("win"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: String("actions-runner-win-x64-2.164.0.zip")}, - {OS: String("linux"), Architecture: String("arm64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: String("actions-runner-linux-arm64-2.164.0.tar.gz")}, + {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")}, } if !cmp.Equal(downloads, want) { t.Errorf("Actions.ListRunnerApplicationDownloads returned %+v, want %+v", downloads, want) @@ -81,7 +81,7 @@ func TestActionsService_GenerateOrgJITConfig(t *testing.T) { t.Errorf("Actions.GenerateOrgJITConfig returned error: %v", err) } - want := &JITRunnerConfig{EncodedJITConfig: String("foo")} + want := &JITRunnerConfig{EncodedJITConfig: Ptr("foo")} if !cmp.Equal(jitConfig, want) { t.Errorf("Actions.GenerateOrgJITConfig returned %+v, want %+v", jitConfig, want) } @@ -125,7 +125,7 @@ func TestActionsService_GenerateRepoJITConfig(t *testing.T) { t.Errorf("Actions.GenerateRepoJITConfig returned error: %v", err) } - want := &JITRunnerConfig{EncodedJITConfig: String("foo")} + want := &JITRunnerConfig{EncodedJITConfig: Ptr("foo")} if !cmp.Equal(jitConfig, want) { t.Errorf("Actions.GenerateRepoJITConfig returned %+v, want %+v", jitConfig, want) } @@ -160,7 +160,7 @@ func TestActionsService_CreateRegistrationToken(t *testing.T) { t.Errorf("Actions.CreateRegistrationToken returned error: %v", err) } - want := &RegistrationToken{Token: String("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), + want := &RegistrationToken{Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 22, 12, 13, 35, 123000000, time.UTC)}} if !cmp.Equal(token, want) { @@ -193,7 +193,7 @@ func TestActionsService_ListRunners(t *testing.T) { }) opts := &ListRunnersOptions{ - Name: String("MBP"), + Name: Ptr("MBP"), ListOptions: ListOptions{Page: 2, PerPage: 2}, } ctx := context.Background() @@ -205,7 +205,7 @@ func TestActionsService_ListRunners(t *testing.T) { want := &Runners{ TotalCount: 1, Runners: []*Runner{ - {ID: Int64(23), Name: String("MBP"), OS: String("macos"), Status: String("online")}, + {ID: Ptr(int64(23)), Name: Ptr("MBP"), OS: Ptr("macos"), Status: Ptr("online")}, }, } if !cmp.Equal(runners, want) { @@ -243,10 +243,10 @@ func TestActionsService_GetRunner(t *testing.T) { } want := &Runner{ - ID: Int64(23), - Name: String("MBP"), - OS: String("macos"), - Status: String("online"), + ID: Ptr(int64(23)), + Name: Ptr("MBP"), + OS: Ptr("macos"), + Status: Ptr("online"), } if !cmp.Equal(runner, want) { t.Errorf("Actions.GetRunner returned %+v, want %+v", runner, want) @@ -282,7 +282,7 @@ func TestActionsService_CreateRemoveToken(t *testing.T) { t.Errorf("Actions.CreateRemoveToken returned error: %v", err) } - want := &RemoveToken{Token: String("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 29, 12, 13, 35, 123000000, time.UTC)}} + want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 29, 12, 13, 35, 123000000, time.UTC)}} if !cmp.Equal(token, want) { t.Errorf("Actions.CreateRemoveToken returned %+v, want %+v", token, want) } @@ -343,11 +343,11 @@ func TestActionsService_ListOrganizationRunnerApplicationDownloads(t *testing.T) } want := []*RunnerApplicationDownload{ - {OS: String("osx"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: String("actions-runner-osx-x64-2.164.0.tar.gz")}, - {OS: String("linux"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: String("actions-runner-linux-x64-2.164.0.tar.gz")}, - {OS: String("linux"), Architecture: String("arm"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: String("actions-runner-linux-arm-2.164.0.tar.gz")}, - {OS: String("win"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: String("actions-runner-win-x64-2.164.0.zip")}, - {OS: String("linux"), Architecture: String("arm64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: String("actions-runner-linux-arm64-2.164.0.tar.gz")}, + {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")}, } if !cmp.Equal(downloads, want) { t.Errorf("Actions.ListOrganizationRunnerApplicationDownloads returned %+v, want %+v", downloads, want) @@ -383,7 +383,7 @@ func TestActionsService_CreateOrganizationRegistrationToken(t *testing.T) { t.Errorf("Actions.CreateRegistrationToken returned error: %v", err) } - want := &RegistrationToken{Token: String("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), + want := &RegistrationToken{Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 22, 12, 13, 35, 123000000, time.UTC)}} if !cmp.Equal(token, want) { @@ -427,8 +427,8 @@ func TestActionsService_ListOrganizationRunners(t *testing.T) { want := &Runners{ TotalCount: 2, Runners: []*Runner{ - {ID: Int64(23), Name: String("MBP"), OS: String("macos"), Status: String("online")}, - {ID: Int64(24), Name: String("iMac"), OS: String("macos"), Status: String("offline")}, + {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")}, }, } if !cmp.Equal(runners, want) { @@ -466,10 +466,10 @@ func TestActionsService_GetOrganizationRunner(t *testing.T) { } want := &Runner{ - ID: Int64(23), - Name: String("MBP"), - OS: String("macos"), - Status: String("online"), + ID: Ptr(int64(23)), + Name: Ptr("MBP"), + OS: Ptr("macos"), + Status: Ptr("online"), } if !cmp.Equal(runner, want) { t.Errorf("Actions.GetRunner returned %+v, want %+v", runner, want) @@ -505,7 +505,7 @@ func TestActionsService_CreateOrganizationRemoveToken(t *testing.T) { t.Errorf("Actions.CreateRemoveToken returned error: %v", err) } - want := &RemoveToken{Token: String("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 29, 12, 13, 35, 123000000, time.UTC)}} + want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 29, 12, 13, 35, 123000000, time.UTC)}} if !cmp.Equal(token, want) { t.Errorf("Actions.CreateRemoveToken returned %+v, want %+v", token, want) } @@ -555,12 +555,12 @@ func TestRunnerApplicationDownload_Marshal(t *testing.T) { testJSONMarshal(t, &RunnerApplicationDownload{}, "{}") u := &RunnerApplicationDownload{ - OS: String("o"), - Architecture: String("a"), - DownloadURL: String("d"), - Filename: String("f"), - TempDownloadToken: String("t"), - SHA256Checksum: String("s"), + OS: Ptr("o"), + Architecture: Ptr("a"), + DownloadURL: Ptr("d"), + Filename: Ptr("f"), + TempDownloadToken: Ptr("t"), + SHA256Checksum: Ptr("s"), } want := `{ @@ -583,9 +583,9 @@ func TestActionsEnabledOnOrgRepos_Marshal(t *testing.T) { TotalCount: 1, Repositories: []*Repository{ { - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, } @@ -609,7 +609,7 @@ func TestRegistrationToken_Marshal(t *testing.T) { testJSONMarshal(t, &RegistrationToken{}, "{}") u := &RegistrationToken{ - Token: String("t"), + Token: Ptr("t"), ExpiresAt: &Timestamp{referenceTime}, } @@ -626,9 +626,9 @@ func TestRunnerLabels_Marshal(t *testing.T) { testJSONMarshal(t, &RunnerLabels{}, "{}") u := &RunnerLabels{ - ID: Int64(1), - Name: String("n"), - Type: String("t"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Type: Ptr("t"), } want := `{ @@ -645,16 +645,16 @@ func TestRunner_Marshal(t *testing.T) { testJSONMarshal(t, &Runner{}, "{}") u := &Runner{ - ID: Int64(1), - Name: String("n"), - OS: String("o"), - Status: String("s"), - Busy: Bool(false), + ID: Ptr(int64(1)), + Name: Ptr("n"), + OS: Ptr("o"), + Status: Ptr("s"), + Busy: Ptr(false), Labels: []*RunnerLabels{ { - ID: Int64(1), - Name: String("n"), - Type: String("t"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Type: Ptr("t"), }, }, } @@ -685,16 +685,16 @@ func TestRunners_Marshal(t *testing.T) { TotalCount: 1, Runners: []*Runner{ { - ID: Int64(1), - Name: String("n"), - OS: String("o"), - Status: String("s"), - Busy: Bool(false), + ID: Ptr(int64(1)), + Name: Ptr("n"), + OS: Ptr("o"), + Status: Ptr("s"), + Busy: Ptr(false), Labels: []*RunnerLabels{ { - ID: Int64(1), - Name: String("n"), - Type: String("t"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Type: Ptr("t"), }, }, }, @@ -729,7 +729,7 @@ func TestRemoveToken_Marshal(t *testing.T) { testJSONMarshal(t, &RemoveToken{}, "{}") u := &RemoveToken{ - Token: String("t"), + Token: Ptr("t"), ExpiresAt: &Timestamp{referenceTime}, } diff --git a/github/actions_secrets.go b/github/actions_secrets.go index ec519838eab..cba85c10042 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 = String(strconv.FormatFloat(v, 'f', -1, 64)) + p.KeyID = Ptr(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 e4cfc68e3db..ebf312f8170 100644 --- a/github/actions_secrets_test.go +++ b/github/actions_secrets_test.go @@ -35,17 +35,17 @@ func TestPublicKey_UnmarshalJSON(t *testing.T) { }, "Numeric KeyID": { data: []byte(`{"key_id":1234,"key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: false, }, "String KeyID": { data: []byte(`{"key_id":"1234","key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: false, }, "Invalid KeyID": { data: []byte(`{"key_id":["1234"],"key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{KeyID: nil, Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{KeyID: nil, Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: true, }, "Invalid Key": { @@ -65,12 +65,12 @@ func TestPublicKey_UnmarshalJSON(t *testing.T) { }, "Missing Key": { data: []byte(`{"key_id":"1234"}`), - wantPublicKey: PublicKey{KeyID: String("1234")}, + wantPublicKey: PublicKey{KeyID: Ptr("1234")}, wantErr: false, }, "Missing KeyID": { data: []byte(`{"key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`), - wantPublicKey: PublicKey{Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, + wantPublicKey: PublicKey{Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")}, wantErr: false, }, } @@ -109,7 +109,7 @@ func TestActionsService_GetRepoPublicKey(t *testing.T) { t.Errorf("Actions.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -144,7 +144,7 @@ func TestActionsService_GetRepoPublicKeyNumeric(t *testing.T) { t.Errorf("Actions.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -362,7 +362,7 @@ func TestActionsService_GetOrgPublicKey(t *testing.T) { t.Errorf("Actions.GetOrgPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("012345678"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("012345678"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetOrgPublicKey returned %+v, want %+v", key, want) } @@ -519,9 +519,9 @@ func TestActionsService_ListSelectedReposForOrgSecret(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ - {ID: Int64(1)}, + {ID: Ptr(int64(1))}, }, } if !cmp.Equal(repos, want) { @@ -578,7 +578,7 @@ func TestActionsService_AddSelectedRepoToOrgSecret(t *testing.T) { testMethod(t, r, "PUT") }) - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} ctx := context.Background() _, err := client.Actions.AddSelectedRepoToOrgSecret(ctx, "o", "NAME", repo) if err != nil { @@ -604,7 +604,7 @@ func TestActionsService_RemoveSelectedRepoFromOrgSecret(t *testing.T) { testMethod(t, r, "DELETE") }) - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} ctx := context.Background() _, err := client.Actions.RemoveSelectedRepoFromOrgSecret(ctx, "o", "NAME", repo) if err != nil { @@ -662,7 +662,7 @@ func TestActionsService_GetEnvPublicKey(t *testing.T) { t.Errorf("Actions.GetEnvPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetEnvPublicKey returned %+v, want %+v", key, want) } @@ -697,7 +697,7 @@ func TestActionsService_GetEnvPublicKeyNumeric(t *testing.T) { t.Errorf("Actions.GetEnvPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Actions.GetEnvPublicKey returned %+v, want %+v", key, want) } @@ -862,8 +862,8 @@ func TestPublicKey_Marshal(t *testing.T) { testJSONMarshal(t, &PublicKey{}, "{}") u := &PublicKey{ - KeyID: String("kid"), - Key: String("k"), + KeyID: Ptr("kid"), + Key: Ptr("k"), } want := `{ @@ -956,12 +956,12 @@ func TestSelectedReposList_Marshal(t *testing.T) { testJSONMarshal(t, &SelectedReposList{}, "{}") u := &SelectedReposList{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ { - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, } diff --git a/github/actions_variables_test.go b/github/actions_variables_test.go index 14ce9ee2827..5a1813ab73d 100644 --- a/github/actions_variables_test.go +++ b/github/actions_variables_test.go @@ -250,9 +250,9 @@ func TestActionsService_ListOrgVariables(t *testing.T) { want := &ActionsVariables{ TotalCount: 3, Variables: []*ActionsVariable{ - {Name: "A", Value: "AA", CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: String("private")}, - {Name: "B", Value: "BB", CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: String("all")}, - {Name: "C", Value: "CC", CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: String("selected"), SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/variables/VAR/repositories")}, + {Name: "A", Value: "AA", CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: Ptr("private")}, + {Name: "B", Value: "BB", CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: Ptr("all")}, + {Name: "C", Value: "CC", CreatedAt: &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 10, 14, 59, 22, 0, time.UTC)}, Visibility: Ptr("selected"), SelectedRepositoriesURL: Ptr("https://api.github.com/orgs/octo-org/actions/variables/VAR/repositories")}, }, } if !cmp.Equal(variables, want) { @@ -294,8 +294,8 @@ func TestActionsService_GetOrgVariable(t *testing.T) { Value: "VALUE", CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, - Visibility: String("selected"), - SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/variables/VAR/repositories"), + Visibility: Ptr("selected"), + SelectedRepositoriesURL: Ptr("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) @@ -330,7 +330,7 @@ func TestActionsService_CreateOrgVariable(t *testing.T) { input := &ActionsVariable{ Name: "NAME", Value: "VALUE", - Visibility: String("selected"), + Visibility: Ptr("selected"), SelectedRepositoryIDs: &SelectedRepoIDs{1296269, 1269280}, } ctx := context.Background() @@ -364,7 +364,7 @@ func TestActionsService_UpdateOrgVariable(t *testing.T) { input := &ActionsVariable{ Name: "NAME", Value: "VALUE", - Visibility: String("selected"), + Visibility: Ptr("selected"), SelectedRepositoryIDs: &SelectedRepoIDs{1296269, 1269280}, } ctx := context.Background() @@ -401,9 +401,9 @@ func TestActionsService_ListSelectedReposForOrgVariable(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ - {ID: Int64(1)}, + {ID: Ptr(int64(1))}, }, } if !cmp.Equal(repos, want) { @@ -460,7 +460,7 @@ func TestActionsService_AddSelectedRepoToOrgVariable(t *testing.T) { testMethod(t, r, "PUT") }) - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} ctx := context.Background() _, err := client.Actions.AddSelectedRepoToOrgVariable(ctx, "o", "NAME", repo) if err != nil { @@ -486,7 +486,7 @@ func TestActionsService_RemoveSelectedRepoFromOrgVariable(t *testing.T) { testMethod(t, r, "DELETE") }) - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} ctx := context.Background() _, err := client.Actions.RemoveSelectedRepoFromOrgVariable(ctx, "o", "NAME", repo) if err != nil { @@ -710,8 +710,8 @@ func TestActionVariable_Marshal(t *testing.T) { Value: "v", CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Visibility: String("v"), - SelectedRepositoriesURL: String("s"), + Visibility: Ptr("v"), + SelectedRepositoriesURL: Ptr("s"), SelectedRepositoryIDs: &SelectedRepoIDs{1, 2, 3}, } diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index f8bb9481b31..3ef5295afde 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -35,10 +35,10 @@ func TestActionsService_ListWorkflowJobs(t *testing.T) { } want := &Jobs{ - TotalCount: Int(4), + TotalCount: Ptr(4), Jobs: []*WorkflowJob{ - {ID: Int64(399444496), RunID: Int64(29679449), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, - {ID: Int64(399444497), RunID: Int64(29679449), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444496)), RunID: Ptr(int64(29679449)), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444497)), RunID: Ptr(int64(29679449)), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, }, } if !cmp.Equal(jobs, want) { @@ -78,10 +78,10 @@ func TestActionsService_ListWorkflowJobs_Filter(t *testing.T) { } want := &Jobs{ - TotalCount: Int(4), + TotalCount: Ptr(4), Jobs: []*WorkflowJob{ - {ID: Int64(399444496), RunID: Int64(29679449), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, - {ID: Int64(399444497), RunID: Int64(29679449), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444496)), RunID: Ptr(int64(29679449)), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444497)), RunID: Ptr(int64(29679449)), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, }, } if !cmp.Equal(jobs, want) { @@ -106,21 +106,21 @@ func TestActionsService_ListWorkflowJobsAttempt(t *testing.T) { } want := &Jobs{ - TotalCount: Int(4), + TotalCount: Ptr(4), Jobs: []*WorkflowJob{ { - ID: Int64(399444496), - RunID: Int64(29679449), + ID: Ptr(int64(399444496)), + RunID: Ptr(int64(29679449)), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, - RunAttempt: Int64(2), + RunAttempt: Ptr(int64(2)), }, { - ID: Int64(399444497), - RunID: Int64(29679449), + ID: Ptr(int64(399444497)), + RunID: Ptr(int64(29679449)), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, - RunAttempt: Int64(2), + RunAttempt: Ptr(int64(2)), }, }, } @@ -159,7 +159,7 @@ func TestActionsService_GetWorkflowJobByID(t *testing.T) { } want := &WorkflowJob{ - ID: Int64(399444496), + ID: Ptr(int64(399444496)), StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, } @@ -273,10 +273,10 @@ func TestTaskStep_Marshal(t *testing.T) { testJSONMarshal(t, &TaskStep{}, "{}") u := &TaskStep{ - Name: String("n"), - Status: String("s"), - Conclusion: String("c"), - Number: Int64(1), + Name: Ptr("n"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + Number: Ptr(int64(1)), StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, } @@ -298,32 +298,32 @@ func TestWorkflowJob_Marshal(t *testing.T) { testJSONMarshal(t, &WorkflowJob{}, "{}") u := &WorkflowJob{ - ID: Int64(1), - RunID: Int64(1), - RunURL: String("r"), - NodeID: String("n"), - HeadBranch: String("b"), - HeadSHA: String("h"), - URL: String("u"), - HTMLURL: String("h"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + RunID: Ptr(int64(1)), + RunURL: Ptr("r"), + NodeID: Ptr("n"), + HeadBranch: Ptr("b"), + HeadSHA: Ptr("h"), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + Status: Ptr("s"), + Conclusion: Ptr("c"), CreatedAt: &Timestamp{referenceTime}, StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, - Name: String("n"), + Name: Ptr("n"), Steps: []*TaskStep{ { - Name: String("n"), - Status: String("s"), - Conclusion: String("c"), - Number: Int64(1), + Name: Ptr("n"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + Number: Ptr(int64(1)), StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, }, }, - CheckRunURL: String("c"), - WorkflowName: String("w"), + CheckRunURL: Ptr("c"), + WorkflowName: Ptr("w"), } want := `{ @@ -361,36 +361,36 @@ func TestJobs_Marshal(t *testing.T) { testJSONMarshal(t, &Jobs{}, "{}") u := &Jobs{ - TotalCount: Int(1), + TotalCount: Ptr(1), Jobs: []*WorkflowJob{ { - ID: Int64(1), - RunID: Int64(1), - RunURL: String("r"), - NodeID: String("n"), - HeadBranch: String("b"), - HeadSHA: String("h"), - URL: String("u"), - HTMLURL: String("h"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + RunID: Ptr(int64(1)), + RunURL: Ptr("r"), + NodeID: Ptr("n"), + HeadBranch: Ptr("b"), + HeadSHA: Ptr("h"), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + Status: Ptr("s"), + Conclusion: Ptr("c"), CreatedAt: &Timestamp{referenceTime}, StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, - Name: String("n"), + Name: Ptr("n"), Steps: []*TaskStep{ { - Name: String("n"), - Status: String("s"), - Conclusion: String("c"), - Number: Int64(1), + Name: Ptr("n"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + Number: Ptr(int64(1)), StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, }, }, - CheckRunURL: String("c"), - RunAttempt: Int64(2), - WorkflowName: String("w"), + CheckRunURL: Ptr("c"), + RunAttempt: Ptr(int64(2)), + WorkflowName: Ptr("w"), }, }, } diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index ea6583ef583..4c91c5349ce 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -35,10 +35,10 @@ func TestActionsService_ListWorkflowRunsByID(t *testing.T) { } want := &WorkflowRuns{ - TotalCount: Int(4), + TotalCount: Ptr(4), WorkflowRuns: []*WorkflowRun{ - {ID: Int64(399444496), RunNumber: Int(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, - {ID: Int64(399444497), RunNumber: Int(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444496)), RunNumber: Ptr(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444497)), RunNumber: Ptr(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, }, } if !cmp.Equal(runs, want) { @@ -78,10 +78,10 @@ func TestActionsService_ListWorkflowRunsFileName(t *testing.T) { } want := &WorkflowRuns{ - TotalCount: Int(4), + TotalCount: Ptr(4), WorkflowRuns: []*WorkflowRun{ - {ID: Int64(399444496), RunNumber: Int(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, - {ID: Int64(399444497), RunNumber: Int(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444496)), RunNumber: Ptr(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(399444497)), RunNumber: Ptr(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, }, } if !cmp.Equal(runs, want) { @@ -119,8 +119,8 @@ func TestActionsService_GetWorkflowRunByID(t *testing.T) { } want := &WorkflowRun{ - ID: Int64(399444496), - RunNumber: Int(296), + ID: Ptr(int64(399444496)), + RunNumber: Ptr(296), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, } @@ -154,7 +154,7 @@ func TestActionsService_GetWorkflowRunAttempt(t *testing.T) { fmt.Fprint(w, `{"id":399444496,"run_number":296,"run_attempt":3,"created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"}}`) }) - opts := &WorkflowRunAttemptOptions{ExcludePullRequests: Bool(true)} + opts := &WorkflowRunAttemptOptions{ExcludePullRequests: Ptr(true)} ctx := context.Background() runs, _, err := client.Actions.GetWorkflowRunAttempt(ctx, "o", "r", 29679449, 3, opts) if err != nil { @@ -162,9 +162,9 @@ func TestActionsService_GetWorkflowRunAttempt(t *testing.T) { } want := &WorkflowRun{ - ID: Int64(399444496), - RunNumber: Int(296), - RunAttempt: Int(3), + ID: Ptr(int64(399444496)), + RunNumber: Ptr(296), + RunAttempt: Ptr(3), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, } @@ -491,10 +491,10 @@ func TestActionService_ListRepositoryWorkflowRuns(t *testing.T) { } expected := &WorkflowRuns{ - TotalCount: Int(2), + TotalCount: Ptr(2), WorkflowRuns: []*WorkflowRun{ - {ID: Int64(298499444), RunNumber: Int(301), CreatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}}, - {ID: Int64(298499445), RunNumber: Int(302), CreatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}}, + {ID: Ptr(int64(298499444)), RunNumber: Ptr(301), CreatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}}, + {ID: Ptr(int64(298499445)), RunNumber: Ptr(302), CreatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.April, 11, 11, 14, 54, 0, time.UTC)}}, }, } @@ -577,26 +577,26 @@ func TestPendingDeployment_Marshal(t *testing.T) { u := &PendingDeployment{ Environment: &PendingDeploymentEnvironment{ - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - URL: String("u"), - HTMLURL: String("hu"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + URL: Ptr("u"), + HTMLURL: Ptr("hu"), }, - WaitTimer: Int64(100), + WaitTimer: Ptr(int64(100)), WaitTimerStartedAt: &Timestamp{referenceTime}, - CurrentUserCanApprove: Bool(false), + CurrentUserCanApprove: Ptr(false), Reviewers: []*RequiredReviewer{ { - Type: String("User"), + Type: Ptr("User"), Reviewer: &User{ - Login: String("l"), + Login: Ptr("l"), }, }, { - Type: String("Team"), + Type: Ptr("Team"), Reviewer: &Team{ - Name: String("n"), + Name: Ptr("n"), }, }, }, @@ -697,35 +697,35 @@ func TestActionsService_GetWorkflowRunUsageByID(t *testing.T) { want := &WorkflowRunUsage{ Billable: &WorkflowRunBillMap{ "UBUNTU": &WorkflowRunBill{ - TotalMS: Int64(180000), - Jobs: Int(1), + TotalMS: Ptr(int64(180000)), + Jobs: Ptr(1), JobRuns: []*WorkflowRunJobRun{ { - JobID: Int(1), - DurationMS: Int64(60000), + JobID: Ptr(1), + DurationMS: Ptr(int64(60000)), }, }, }, "MACOS": &WorkflowRunBill{ - TotalMS: Int64(240000), - Jobs: Int(2), + TotalMS: Ptr(int64(240000)), + Jobs: Ptr(2), JobRuns: []*WorkflowRunJobRun{ { - JobID: Int(2), - DurationMS: Int64(30000), + JobID: Ptr(2), + DurationMS: Ptr(int64(30000)), }, { - JobID: Int(3), - DurationMS: Int64(10000), + JobID: Ptr(3), + DurationMS: Ptr(int64(10000)), }, }, }, "WINDOWS": &WorkflowRunBill{ - TotalMS: Int64(300000), - Jobs: Int(2), + TotalMS: Ptr(int64(300000)), + Jobs: Ptr(2), }, }, - RunDurationMS: Int64(500000), + RunDurationMS: Ptr(int64(500000)), } if !cmp.Equal(workflowRunUsage, want) { @@ -752,41 +752,41 @@ func TestWorkflowRun_Marshal(t *testing.T) { testJSONMarshal(t, &WorkflowRun{}, "{}") u := &WorkflowRun{ - ID: Int64(1), - Name: String("n"), - NodeID: String("nid"), - HeadBranch: String("hb"), - HeadSHA: String("hs"), - Path: String("p"), - RunNumber: Int(1), - RunAttempt: Int(1), - Event: String("e"), - Status: String("s"), - Conclusion: String("c"), - WorkflowID: Int64(1), - URL: String("u"), - HTMLURL: String("h"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + NodeID: Ptr("nid"), + HeadBranch: Ptr("hb"), + HeadSHA: Ptr("hs"), + Path: Ptr("p"), + RunNumber: Ptr(1), + RunAttempt: Ptr(1), + Event: Ptr("e"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + WorkflowID: Ptr(int64(1)), + URL: Ptr("u"), + HTMLURL: Ptr("h"), PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, @@ -794,88 +794,88 @@ func TestWorkflowRun_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, RunStartedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), - PreviousAttemptURL: String("p"), + JobsURL: Ptr("j"), + LogsURL: Ptr("l"), + CheckSuiteURL: Ptr("c"), + ArtifactsURL: Ptr("a"), + CancelURL: Ptr("c"), + RerunURL: Ptr("r"), + PreviousAttemptURL: Ptr("p"), HeadCommit: &HeadCommit{ - Message: String("m"), + Message: Ptr("m"), Author: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, - URL: String("u"), - Distinct: Bool(false), - SHA: String("s"), - ID: String("i"), - TreeID: String("tid"), + URL: Ptr("u"), + Distinct: Ptr(false), + SHA: Ptr("s"), + ID: Ptr("i"), + TreeID: Ptr("tid"), Timestamp: &Timestamp{referenceTime}, Committer: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, }, - WorkflowURL: String("w"), + WorkflowURL: Ptr("w"), Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, HeadRepository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, Actor: &User{ - Login: String("l"), - ID: Int64(1), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, TriggeringActor: &User{ - Login: String("l2"), - ID: Int64(2), - AvatarURL: String("a2"), - GravatarID: String("g2"), - Name: String("n2"), - Company: String("c2"), - Blog: String("b2"), - Location: String("l2"), - Email: String("e2"), - Hireable: Bool(false), - Bio: String("b2"), - TwitterUsername: String("t2"), - PublicRepos: Int(2), - Followers: Int(2), - Following: Int(2), + Login: Ptr("l2"), + ID: Ptr(int64(2)), + AvatarURL: Ptr("a2"), + GravatarID: Ptr("g2"), + Name: Ptr("n2"), + Company: Ptr("c2"), + Blog: Ptr("b2"), + Location: Ptr("l2"), + Email: Ptr("e2"), + Hireable: Ptr(false), + Bio: Ptr("b2"), + TwitterUsername: Ptr("t2"), + PublicRepos: Ptr(2), + Followers: Ptr(2), + Following: Ptr(2), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, - URL: String("u2"), + URL: Ptr("u2"), }, ReferencedWorkflows: []*ReferencedWorkflow{ { - Path: String("rwfp"), - SHA: String("rwfsha"), - Ref: String("rwfref"), + Path: Ptr("rwfp"), + SHA: Ptr("rwfsha"), + Ref: Ptr("rwfref"), }, }, } @@ -1017,43 +1017,43 @@ func TestWorkflowRuns_Marshal(t *testing.T) { testJSONMarshal(t, &WorkflowRuns{}, "{}") u := &WorkflowRuns{ - TotalCount: Int(1), + TotalCount: Ptr(1), WorkflowRuns: []*WorkflowRun{ { - ID: Int64(1), - Name: String("n"), - NodeID: String("nid"), - HeadBranch: String("hb"), - HeadSHA: String("hs"), - RunNumber: Int(1), - RunAttempt: Int(1), - Event: String("e"), - Status: String("s"), - Conclusion: String("c"), - WorkflowID: Int64(1), - URL: String("u"), - HTMLURL: String("h"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + NodeID: Ptr("nid"), + HeadBranch: Ptr("hb"), + HeadSHA: Ptr("hs"), + RunNumber: Ptr(1), + RunAttempt: Ptr(1), + Event: Ptr("e"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + WorkflowID: Ptr(int64(1)), + URL: Ptr("u"), + HTMLURL: Ptr("h"), PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, @@ -1061,82 +1061,82 @@ func TestWorkflowRuns_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, RunStartedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), - PreviousAttemptURL: String("p"), + JobsURL: Ptr("j"), + LogsURL: Ptr("l"), + CheckSuiteURL: Ptr("c"), + ArtifactsURL: Ptr("a"), + CancelURL: Ptr("c"), + RerunURL: Ptr("r"), + PreviousAttemptURL: Ptr("p"), HeadCommit: &HeadCommit{ - Message: String("m"), + Message: Ptr("m"), Author: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, - URL: String("u"), - Distinct: Bool(false), - SHA: String("s"), - ID: String("i"), - TreeID: String("tid"), + URL: Ptr("u"), + Distinct: Ptr(false), + SHA: Ptr("s"), + ID: Ptr("i"), + TreeID: Ptr("tid"), Timestamp: &Timestamp{referenceTime}, Committer: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, }, - WorkflowURL: String("w"), + WorkflowURL: Ptr("w"), Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, HeadRepository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, Actor: &User{ - Login: String("l"), - ID: Int64(1), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, TriggeringActor: &User{ - Login: String("l2"), - ID: Int64(2), - AvatarURL: String("a2"), - GravatarID: String("g2"), - Name: String("n2"), - Company: String("c2"), - Blog: String("b2"), - Location: String("l2"), - Email: String("e2"), - Hireable: Bool(false), - Bio: String("b2"), - TwitterUsername: String("t2"), - PublicRepos: Int(2), - Followers: Int(2), - Following: Int(2), + Login: Ptr("l2"), + ID: Ptr(int64(2)), + AvatarURL: Ptr("a2"), + GravatarID: Ptr("g2"), + Name: Ptr("n2"), + Company: Ptr("c2"), + Blog: Ptr("b2"), + Location: Ptr("l2"), + Email: Ptr("e2"), + Hireable: Ptr(false), + Bio: Ptr("b2"), + TwitterUsername: Ptr("t2"), + PublicRepos: Ptr(2), + Followers: Ptr(2), + Following: Ptr(2), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, - URL: String("u2"), + URL: Ptr("u2"), }, }, }, @@ -1276,8 +1276,8 @@ func TestWorkflowRunBill_Marshal(t *testing.T) { testJSONMarshal(t, &WorkflowRunBill{}, "{}") u := &WorkflowRunBill{ - TotalMS: Int64(1), - Jobs: Int(1), + TotalMS: Ptr(int64(1)), + Jobs: Ptr(1), } want := `{ @@ -1294,16 +1294,16 @@ func TestWorkflowRunBillMap_Marshal(t *testing.T) { u := &WorkflowRunBillMap{ "UBUNTU": &WorkflowRunBill{ - TotalMS: Int64(1), - Jobs: Int(1), + TotalMS: Ptr(int64(1)), + Jobs: Ptr(1), }, "MACOS": &WorkflowRunBill{ - TotalMS: Int64(1), - Jobs: Int(1), + TotalMS: Ptr(int64(1)), + Jobs: Ptr(1), }, "WINDOWS": &WorkflowRunBill{ - TotalMS: Int64(1), - Jobs: Int(1), + TotalMS: Ptr(int64(1)), + Jobs: Ptr(1), }, } @@ -1332,19 +1332,19 @@ func TestWorkflowRunUsage_Marshal(t *testing.T) { u := &WorkflowRunUsage{ Billable: &WorkflowRunBillMap{ "UBUNTU": &WorkflowRunBill{ - TotalMS: Int64(1), - Jobs: Int(1), + TotalMS: Ptr(int64(1)), + Jobs: Ptr(1), }, "MACOS": &WorkflowRunBill{ - TotalMS: Int64(1), - Jobs: Int(1), + TotalMS: Ptr(int64(1)), + Jobs: Ptr(1), }, "WINDOWS": &WorkflowRunBill{ - TotalMS: Int64(1), - Jobs: Int(1), + TotalMS: Ptr(int64(1)), + Jobs: Ptr(1), }, }, - RunDurationMS: Int64(1), + RunDurationMS: Ptr(int64(1)), } want := `{ @@ -1392,7 +1392,7 @@ func TestActionService_PendingDeployments(t *testing.T) { t.Errorf("Actions.PendingDeployments returned error: %v", err) } - want := []*Deployment{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*Deployment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(deployments, want) { t.Errorf("Actions.PendingDeployments returned %+v, want %+v", deployments, want) } @@ -1471,40 +1471,40 @@ func TestActionService_GetPendingDeployments(t *testing.T) { want := []*PendingDeployment{ { Environment: &PendingDeploymentEnvironment{ - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - URL: String("u"), - HTMLURL: String("hu"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + URL: Ptr("u"), + HTMLURL: Ptr("hu"), }, - WaitTimer: Int64(0), + WaitTimer: Ptr(int64(0)), WaitTimerStartedAt: &Timestamp{referenceTime}, - CurrentUserCanApprove: Bool(false), + CurrentUserCanApprove: Ptr(false), Reviewers: []*RequiredReviewer{}, }, { Environment: &PendingDeploymentEnvironment{ - ID: Int64(2), - NodeID: String("nid"), - Name: String("n"), - URL: String("u"), - HTMLURL: String("hu"), + ID: Ptr(int64(2)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + URL: Ptr("u"), + HTMLURL: Ptr("hu"), }, - WaitTimer: Int64(13), + WaitTimer: Ptr(int64(13)), WaitTimerStartedAt: &Timestamp{referenceTime}, - CurrentUserCanApprove: Bool(true), + CurrentUserCanApprove: Ptr(true), Reviewers: []*RequiredReviewer{ { - Type: String("User"), + Type: Ptr("User"), Reviewer: &User{ - Login: String("l"), + Login: Ptr("l"), }, }, { - Type: String("Team"), + Type: Ptr("Team"), Reviewer: &Team{ - Name: String("t"), - Slug: String("s"), + Name: Ptr("t"), + Slug: Ptr("s"), }, }, }, diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index 7a42cabde23..baaae7bfb9d 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -34,10 +34,10 @@ func TestActionsService_ListWorkflows(t *testing.T) { } want := &Workflows{ - TotalCount: Int(4), + TotalCount: Ptr(4), Workflows: []*Workflow{ - {ID: Int64(72844), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, - {ID: Int64(72845), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(72844)), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {ID: Ptr(int64(72845)), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, }, } if !cmp.Equal(workflows, want) { @@ -75,7 +75,7 @@ func TestActionsService_GetWorkflowByID(t *testing.T) { } want := &Workflow{ - ID: Int64(72844), + ID: Ptr(int64(72844)), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, } @@ -114,7 +114,7 @@ func TestActionsService_GetWorkflowByFileName(t *testing.T) { } want := &Workflow{ - ID: Int64(72844), + ID: Ptr(int64(72844)), CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, } @@ -155,13 +155,13 @@ func TestActionsService_GetWorkflowUsageByID(t *testing.T) { want := &WorkflowUsage{ Billable: &WorkflowBillMap{ "UBUNTU": &WorkflowBill{ - TotalMS: Int64(180000), + TotalMS: Ptr(int64(180000)), }, "MACOS": &WorkflowBill{ - TotalMS: Int64(240000), + TotalMS: Ptr(int64(240000)), }, "WINDOWS": &WorkflowBill{ - TotalMS: Int64(300000), + TotalMS: Ptr(int64(300000)), }, }, } @@ -202,13 +202,13 @@ func TestActionsService_GetWorkflowUsageByFileName(t *testing.T) { want := &WorkflowUsage{ Billable: &WorkflowBillMap{ "UBUNTU": &WorkflowBill{ - TotalMS: Int64(180000), + TotalMS: Ptr(int64(180000)), }, "MACOS": &WorkflowBill{ - TotalMS: Int64(240000), + TotalMS: Ptr(int64(240000)), }, "WINDOWS": &WorkflowBill{ - TotalMS: Int64(300000), + TotalMS: Ptr(int64(300000)), }, }, } @@ -464,16 +464,16 @@ func TestWorkflow_Marshal(t *testing.T) { testJSONMarshal(t, &Workflow{}, "{}") u := &Workflow{ - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - Path: String("p"), - State: String("s"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + Path: Ptr("p"), + State: Ptr("s"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("u"), - HTMLURL: String("h"), - BadgeURL: String("b"), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + BadgeURL: Ptr("b"), } want := `{ @@ -497,19 +497,19 @@ func TestWorkflows_Marshal(t *testing.T) { testJSONMarshal(t, &Workflows{}, "{}") u := &Workflows{ - TotalCount: Int(1), + TotalCount: Ptr(1), Workflows: []*Workflow{ { - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - Path: String("p"), - State: String("s"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + Path: Ptr("p"), + State: Ptr("s"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("u"), - HTMLURL: String("h"), - BadgeURL: String("b"), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + BadgeURL: Ptr("b"), }, }, } @@ -538,7 +538,7 @@ func TestWorkflowBill_Marshal(t *testing.T) { testJSONMarshal(t, &WorkflowBill{}, "{}") u := &WorkflowBill{ - TotalMS: Int64(1), + TotalMS: Ptr(int64(1)), } want := `{ @@ -554,13 +554,13 @@ func TestWorkflowBillMap_Marshal(t *testing.T) { u := &WorkflowBillMap{ "UBUNTU": &WorkflowBill{ - TotalMS: Int64(1), + TotalMS: Ptr(int64(1)), }, "MACOS": &WorkflowBill{ - TotalMS: Int64(1), + TotalMS: Ptr(int64(1)), }, "WINDOWS": &WorkflowBill{ - TotalMS: Int64(1), + TotalMS: Ptr(int64(1)), }, } @@ -586,13 +586,13 @@ func TestWorkflowUsage_Marshal(t *testing.T) { u := &WorkflowUsage{ Billable: &WorkflowBillMap{ "UBUNTU": &WorkflowBill{ - TotalMS: Int64(1), + TotalMS: Ptr(int64(1)), }, "MACOS": &WorkflowBill{ - TotalMS: Int64(1), + TotalMS: Ptr(int64(1)), }, "WINDOWS": &WorkflowBill{ - TotalMS: Int64(1), + TotalMS: Ptr(int64(1)), }, }, } diff --git a/github/activity_events_test.go b/github/activity_events_test.go index d9025725b6a..cf38b4b6799 100644 --- a/github/activity_events_test.go +++ b/github/activity_events_test.go @@ -34,7 +34,7 @@ func TestActivityService_ListEvents(t *testing.T) { t.Errorf("Activities.ListEvents returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListEvents returned %+v, want %+v", events, want) } @@ -68,7 +68,7 @@ func TestActivityService_ListRepositoryEvents(t *testing.T) { t.Errorf("Activities.ListRepositoryEvents returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListRepositoryEvents returned %+v, want %+v", events, want) } @@ -116,7 +116,7 @@ func TestActivityService_ListIssueEventsForRepository(t *testing.T) { t.Errorf("Activities.ListIssueEventsForRepository returned error: %v", err) } - want := []*IssueEvent{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*IssueEvent{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListIssueEventsForRepository returned %+v, want %+v", events, want) } @@ -164,7 +164,7 @@ func TestActivityService_ListEventsForRepoNetwork(t *testing.T) { t.Errorf("Activities.ListEventsForRepoNetwork returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListEventsForRepoNetwork returned %+v, want %+v", events, want) } @@ -212,7 +212,7 @@ func TestActivityService_ListEventsForOrganization(t *testing.T) { t.Errorf("Activities.ListEventsForOrganization returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListEventsForOrganization returned %+v, want %+v", events, want) } @@ -260,7 +260,7 @@ func TestActivityService_ListEventsPerformedByUser_all(t *testing.T) { t.Errorf("Events.ListPerformedByUser returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Events.ListPerformedByUser returned %+v, want %+v", events, want) } @@ -295,7 +295,7 @@ func TestActivityService_ListEventsPerformedByUser_publicOnly(t *testing.T) { t.Errorf("Events.ListPerformedByUser returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Events.ListPerformedByUser returned %+v, want %+v", events, want) } @@ -329,7 +329,7 @@ func TestActivityService_ListEventsReceivedByUser_all(t *testing.T) { t.Errorf("Events.ListReceivedByUser returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Events.ListReceivedUser returned %+v, want %+v", events, want) } @@ -364,7 +364,7 @@ func TestActivityService_ListEventsReceivedByUser_publicOnly(t *testing.T) { t.Errorf("Events.ListReceivedByUser returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Events.ListReceivedByUser returned %+v, want %+v", events, want) } @@ -398,7 +398,7 @@ func TestActivityService_ListUserEventsForOrganization(t *testing.T) { t.Errorf("Activities.ListUserEventsForOrganization returned error: %v", err) } - want := []*Event{{ID: String("1")}, {ID: String("2")}} + want := []*Event{{ID: Ptr("1")}, {ID: Ptr("2")}} if !cmp.Equal(events, want) { t.Errorf("Activities.ListUserEventsForOrganization returned %+v, want %+v", events, want) } @@ -426,7 +426,7 @@ func TestActivityService_EventParsePayload_typed(t *testing.T) { t.Fatalf("Unmarshal Event returned error: %v", err) } - want := &PushEvent{PushID: Int64(1)} + want := &PushEvent{PushID: Ptr(int64(1))} got, err := event.ParsePayload() if err != nil { t.Fatalf("ParsePayload returned unexpected error: %v", err) @@ -465,7 +465,7 @@ func TestActivityService_EventParsePayload_installation(t *testing.T) { t.Fatalf("Unmarshal Event returned error: %v", err) } - want := &PullRequestEvent{Installation: &Installation{ID: Int64(1)}} + want := &PullRequestEvent{Installation: &Installation{ID: Ptr(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 03ecc8f66c7..6f3ae5b970e 100644 --- a/github/activity_notifications_test.go +++ b/github/activity_notifications_test.go @@ -44,7 +44,7 @@ func TestActivityService_ListNotification(t *testing.T) { t.Errorf("Activity.ListNotifications returned error: %v", err) } - want := []*Notification{{ID: String("1"), Subject: &NotificationSubject{Title: String("t")}}} + want := []*Notification{{ID: Ptr("1"), Subject: &NotificationSubject{Title: Ptr("t")}}} if !cmp.Equal(notifications, want) { t.Errorf("Activity.ListNotifications returned %+v, want %+v", notifications, want) } @@ -74,7 +74,7 @@ func TestActivityService_ListRepositoryNotifications(t *testing.T) { t.Errorf("Activity.ListRepositoryNotifications returned error: %v", err) } - want := []*Notification{{ID: String("1")}} + want := []*Notification{{ID: Ptr("1")}} if !cmp.Equal(notifications, want) { t.Errorf("Activity.ListRepositoryNotifications returned %+v, want %+v", notifications, want) } @@ -162,7 +162,7 @@ func TestActivityService_GetThread(t *testing.T) { t.Errorf("Activity.GetThread returned error: %v", err) } - want := &Notification{ID: String("1")} + want := &Notification{ID: Ptr("1")} if !cmp.Equal(notification, want) { t.Errorf("Activity.GetThread returned %+v, want %+v", notification, want) } @@ -249,7 +249,7 @@ func TestActivityService_GetThreadSubscription(t *testing.T) { t.Errorf("Activity.GetThreadSubscription returned error: %v", err) } - want := &Subscription{Subscribed: Bool(true)} + want := &Subscription{Subscribed: Ptr(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.GetThreadSubscription returned %+v, want %+v", sub, want) } @@ -273,7 +273,7 @@ func TestActivityService_SetThreadSubscription(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Subscription{Subscribed: Bool(true)} + input := &Subscription{Subscribed: Ptr(true)} mux.HandleFunc("/notifications/threads/1/subscription", func(w http.ResponseWriter, r *http.Request) { v := new(Subscription) @@ -293,7 +293,7 @@ func TestActivityService_SetThreadSubscription(t *testing.T) { t.Errorf("Activity.SetThreadSubscription returned error: %v", err) } - want := &Subscription{Ignored: Bool(true)} + want := &Subscription{Ignored: Ptr(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.SetThreadSubscription returned %+v, want %+v", sub, want) } @@ -344,23 +344,23 @@ func TestNotification_Marshal(t *testing.T) { testJSONMarshal(t, &Notification{}, "{}") u := &Notification{ - ID: String("id"), + ID: Ptr("id"), Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, Subject: &NotificationSubject{ - Title: String("t"), - URL: String("u"), - LatestCommentURL: String("l"), - Type: String("t"), + Title: Ptr("t"), + URL: Ptr("u"), + LatestCommentURL: Ptr("l"), + Type: Ptr("t"), }, - Reason: String("r"), - Unread: Bool(true), + Reason: Ptr("r"), + Unread: Ptr(true), UpdatedAt: &Timestamp{referenceTime}, LastReadAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), } want := `{ @@ -391,10 +391,10 @@ func TestNotificationSubject_Marshal(t *testing.T) { testJSONMarshal(t, &NotificationSubject{}, "{}") u := &NotificationSubject{ - Title: String("t"), - URL: String("u"), - LatestCommentURL: String("l"), - Type: String("t"), + Title: Ptr("t"), + URL: Ptr("u"), + LatestCommentURL: Ptr("l"), + Type: Ptr("t"), } want := `{ diff --git a/github/activity_star_test.go b/github/activity_star_test.go index ceb9e94ef65..1f1fbbc7488 100644 --- a/github/activity_star_test.go +++ b/github/activity_star_test.go @@ -36,7 +36,7 @@ func TestActivityService_ListStargazers(t *testing.T) { t.Errorf("Activity.ListStargazers returned error: %v", err) } - want := []*Stargazer{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, User: &User{ID: Int64(1)}}} + want := []*Stargazer{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, User: &User{ID: Ptr(int64(1))}}} if !cmp.Equal(stargazers, want) { t.Errorf("Activity.ListStargazers returned %+v, want %+v", stargazers, want) } @@ -72,7 +72,7 @@ func TestActivityService_ListStarred_authenticatedUser(t *testing.T) { t.Errorf("Activity.ListStarred returned error: %v", err) } - want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int64(1)}}} + want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Ptr(int64(1))}}} if !cmp.Equal(repos, want) { t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want) } @@ -114,7 +114,7 @@ func TestActivityService_ListStarred_specifiedUser(t *testing.T) { t.Errorf("Activity.ListStarred returned error: %v", err) } - want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int64(2)}}} + want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Ptr(int64(2))}}} if !cmp.Equal(repos, want) { t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want) } @@ -293,9 +293,9 @@ func TestStarredRepository_Marshal(t *testing.T) { u := &StarredRepository{ StarredAt: &Timestamp{referenceTime}, Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, } @@ -318,22 +318,22 @@ func TestStargazer_Marshal(t *testing.T) { u := &Stargazer{ StarredAt: &Timestamp{referenceTime}, User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, diff --git a/github/activity_test.go b/github/activity_test.go index dc8d41c9a97..4ae35b3f938 100644 --- a/github/activity_test.go +++ b/github/activity_test.go @@ -88,44 +88,44 @@ var feedsJSON = []byte(`{ }`) var wantFeeds = &Feeds{ - TimelineURL: String("https://github.com/timeline"), - UserURL: String("https://github.com/{user}"), - CurrentUserPublicURL: String("https://github.com/defunkt"), - CurrentUserURL: String("https://github.com/defunkt.private?token=abc123"), - CurrentUserActorURL: String("https://github.com/defunkt.private.actor?token=abc123"), - CurrentUserOrganizationURL: String(""), + 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(""), CurrentUserOrganizationURLs: []string{ "https://github.com/organizations/github/defunkt.private.atom?token=abc123", }, Links: &FeedLinks{ Timeline: &FeedLink{ - HRef: String("https://github.com/timeline"), - Type: String("application/atom+xml"), + HRef: Ptr("https://github.com/timeline"), + Type: Ptr("application/atom+xml"), }, User: &FeedLink{ - HRef: String("https://github.com/{user}"), - Type: String("application/atom+xml"), + HRef: Ptr("https://github.com/{user}"), + Type: Ptr("application/atom+xml"), }, CurrentUserPublic: &FeedLink{ - HRef: String("https://github.com/defunkt"), - Type: String("application/atom+xml"), + HRef: Ptr("https://github.com/defunkt"), + Type: Ptr("application/atom+xml"), }, CurrentUser: &FeedLink{ - HRef: String("https://github.com/defunkt.private?token=abc123"), - Type: String("application/atom+xml"), + HRef: Ptr("https://github.com/defunkt.private?token=abc123"), + Type: Ptr("application/atom+xml"), }, CurrentUserActor: &FeedLink{ - HRef: String("https://github.com/defunkt.private.actor?token=abc123"), - Type: String("application/atom+xml"), + HRef: Ptr("https://github.com/defunkt.private.actor?token=abc123"), + Type: Ptr("application/atom+xml"), }, CurrentUserOrganization: &FeedLink{ - HRef: String(""), - Type: String(""), + HRef: Ptr(""), + Type: Ptr(""), }, CurrentUserOrganizations: []*FeedLink{ { - HRef: String("https://github.com/organizations/github/defunkt.private.atom?token=abc123"), - Type: String("application/atom+xml"), + HRef: Ptr("https://github.com/organizations/github/defunkt.private.atom?token=abc123"), + Type: Ptr("application/atom+xml"), }, }, }, @@ -136,8 +136,8 @@ func TestFeedLink_Marshal(t *testing.T) { testJSONMarshal(t, &FeedLink{}, "{}") u := &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), } want := `{ @@ -153,42 +153,42 @@ func TestFeeds_Marshal(t *testing.T) { testJSONMarshal(t, &Feeds{}, "{}") u := &Feeds{ - TimelineURL: String("t"), - UserURL: String("u"), - CurrentUserPublicURL: String("cupu"), - CurrentUserURL: String("cuu"), - CurrentUserActorURL: String("cuau"), - CurrentUserOrganizationURL: String("cuou"), + TimelineURL: Ptr("t"), + UserURL: Ptr("u"), + CurrentUserPublicURL: Ptr("cupu"), + CurrentUserURL: Ptr("cuu"), + CurrentUserActorURL: Ptr("cuau"), + CurrentUserOrganizationURL: Ptr("cuou"), CurrentUserOrganizationURLs: []string{"a"}, Links: &FeedLinks{ Timeline: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, User: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserPublic: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUser: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserActor: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserOrganization: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserOrganizations: []*FeedLink{ { - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, }, }, @@ -245,33 +245,33 @@ func TestFeedLinks_Marshal(t *testing.T) { u := &FeedLinks{ Timeline: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, User: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserPublic: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUser: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserActor: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserOrganization: &FeedLink{ - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, CurrentUserOrganizations: []*FeedLink{ { - HRef: String("h"), - Type: String("t"), + HRef: Ptr("h"), + Type: Ptr("t"), }, }, } diff --git a/github/activity_watching_test.go b/github/activity_watching_test.go index 98a9f5000c5..8a7ab8ab71c 100644 --- a/github/activity_watching_test.go +++ b/github/activity_watching_test.go @@ -34,7 +34,7 @@ func TestActivityService_ListWatchers(t *testing.T) { t.Errorf("Activity.ListWatchers returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(watchers, want) { t.Errorf("Activity.ListWatchers returned %+v, want %+v", watchers, want) } @@ -72,7 +72,7 @@ func TestActivityService_ListWatched_authenticatedUser(t *testing.T) { t.Errorf("Activity.ListWatched returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(watched, want) { t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want) } @@ -110,7 +110,7 @@ func TestActivityService_ListWatched_specifiedUser(t *testing.T) { t.Errorf("Activity.ListWatched returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(watched, want) { t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want) } @@ -131,7 +131,7 @@ func TestActivityService_GetRepositorySubscription_true(t *testing.T) { t.Errorf("Activity.GetRepositorySubscription returned error: %v", err) } - want := &Subscription{Subscribed: Bool(true)} + want := &Subscription{Subscribed: Ptr(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.GetRepositorySubscription returned %+v, want %+v", sub, want) } @@ -192,7 +192,7 @@ func TestActivityService_SetRepositorySubscription(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Subscription{Subscribed: Bool(true)} + input := &Subscription{Subscribed: Ptr(true)} mux.HandleFunc("/repos/o/r/subscription", func(w http.ResponseWriter, r *http.Request) { v := new(Subscription) @@ -212,7 +212,7 @@ func TestActivityService_SetRepositorySubscription(t *testing.T) { t.Errorf("Activity.SetRepositorySubscription returned error: %v", err) } - want := &Subscription{Ignored: Bool(true)} + want := &Subscription{Ignored: Ptr(true)} if !cmp.Equal(sub, want) { t.Errorf("Activity.SetRepositorySubscription returned %+v, want %+v", sub, want) } @@ -263,13 +263,13 @@ func TestSubscription_Marshal(t *testing.T) { testJSONMarshal(t, &Subscription{}, "{}") u := &Subscription{ - Subscribed: Bool(true), - Ignored: Bool(false), - Reason: String("r"), + Subscribed: Ptr(true), + Ignored: Ptr(false), + Reason: Ptr("r"), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), - RepositoryURL: String("ru"), - ThreadURL: String("tu"), + URL: Ptr("u"), + RepositoryURL: Ptr("ru"), + ThreadURL: Ptr("tu"), } want := `{ diff --git a/github/admin_orgs_test.go b/github/admin_orgs_test.go index 48f10089c9b..b05ce57b31c 100644 --- a/github/admin_orgs_test.go +++ b/github/admin_orgs_test.go @@ -20,7 +20,7 @@ func TestAdminOrgs_Create(t *testing.T) { client, mux, _ := setup(t) input := &Organization{ - Login: String("github"), + Login: Ptr("github"), } mux.HandleFunc("/admin/organizations", func(w http.ResponseWriter, r *http.Request) { @@ -28,7 +28,7 @@ func TestAdminOrgs_Create(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") - want := &createOrgRequest{Login: String("github"), Admin: String("ghAdmin")} + want := &createOrgRequest{Login: Ptr("github"), Admin: Ptr("ghAdmin")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -42,7 +42,7 @@ func TestAdminOrgs_Create(t *testing.T) { t.Errorf("Admin.CreateOrg returned error: %v", err) } - want := &Organization{ID: Int64(1), Login: String("github")} + want := &Organization{ID: Ptr(int64(1)), Login: Ptr("github")} if !cmp.Equal(org, want) { t.Errorf("Admin.CreateOrg returned %+v, want %+v", org, want) } @@ -62,7 +62,7 @@ func TestAdminOrgs_Rename(t *testing.T) { client, mux, _ := setup(t) input := &Organization{ - Login: String("o"), + Login: Ptr("o"), } mux.HandleFunc("/admin/organizations/o", func(w http.ResponseWriter, r *http.Request) { @@ -70,7 +70,7 @@ func TestAdminOrgs_Rename(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") - want := &renameOrgRequest{Login: String("the-new-octocats")} + want := &renameOrgRequest{Login: Ptr("the-new-octocats")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -84,7 +84,7 @@ func TestAdminOrgs_Rename(t *testing.T) { t.Errorf("Admin.RenameOrg returned error: %v", err) } - want := &RenameOrgResponse{Message: String("Job queued to rename organization. It may take a few minutes to complete."), URL: String("https:///api/v3/organizations/1")} + want := &RenameOrgResponse{Message: Ptr("Job queued to rename organization. It may take a few minutes to complete."), URL: Ptr("https:///api/v3/organizations/1")} if !cmp.Equal(resp, want) { t.Errorf("Admin.RenameOrg returned %+v, want %+v", resp, want) } @@ -108,7 +108,7 @@ func TestAdminOrgs_RenameByName(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") - want := &renameOrgRequest{Login: String("the-new-octocats")} + want := &renameOrgRequest{Login: Ptr("the-new-octocats")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -122,7 +122,7 @@ func TestAdminOrgs_RenameByName(t *testing.T) { t.Errorf("Admin.RenameOrg returned error: %v", err) } - want := &RenameOrgResponse{Message: String("Job queued to rename organization. It may take a few minutes to complete."), URL: String("https:///api/v3/organizations/1")} + want := &RenameOrgResponse{Message: Ptr("Job queued to rename organization. It may take a few minutes to complete."), URL: Ptr("https:///api/v3/organizations/1")} if !cmp.Equal(resp, want) { t.Errorf("Admin.RenameOrg returned %+v, want %+v", resp, want) } @@ -147,8 +147,8 @@ func TestCreateOrgRequest_Marshal(t *testing.T) { testJSONMarshal(t, &createOrgRequest{}, "{}") u := &createOrgRequest{ - Login: String("l"), - Admin: String("a"), + Login: Ptr("l"), + Admin: Ptr("a"), } want := `{ @@ -164,7 +164,7 @@ func TestRenameOrgRequest_Marshal(t *testing.T) { testJSONMarshal(t, &renameOrgRequest{}, "{}") u := &renameOrgRequest{ - Login: String("l"), + Login: Ptr("l"), } want := `{ @@ -179,8 +179,8 @@ func TestRenameOrgResponse_Marshal(t *testing.T) { testJSONMarshal(t, &renameOrgRequest{}, "{}") u := &RenameOrgResponse{ - Message: String("m"), - URL: String("u"), + Message: Ptr("m"), + URL: Ptr("u"), } want := `{ diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index e12f6df5fcf..02b5d83bfcb 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -156,58 +156,58 @@ func TestAdminService_Stringify(t *testing.T) { var testAdminStats = &AdminStats{ Repos: &RepoStats{ - TotalRepos: Int(212), - RootRepos: Int(194), - ForkRepos: Int(18), - OrgRepos: Int(51), - TotalPushes: Int(3082), - TotalWikis: Int(15), + TotalRepos: Ptr(212), + RootRepos: Ptr(194), + ForkRepos: Ptr(18), + OrgRepos: Ptr(51), + TotalPushes: Ptr(3082), + TotalWikis: Ptr(15), }, Hooks: &HookStats{ - TotalHooks: Int(27), - ActiveHooks: Int(23), - InactiveHooks: Int(4), + TotalHooks: Ptr(27), + ActiveHooks: Ptr(23), + InactiveHooks: Ptr(4), }, Pages: &PageStats{ - TotalPages: Int(36), + TotalPages: Ptr(36), }, Orgs: &OrgStats{ - TotalOrgs: Int(33), - DisabledOrgs: Int(0), - TotalTeams: Int(60), - TotalTeamMembers: Int(314), + TotalOrgs: Ptr(33), + DisabledOrgs: Ptr(0), + TotalTeams: Ptr(60), + TotalTeamMembers: Ptr(314), }, Users: &UserStats{ - TotalUsers: Int(254), - AdminUsers: Int(45), - SuspendedUsers: Int(21), + TotalUsers: Ptr(254), + AdminUsers: Ptr(45), + SuspendedUsers: Ptr(21), }, Pulls: &PullStats{ - TotalPulls: Int(86), - MergedPulls: Int(60), - MergablePulls: Int(21), - UnmergablePulls: Int(3), + TotalPulls: Ptr(86), + MergedPulls: Ptr(60), + MergablePulls: Ptr(21), + UnmergablePulls: Ptr(3), }, Issues: &IssueStats{ - TotalIssues: Int(179), - OpenIssues: Int(83), - ClosedIssues: Int(96), + TotalIssues: Ptr(179), + OpenIssues: Ptr(83), + ClosedIssues: Ptr(96), }, Milestones: &MilestoneStats{ - TotalMilestones: Int(7), - OpenMilestones: Int(6), - ClosedMilestones: Int(1), + TotalMilestones: Ptr(7), + OpenMilestones: Ptr(6), + ClosedMilestones: Ptr(1), }, Gists: &GistStats{ - TotalGists: Int(178), - PrivateGists: Int(151), - PublicGists: Int(25), + TotalGists: Ptr(178), + PrivateGists: Ptr(151), + PublicGists: Ptr(25), }, Comments: &CommentStats{ - TotalCommitComments: Int(6), - TotalGistComments: Int(28), - TotalIssueComments: Int(366), - TotalPullRequestComments: Int(30), + TotalCommitComments: Ptr(6), + TotalGistComments: Ptr(28), + TotalIssueComments: Ptr(366), + TotalPullRequestComments: Ptr(30), }, } @@ -216,9 +216,9 @@ func TestIssueStats_Marshal(t *testing.T) { testJSONMarshal(t, &IssueStats{}, "{}") u := &IssueStats{ - TotalIssues: Int(1), - OpenIssues: Int(1), - ClosedIssues: Int(1), + TotalIssues: Ptr(1), + OpenIssues: Ptr(1), + ClosedIssues: Ptr(1), } want := `{ @@ -235,9 +235,9 @@ func TestHookStats_Marshal(t *testing.T) { testJSONMarshal(t, &HookStats{}, "{}") u := &HookStats{ - TotalHooks: Int(1), - ActiveHooks: Int(1), - InactiveHooks: Int(1), + TotalHooks: Ptr(1), + ActiveHooks: Ptr(1), + InactiveHooks: Ptr(1), } want := `{ @@ -254,9 +254,9 @@ func TestMilestoneStats_Marshal(t *testing.T) { testJSONMarshal(t, &MilestoneStats{}, "{}") u := &MilestoneStats{ - TotalMilestones: Int(1), - OpenMilestones: Int(1), - ClosedMilestones: Int(1), + TotalMilestones: Ptr(1), + OpenMilestones: Ptr(1), + ClosedMilestones: Ptr(1), } want := `{ @@ -273,10 +273,10 @@ func TestOrgStats_Marshal(t *testing.T) { testJSONMarshal(t, &OrgStats{}, "{}") u := &OrgStats{ - TotalOrgs: Int(1), - DisabledOrgs: Int(1), - TotalTeams: Int(1), - TotalTeamMembers: Int(1), + TotalOrgs: Ptr(1), + DisabledOrgs: Ptr(1), + TotalTeams: Ptr(1), + TotalTeamMembers: Ptr(1), } want := `{ @@ -294,10 +294,10 @@ func TestCommentStats_Marshal(t *testing.T) { testJSONMarshal(t, &CommentStats{}, "{}") u := &CommentStats{ - TotalCommitComments: Int(1), - TotalGistComments: Int(1), - TotalIssueComments: Int(1), - TotalPullRequestComments: Int(1), + TotalCommitComments: Ptr(1), + TotalGistComments: Ptr(1), + TotalIssueComments: Ptr(1), + TotalPullRequestComments: Ptr(1), } want := `{ @@ -315,7 +315,7 @@ func TestPageStats_Marshal(t *testing.T) { testJSONMarshal(t, &PageStats{}, "{}") u := &PageStats{ - TotalPages: Int(1), + TotalPages: Ptr(1), } want := `{ @@ -330,9 +330,9 @@ func TestUserStats_Marshal(t *testing.T) { testJSONMarshal(t, &UserStats{}, "{}") u := &UserStats{ - TotalUsers: Int(1), - AdminUsers: Int(1), - SuspendedUsers: Int(1), + TotalUsers: Ptr(1), + AdminUsers: Ptr(1), + SuspendedUsers: Ptr(1), } want := `{ @@ -349,9 +349,9 @@ func TestGistStats_Marshal(t *testing.T) { testJSONMarshal(t, &GistStats{}, "{}") u := &GistStats{ - TotalGists: Int(1), - PrivateGists: Int(1), - PublicGists: Int(1), + TotalGists: Ptr(1), + PrivateGists: Ptr(1), + PublicGists: Ptr(1), } want := `{ @@ -368,10 +368,10 @@ func TestPullStats_Marshal(t *testing.T) { testJSONMarshal(t, &PullStats{}, "{}") u := &PullStats{ - TotalPulls: Int(1), - MergedPulls: Int(1), - MergablePulls: Int(1), - UnmergablePulls: Int(1), + TotalPulls: Ptr(1), + MergedPulls: Ptr(1), + MergablePulls: Ptr(1), + UnmergablePulls: Ptr(1), } want := `{ @@ -389,12 +389,12 @@ func TestRepoStats_Marshal(t *testing.T) { testJSONMarshal(t, &RepoStats{}, "{}") u := &RepoStats{ - TotalRepos: Int(1), - RootRepos: Int(1), - ForkRepos: Int(1), - OrgRepos: Int(1), - TotalPushes: Int(1), - TotalWikis: Int(1), + TotalRepos: Ptr(1), + RootRepos: Ptr(1), + ForkRepos: Ptr(1), + OrgRepos: Ptr(1), + TotalPushes: Ptr(1), + TotalWikis: Ptr(1), } want := `{ @@ -415,58 +415,58 @@ func TestAdminStats_Marshal(t *testing.T) { u := &AdminStats{ Repos: &RepoStats{ - TotalRepos: Int(212), - RootRepos: Int(194), - ForkRepos: Int(18), - OrgRepos: Int(51), - TotalPushes: Int(3082), - TotalWikis: Int(15), + TotalRepos: Ptr(212), + RootRepos: Ptr(194), + ForkRepos: Ptr(18), + OrgRepos: Ptr(51), + TotalPushes: Ptr(3082), + TotalWikis: Ptr(15), }, Hooks: &HookStats{ - TotalHooks: Int(27), - ActiveHooks: Int(23), - InactiveHooks: Int(4), + TotalHooks: Ptr(27), + ActiveHooks: Ptr(23), + InactiveHooks: Ptr(4), }, Pages: &PageStats{ - TotalPages: Int(36), + TotalPages: Ptr(36), }, Orgs: &OrgStats{ - TotalOrgs: Int(33), - DisabledOrgs: Int(0), - TotalTeams: Int(60), - TotalTeamMembers: Int(314), + TotalOrgs: Ptr(33), + DisabledOrgs: Ptr(0), + TotalTeams: Ptr(60), + TotalTeamMembers: Ptr(314), }, Users: &UserStats{ - TotalUsers: Int(254), - AdminUsers: Int(45), - SuspendedUsers: Int(21), + TotalUsers: Ptr(254), + AdminUsers: Ptr(45), + SuspendedUsers: Ptr(21), }, Pulls: &PullStats{ - TotalPulls: Int(86), - MergedPulls: Int(60), - MergablePulls: Int(21), - UnmergablePulls: Int(3), + TotalPulls: Ptr(86), + MergedPulls: Ptr(60), + MergablePulls: Ptr(21), + UnmergablePulls: Ptr(3), }, Issues: &IssueStats{ - TotalIssues: Int(179), - OpenIssues: Int(83), - ClosedIssues: Int(96), + TotalIssues: Ptr(179), + OpenIssues: Ptr(83), + ClosedIssues: Ptr(96), }, Milestones: &MilestoneStats{ - TotalMilestones: Int(7), - OpenMilestones: Int(6), - ClosedMilestones: Int(1), + TotalMilestones: Ptr(7), + OpenMilestones: Ptr(6), + ClosedMilestones: Ptr(1), }, Gists: &GistStats{ - TotalGists: Int(178), - PrivateGists: Int(151), - PublicGists: Int(25), + TotalGists: Ptr(178), + PrivateGists: Ptr(151), + PublicGists: Ptr(25), }, Comments: &CommentStats{ - TotalCommitComments: Int(6), - TotalGistComments: Int(28), - TotalIssueComments: Int(366), - TotalPullRequestComments: Int(30), + TotalCommitComments: Ptr(6), + TotalGistComments: Ptr(28), + TotalIssueComments: Ptr(366), + TotalPullRequestComments: Ptr(30), }, } diff --git a/github/admin_test.go b/github/admin_test.go index ae5b86b8998..957a9135bc1 100644 --- a/github/admin_test.go +++ b/github/admin_test.go @@ -20,7 +20,7 @@ func TestAdminService_UpdateUserLDAPMapping(t *testing.T) { client, mux, _ := setup(t) input := &UserLDAPMapping{ - LDAPDN: String("uid=asdf,ou=users,dc=github,dc=com"), + LDAPDN: Ptr("uid=asdf,ou=users,dc=github,dc=com"), } mux.HandleFunc("/admin/ldap/users/u/mapping", func(w http.ResponseWriter, r *http.Request) { @@ -41,8 +41,8 @@ func TestAdminService_UpdateUserLDAPMapping(t *testing.T) { } want := &UserLDAPMapping{ - ID: Int64(1), - LDAPDN: String("uid=asdf,ou=users,dc=github,dc=com"), + ID: Ptr(int64(1)), + LDAPDN: Ptr("uid=asdf,ou=users,dc=github,dc=com"), } if !cmp.Equal(mapping, want) { t.Errorf("Admin.UpdateUserLDAPMapping returned %+v, want %+v", mapping, want) @@ -68,7 +68,7 @@ func TestAdminService_UpdateTeamLDAPMapping(t *testing.T) { client, mux, _ := setup(t) input := &TeamLDAPMapping{ - LDAPDN: String("cn=Enterprise Ops,ou=teams,dc=github,dc=com"), + LDAPDN: Ptr("cn=Enterprise Ops,ou=teams,dc=github,dc=com"), } mux.HandleFunc("/admin/ldap/teams/1/mapping", func(w http.ResponseWriter, r *http.Request) { @@ -89,8 +89,8 @@ func TestAdminService_UpdateTeamLDAPMapping(t *testing.T) { } want := &TeamLDAPMapping{ - ID: Int64(1), - LDAPDN: String("cn=Enterprise Ops,ou=teams,dc=github,dc=com"), + ID: Ptr(int64(1)), + LDAPDN: Ptr("cn=Enterprise Ops,ou=teams,dc=github,dc=com"), } if !cmp.Equal(mapping, want) { t.Errorf("Admin.UpdateTeamLDAPMapping returned %+v, want %+v", mapping, want) @@ -114,16 +114,16 @@ func TestAdminService_UpdateTeamLDAPMapping(t *testing.T) { func TestAdminService_TeamLDAPMapping_String(t *testing.T) { t.Parallel() v := &TeamLDAPMapping{ - ID: Int64(1), - LDAPDN: String("a"), - URL: String("b"), - Name: String("c"), - Slug: String("d"), - Description: String("e"), - Privacy: String("f"), - Permission: String("g"), - MembersURL: String("h"), - RepositoriesURL: String("i"), + 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"), } want := `github.TeamLDAPMapping{ID:1, LDAPDN:"a", URL:"b", Name:"c", Slug:"d", Description:"e", Privacy:"f", Permission:"g", MembersURL:"h", RepositoriesURL:"i"}` @@ -135,23 +135,23 @@ func TestAdminService_TeamLDAPMapping_String(t *testing.T) { func TestAdminService_UserLDAPMapping_String(t *testing.T) { t.Parallel() v := &UserLDAPMapping{ - ID: Int64(1), - LDAPDN: String("a"), - Login: String("b"), - AvatarURL: String("c"), - GravatarID: String("d"), - Type: String("e"), - SiteAdmin: Bool(true), - URL: String("f"), - EventsURL: String("g"), - FollowingURL: String("h"), - FollowersURL: String("i"), - GistsURL: String("j"), - OrganizationsURL: String("k"), - ReceivedEventsURL: String("l"), - ReposURL: String("m"), - StarredURL: String("n"), - SubscriptionsURL: String("o"), + 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"), } 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"}` @@ -165,16 +165,16 @@ func TestTeamLDAPMapping_Marshal(t *testing.T) { testJSONMarshal(t, &TeamLDAPMapping{}, "{}") u := &TeamLDAPMapping{ - ID: Int64(1), - LDAPDN: String("ldapdn"), - URL: String("u"), - Name: String("n"), - Slug: String("s"), - Description: String("d"), - Privacy: String("p"), - Permission: String("per"), - MembersURL: String("mu"), - RepositoriesURL: String("ru"), + ID: Ptr(int64(1)), + LDAPDN: Ptr("ldapdn"), + URL: Ptr("u"), + Name: Ptr("n"), + Slug: Ptr("s"), + Description: Ptr("d"), + Privacy: Ptr("p"), + Permission: Ptr("per"), + MembersURL: Ptr("mu"), + RepositoriesURL: Ptr("ru"), } want := `{ @@ -198,23 +198,23 @@ func TestUserLDAPMapping_Marshal(t *testing.T) { testJSONMarshal(t, &UserLDAPMapping{}, "{}") u := &UserLDAPMapping{ - ID: Int64(1), - LDAPDN: String("ldapdn"), - Login: String("l"), - AvatarURL: String("au"), - GravatarID: String("gi"), - Type: String("t"), - SiteAdmin: Bool(true), - URL: String("u"), - EventsURL: String("eu"), - FollowingURL: String("fu"), - FollowersURL: String("fu"), - GistsURL: String("gu"), - OrganizationsURL: String("ou"), - ReceivedEventsURL: String("reu"), - ReposURL: String("ru"), - StarredURL: String("su"), - SubscriptionsURL: String("subu"), + ID: Ptr(int64(1)), + LDAPDN: Ptr("ldapdn"), + Login: Ptr("l"), + AvatarURL: Ptr("au"), + GravatarID: Ptr("gi"), + Type: Ptr("t"), + SiteAdmin: Ptr(true), + URL: Ptr("u"), + EventsURL: Ptr("eu"), + FollowingURL: Ptr("fu"), + FollowersURL: Ptr("fu"), + GistsURL: Ptr("gu"), + OrganizationsURL: Ptr("ou"), + ReceivedEventsURL: Ptr("reu"), + ReposURL: Ptr("ru"), + StarredURL: Ptr("su"), + SubscriptionsURL: Ptr("subu"), } want := `{ @@ -245,14 +245,14 @@ func TestEnterprise_Marshal(t *testing.T) { testJSONMarshal(t, &Enterprise{}, "{}") u := &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } diff --git a/github/admin_users_test.go b/github/admin_users_test.go index e0094255858..4806c53461e 100644 --- a/github/admin_users_test.go +++ b/github/admin_users_test.go @@ -25,7 +25,7 @@ func TestAdminUsers_Create(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") - want := &CreateUserRequest{Login: "github", Email: String("email@domain.com"), Suspended: Bool(false)} + want := &CreateUserRequest{Login: "github", Email: Ptr("email@domain.com"), Suspended: Ptr(false)} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -36,14 +36,14 @@ func TestAdminUsers_Create(t *testing.T) { ctx := context.Background() org, _, err := client.Admin.CreateUser(ctx, CreateUserRequest{ Login: "github", - Email: String("email@domain.com"), - Suspended: Bool(false), + Email: Ptr("email@domain.com"), + Suspended: Ptr(false), }) if err != nil { t.Errorf("Admin.CreateUser returned error: %v", err) } - want := &User{ID: Int64(1), Login: String("github")} + want := &User{ID: Ptr(int64(1)), Login: Ptr("github")} if !cmp.Equal(org, want) { t.Errorf("Admin.CreateUser returned %+v, want %+v", org, want) } @@ -52,8 +52,8 @@ func TestAdminUsers_Create(t *testing.T) { testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { got, resp, err := client.Admin.CreateUser(ctx, CreateUserRequest{ Login: "github", - Email: String("email@domain.com"), - Suspended: Bool(false), + Email: Ptr("email@domain.com"), + Suspended: Ptr(false), }) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) @@ -123,16 +123,16 @@ func TestUserImpersonation_Create(t *testing.T) { date := Timestamp{Time: time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)} want := &UserAuthorization{ - ID: Int64(1234), - URL: String("https://git.company.com/api/v3/authorizations/1234"), + ID: Ptr(int64(1234)), + URL: Ptr("https://git.company.com/api/v3/authorizations/1234"), App: &OAuthAPP{ - Name: String("GitHub Site Administrator"), - URL: String("https://docs.github.com/en/rest/enterprise/users/"), - ClientID: String("1234"), + Name: Ptr("GitHub Site Administrator"), + URL: Ptr("https://docs.github.com/en/rest/enterprise/users/"), + ClientID: Ptr("1234"), }, - Token: String("1234"), - HashedToken: String("1234"), - TokenLastEight: String("1234"), + Token: Ptr("1234"), + HashedToken: Ptr("1234"), + TokenLastEight: Ptr("1234"), Note: nil, NoteURL: nil, CreatedAt: &date, @@ -190,7 +190,7 @@ func TestCreateUserRequest_Marshal(t *testing.T) { u := &CreateUserRequest{ Login: "l", - Email: String("e"), + Email: Ptr("e"), } want := `{ @@ -223,9 +223,9 @@ func TestOAuthAPP_Marshal(t *testing.T) { testJSONMarshal(t, &OAuthAPP{}, "{}") u := &OAuthAPP{ - URL: String("u"), - Name: String("n"), - ClientID: String("cid"), + URL: Ptr("u"), + Name: Ptr("n"), + ClientID: Ptr("cid"), } want := `{ @@ -242,24 +242,24 @@ func TestUserAuthorization_Marshal(t *testing.T) { testJSONMarshal(t, &UserAuthorization{}, "{}") u := &UserAuthorization{ - ID: Int64(1), - URL: String("u"), + ID: Ptr(int64(1)), + URL: Ptr("u"), Scopes: []string{ "s", }, - Token: String("t"), - TokenLastEight: String("tle"), - HashedToken: String("ht"), + Token: Ptr("t"), + TokenLastEight: Ptr("tle"), + HashedToken: Ptr("ht"), App: &OAuthAPP{ - URL: String("u"), - Name: String("n"), - ClientID: String("cid"), + URL: Ptr("u"), + Name: Ptr("n"), + ClientID: Ptr("cid"), }, - Note: String("n"), - NoteURL: String("nu"), + Note: Ptr("n"), + NoteURL: Ptr("nu"), UpdatedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, - Fingerprint: String("f"), + Fingerprint: Ptr("f"), } want := `{ diff --git a/github/apps.go b/github/apps.go index 4757dedfaa9..9d87960e35f 100644 --- a/github/apps.go +++ b/github/apps.go @@ -402,7 +402,7 @@ func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id i //meta:operation POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) { u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID) - payload := &Attachment{Title: String(title), Body: String(body)} + payload := &Attachment{Title: Ptr(title), Body: Ptr(body)} req, err := s.client.NewRequest("POST", u, payload) if err != nil { return nil, nil, err diff --git a/github/apps_hooks_deliveries_test.go b/github/apps_hooks_deliveries_test.go index 2fdc2c6c83c..a5036d2ed76 100644 --- a/github/apps_hooks_deliveries_test.go +++ b/github/apps_hooks_deliveries_test.go @@ -33,7 +33,7 @@ func TestAppsService_ListHookDeliveries(t *testing.T) { t.Errorf("Apps.ListHookDeliveries returned error: %v", err) } - want := []*HookDelivery{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*HookDelivery{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if d := cmp.Diff(deliveries, want); d != "" { t.Errorf("Apps.ListHooks want (-), got (+):\n%s", d) } @@ -63,7 +63,7 @@ func TestAppsService_GetHookDelivery(t *testing.T) { t.Errorf("Apps.GetHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Int64(1)} + want := &HookDelivery{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Apps.GetHookDelivery returned %+v, want %+v", hook, want) } @@ -98,7 +98,7 @@ func TestAppsService_RedeliverHookDelivery(t *testing.T) { t.Errorf("Apps.RedeliverHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Int64(1)} + want := &HookDelivery{ID: Ptr(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 e55b995193c..42545bd8a7c 100644 --- a/github/apps_hooks_test.go +++ b/github/apps_hooks_test.go @@ -35,10 +35,10 @@ func TestAppsService_GetHookConfig(t *testing.T) { } want := &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("0"), - Secret: String("********"), - URL: String("https://example.com/webhook"), + ContentType: Ptr("json"), + InsecureSSL: Ptr("0"), + Secret: Ptr("********"), + URL: Ptr("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Apps.GetHookConfig returned %+v, want %+v", config, want) @@ -59,10 +59,10 @@ func TestAppsService_UpdateHookConfig(t *testing.T) { client, mux, _ := setup(t) input := &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("1"), - Secret: String("s"), - URL: String("u"), + ContentType: Ptr("json"), + InsecureSSL: Ptr("1"), + Secret: Ptr("s"), + URL: Ptr("u"), } mux.HandleFunc("/app/hook/config", func(w http.ResponseWriter, r *http.Request) { @@ -83,10 +83,10 @@ func TestAppsService_UpdateHookConfig(t *testing.T) { } want := &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("1"), - Secret: String("********"), - URL: String("u"), + ContentType: Ptr("json"), + InsecureSSL: Ptr("1"), + Secret: Ptr("********"), + URL: Ptr("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 0a121bfd6cb..48521504f7a 100644 --- a/github/apps_installation_test.go +++ b/github/apps_installation_test.go @@ -41,7 +41,7 @@ func TestAppsService_ListRepos(t *testing.T) { t.Errorf("Apps.ListRepos returned error: %v", err) } - want := &ListRepositories{TotalCount: Int(1), Repositories: []*Repository{{ID: Int64(1)}}} + want := &ListRepositories{TotalCount: Ptr(1), Repositories: []*Repository{{ID: Ptr(int64(1))}}} if !cmp.Equal(repositories, want) { t.Errorf("Apps.ListRepos returned %+v, want %+v", repositories, want) } @@ -82,7 +82,7 @@ func TestAppsService_ListUserRepos(t *testing.T) { t.Errorf("Apps.ListUserRepos returned error: %v", err) } - want := &ListRepositories{TotalCount: Int(1), Repositories: []*Repository{{ID: Int64(1)}}} + want := &ListRepositories{TotalCount: Ptr(1), Repositories: []*Repository{{ID: Ptr(int64(1))}}} if !cmp.Equal(repositories, want) { t.Errorf("Apps.ListUserRepos returned %+v, want %+v", repositories, want) } @@ -117,7 +117,7 @@ func TestAppsService_AddRepository(t *testing.T) { t.Errorf("Apps.AddRepository returned error: %v", err) } - want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} + want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), Owner: &User{Login: Ptr("l")}, License: &License{Key: Ptr("mit")}} if !cmp.Equal(repo, want) { t.Errorf("AddRepository returned %+v, want %+v", repo, want) } @@ -179,12 +179,12 @@ func TestListRepositories_Marshal(t *testing.T) { testJSONMarshal(t, &ListRepositories{}, "{}") u := &ListRepositories{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ { - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, } diff --git a/github/apps_manifest_test.go b/github/apps_manifest_test.go index 35e5db2fd96..ed5e38ff976 100644 --- a/github/apps_manifest_test.go +++ b/github/apps_manifest_test.go @@ -41,11 +41,11 @@ func TestGetConfig(t *testing.T) { } want := &AppConfig{ - ID: Int64(1), - ClientID: String("a"), - ClientSecret: String("b"), - WebhookSecret: String("c"), - PEM: String("key"), + ID: Ptr(int64(1)), + ClientID: Ptr("a"), + ClientSecret: Ptr("b"), + WebhookSecret: Ptr("c"), + PEM: Ptr("key"), } if !cmp.Equal(cfg, want) { @@ -72,39 +72,39 @@ func TestAppConfig_Marshal(t *testing.T) { testJSONMarshal(t, &AppConfig{}, "{}") u := &AppConfig{ - ID: Int64(1), - Slug: String("s"), - NodeID: String("nid"), + ID: Ptr(int64(1)), + Slug: Ptr("s"), + NodeID: Ptr("nid"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Name: String("n"), - Description: String("d"), - ExternalURL: String("eu"), - HTMLURL: String("hu"), + Name: Ptr("n"), + Description: Ptr("d"), + ExternalURL: Ptr("eu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - ClientID: String("ci"), - ClientSecret: String("cs"), - WebhookSecret: String("ws"), - PEM: String("pem"), + ClientID: Ptr("ci"), + ClientSecret: Ptr("cs"), + WebhookSecret: Ptr("ws"), + PEM: Ptr("pem"), } want := `{ diff --git a/github/apps_marketplace_test.go b/github/apps_marketplace_test.go index 3780bad0965..a3664114e90 100644 --- a/github/apps_marketplace_test.go +++ b/github/apps_marketplace_test.go @@ -35,7 +35,7 @@ func TestMarketplaceService_ListPlans(t *testing.T) { t.Errorf("Marketplace.ListPlans returned error: %v", err) } - want := []*MarketplacePlan{{ID: Int64(1)}} + want := []*MarketplacePlan{{ID: Ptr(int64(1))}} if !cmp.Equal(plans, want) { t.Errorf("Marketplace.ListPlans returned %+v, want %+v", plans, want) } @@ -67,7 +67,7 @@ func TestMarketplaceService_Stubbed_ListPlans(t *testing.T) { t.Errorf("Marketplace.ListPlans (Stubbed) returned error: %v", err) } - want := []*MarketplacePlan{{ID: Int64(1)}} + want := []*MarketplacePlan{{ID: Ptr(int64(1))}} if !cmp.Equal(plans, want) { t.Errorf("Marketplace.ListPlans (Stubbed) returned %+v, want %+v", plans, want) } @@ -90,7 +90,7 @@ func TestMarketplaceService_ListPlanAccountsForPlan(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForPlan returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Int64(1)}} + want := []*MarketplacePlanAccount{{ID: Ptr(int64(1))}} if !cmp.Equal(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForPlan returned %+v, want %+v", accounts, want) } @@ -122,7 +122,7 @@ func TestMarketplaceService_Stubbed_ListPlanAccountsForPlan(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForPlan (Stubbed) returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Int64(1)}} + want := []*MarketplacePlanAccount{{ID: Ptr(int64(1))}} if !cmp.Equal(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForPlan (Stubbed) returned %+v, want %+v", accounts, want) } @@ -144,7 +144,7 @@ func TestMarketplaceService_GetPlanAccountForAccount(t *testing.T) { t.Errorf("Marketplace.GetPlanAccountForAccount returned error: %v", err) } - want := &MarketplacePlanAccount{ID: Int64(1), MarketplacePendingChange: &MarketplacePendingChange{ID: Int64(77)}} + want := &MarketplacePlanAccount{ID: Ptr(int64(1)), MarketplacePendingChange: &MarketplacePendingChange{ID: Ptr(int64(77))}} if !cmp.Equal(account, want) { t.Errorf("Marketplace.GetPlanAccountForAccount returned %+v, want %+v", account, want) } @@ -175,7 +175,7 @@ func TestMarketplaceService_Stubbed_GetPlanAccountForAccount(t *testing.T) { t.Errorf("Marketplace.GetPlanAccountForAccount (Stubbed) returned error: %v", err) } - want := &MarketplacePlanAccount{ID: Int64(1)} + want := &MarketplacePlanAccount{ID: Ptr(int64(1))} if !cmp.Equal(account, want) { t.Errorf("Marketplace.GetPlanAccountForAccount (Stubbed) returned %+v, want %+v", account, want) } @@ -198,7 +198,7 @@ func TestMarketplaceService_ListMarketplacePurchasesForUser(t *testing.T) { t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned error: %v", err) } - want := []*MarketplacePurchase{{BillingCycle: String("monthly")}} + want := []*MarketplacePurchase{{BillingCycle: Ptr("monthly")}} if !cmp.Equal(purchases, want) { t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned %+v, want %+v", purchases, want) } @@ -230,7 +230,7 @@ func TestMarketplaceService_Stubbed_ListMarketplacePurchasesForUser(t *testing.T t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned error: %v", err) } - want := []*MarketplacePurchase{{BillingCycle: String("monthly")}} + want := []*MarketplacePurchase{{BillingCycle: Ptr("monthly")}} if !cmp.Equal(purchases, want) { t.Errorf("Marketplace.ListMarketplacePurchasesForUser returned %+v, want %+v", purchases, want) } @@ -241,19 +241,19 @@ func TestMarketplacePlan_Marshal(t *testing.T) { testJSONMarshal(t, &MarketplacePlan{}, "{}") u := &MarketplacePlan{ - URL: String("u"), - AccountsURL: String("au"), - ID: Int64(1), - Number: Int(1), - Name: String("n"), - Description: String("d"), - MonthlyPriceInCents: Int(1), - YearlyPriceInCents: Int(1), - PriceModel: String("pm"), - UnitName: String("un"), + URL: Ptr("u"), + AccountsURL: Ptr("au"), + ID: Ptr(int64(1)), + Number: Ptr(1), + Name: Ptr("n"), + Description: Ptr("d"), + MonthlyPriceInCents: Ptr(1), + YearlyPriceInCents: Ptr(1), + PriceModel: Ptr("pm"), + UnitName: Ptr("un"), Bullets: &[]string{"b"}, - State: String("s"), - HasFreeTrial: Bool(false), + State: Ptr("s"), + HasFreeTrial: Ptr(false), } want := `{ @@ -280,25 +280,25 @@ func TestMarketplacePurchase_Marshal(t *testing.T) { testJSONMarshal(t, &MarketplacePurchase{}, "{}") u := &MarketplacePurchase{ - BillingCycle: String("bc"), + BillingCycle: Ptr("bc"), NextBillingDate: &Timestamp{referenceTime}, - UnitCount: Int(1), + UnitCount: Ptr(1), Plan: &MarketplacePlan{ - URL: String("u"), - AccountsURL: String("au"), - ID: Int64(1), - Number: Int(1), - Name: String("n"), - Description: String("d"), - MonthlyPriceInCents: Int(1), - YearlyPriceInCents: Int(1), - PriceModel: String("pm"), - UnitName: String("un"), + URL: Ptr("u"), + AccountsURL: Ptr("au"), + ID: Ptr(int64(1)), + Number: Ptr(1), + Name: Ptr("n"), + Description: Ptr("d"), + MonthlyPriceInCents: Ptr(1), + YearlyPriceInCents: Ptr(1), + PriceModel: Ptr("pm"), + UnitName: Ptr("un"), Bullets: &[]string{"b"}, - State: String("s"), - HasFreeTrial: Bool(false), + State: Ptr("s"), + HasFreeTrial: Ptr(false), }, - OnFreeTrial: Bool(false), + OnFreeTrial: Ptr(false), FreeTrialEndsOn: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -336,22 +336,22 @@ func TestMarketplacePendingChange_Marshal(t *testing.T) { u := &MarketplacePendingChange{ EffectiveDate: &Timestamp{referenceTime}, - UnitCount: Int(1), - ID: Int64(1), + UnitCount: Ptr(1), + ID: Ptr(int64(1)), Plan: &MarketplacePlan{ - URL: String("u"), - AccountsURL: String("au"), - ID: Int64(1), - Number: Int(1), - Name: String("n"), - Description: String("d"), - MonthlyPriceInCents: Int(1), - YearlyPriceInCents: Int(1), - PriceModel: String("pm"), - UnitName: String("un"), + URL: Ptr("u"), + AccountsURL: Ptr("au"), + ID: Ptr(int64(1)), + Number: Ptr(1), + Name: Ptr("n"), + Description: Ptr("d"), + MonthlyPriceInCents: Ptr(1), + YearlyPriceInCents: Ptr(1), + PriceModel: Ptr("pm"), + UnitName: Ptr("un"), Bullets: &[]string{"b"}, - State: String("s"), - HasFreeTrial: Bool(false), + State: Ptr("s"), + HasFreeTrial: Ptr(false), }, } @@ -384,52 +384,52 @@ func TestMarketplacePlanAccount_Marshal(t *testing.T) { testJSONMarshal(t, &MarketplacePlanAccount{}, "{}") u := &MarketplacePlanAccount{ - URL: String("u"), - Type: String("t"), - ID: Int64(1), - Login: String("l"), - OrganizationBillingEmail: String("obe"), + URL: Ptr("u"), + Type: Ptr("t"), + ID: Ptr(int64(1)), + Login: Ptr("l"), + OrganizationBillingEmail: Ptr("obe"), MarketplacePurchase: &MarketplacePurchase{ - BillingCycle: String("bc"), + BillingCycle: Ptr("bc"), NextBillingDate: &Timestamp{referenceTime}, - UnitCount: Int(1), + UnitCount: Ptr(1), Plan: &MarketplacePlan{ - URL: String("u"), - AccountsURL: String("au"), - ID: Int64(1), - Number: Int(1), - Name: String("n"), - Description: String("d"), - MonthlyPriceInCents: Int(1), - YearlyPriceInCents: Int(1), - PriceModel: String("pm"), - UnitName: String("un"), + URL: Ptr("u"), + AccountsURL: Ptr("au"), + ID: Ptr(int64(1)), + Number: Ptr(1), + Name: Ptr("n"), + Description: Ptr("d"), + MonthlyPriceInCents: Ptr(1), + YearlyPriceInCents: Ptr(1), + PriceModel: Ptr("pm"), + UnitName: Ptr("un"), Bullets: &[]string{"b"}, - State: String("s"), - HasFreeTrial: Bool(false), + State: Ptr("s"), + HasFreeTrial: Ptr(false), }, - OnFreeTrial: Bool(false), + OnFreeTrial: Ptr(false), FreeTrialEndsOn: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, MarketplacePendingChange: &MarketplacePendingChange{ EffectiveDate: &Timestamp{referenceTime}, - UnitCount: Int(1), - ID: Int64(1), + UnitCount: Ptr(1), + ID: Ptr(int64(1)), Plan: &MarketplacePlan{ - URL: String("u"), - AccountsURL: String("au"), - ID: Int64(1), - Number: Int(1), - Name: String("n"), - Description: String("d"), - MonthlyPriceInCents: Int(1), - YearlyPriceInCents: Int(1), - PriceModel: String("pm"), - UnitName: String("un"), + URL: Ptr("u"), + AccountsURL: Ptr("au"), + ID: Ptr(int64(1)), + Number: Ptr(1), + Name: Ptr("n"), + Description: Ptr("d"), + MonthlyPriceInCents: Ptr(1), + YearlyPriceInCents: Ptr(1), + PriceModel: Ptr("pm"), + UnitName: Ptr("un"), Bullets: &[]string{"b"}, - State: String("s"), - HasFreeTrial: Bool(false), + State: Ptr("s"), + HasFreeTrial: Ptr(false), }, }, } diff --git a/github/apps_test.go b/github/apps_test.go index 8356e63634f..060281a50b5 100644 --- a/github/apps_test.go +++ b/github/apps_test.go @@ -31,7 +31,7 @@ func TestAppsService_Get_authenticatedApp(t *testing.T) { t.Errorf("Apps.Get returned error: %v", err) } - want := &App{ID: Int64(1)} + want := &App{ID: Ptr(int64(1))} if !cmp.Equal(app, want) { t.Errorf("Apps.Get returned %+v, want %+v", app, want) } @@ -66,7 +66,7 @@ func TestAppsService_Get_specifiedApp(t *testing.T) { t.Errorf("Apps.Get returned error: %v", err) } - want := &App{HTMLURL: String("https://github.com/apps/a")} + want := &App{HTMLURL: Ptr("https://github.com/apps/a")} if !cmp.Equal(app, want) { t.Errorf("Apps.Get returned %+v, want %+v", *app.HTMLURL, *want.HTMLURL) } @@ -100,9 +100,9 @@ func TestAppsService_ListInstallationRequests(t *testing.T) { date := Timestamp{Time: time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)} want := []*InstallationRequest{{ - ID: Int64(1), - Account: &User{ID: Int64(2)}, - Requester: &User{ID: Int64(3)}, + ID: Ptr(int64(1)), + Account: &User{ID: Ptr(int64(2))}, + Requester: &User{ID: Ptr(int64(3))}, CreatedAt: &date, }} if !cmp.Equal(installationRequests, want) { @@ -192,49 +192,49 @@ func TestAppsService_ListInstallations(t *testing.T) { date := Timestamp{Time: time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)} want := []*Installation{{ - ID: Int64(1), - AppID: Int64(1), - TargetID: Int64(1), - TargetType: String("Organization"), - SingleFileName: String("config.yml"), - RepositorySelection: String("selected"), + ID: Ptr(int64(1)), + AppID: Ptr(int64(1)), + TargetID: Ptr(int64(1)), + TargetType: Ptr("Organization"), + SingleFileName: Ptr("config.yml"), + RepositorySelection: Ptr("selected"), Permissions: &InstallationPermissions{ - Actions: String("read"), - Administration: String("read"), - Checks: String("read"), - Contents: String("read"), - ContentReferences: String("read"), - Deployments: String("read"), - Environments: String("read"), - Issues: String("write"), - Metadata: String("read"), - Members: String("read"), - OrganizationAdministration: String("write"), - OrganizationCustomRoles: String("write"), - OrganizationHooks: String("write"), - OrganizationPackages: String("write"), - OrganizationPersonalAccessTokens: String("read"), - OrganizationPersonalAccessTokenRequests: String("read"), - OrganizationPlan: String("read"), - OrganizationPreReceiveHooks: String("write"), - OrganizationProjects: String("read"), - OrganizationSecrets: String("read"), - OrganizationSelfHostedRunners: String("read"), - OrganizationUserBlocking: String("write"), - Packages: String("read"), - Pages: String("read"), - PullRequests: String("write"), - RepositoryHooks: String("write"), - RepositoryProjects: String("read"), - RepositoryPreReceiveHooks: String("read"), - Secrets: String("read"), - SecretScanningAlerts: String("read"), - SecurityEvents: String("read"), - SingleFile: String("write"), - Statuses: String("write"), - TeamDiscussions: String("read"), - VulnerabilityAlerts: String("read"), - Workflows: String("write")}, + 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")}, Events: []string{"push", "pull_request"}, CreatedAt: &date, UpdatedAt: &date, @@ -268,7 +268,7 @@ func TestAppsService_GetInstallation(t *testing.T) { t.Errorf("Apps.GetInstallation returned error: %v", err) } - want := &Installation{ID: Int64(1), AppID: Int64(1), TargetID: Int64(1), TargetType: String("Organization")} + want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.GetInstallation returned %+v, want %+v", installation, want) } @@ -308,7 +308,7 @@ func TestAppsService_ListUserInstallations(t *testing.T) { t.Errorf("Apps.ListUserInstallations returned error: %v", err) } - want := []*Installation{{ID: Int64(1), AppID: Int64(1), TargetID: Int64(1), TargetType: String("Organization")}} + want := []*Installation{{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")}} if !cmp.Equal(installations, want) { t.Errorf("Apps.ListUserInstallations returned %+v, want %+v", installations, want) } @@ -416,7 +416,7 @@ func TestAppsService_CreateInstallationToken(t *testing.T) { t.Errorf("Apps.CreateInstallationToken returned error: %v", err) } - want := &InstallationToken{Token: String("t")} + want := &InstallationToken{Token: Ptr("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationToken returned %+v, want %+v", token, want) } @@ -444,8 +444,8 @@ func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) { RepositoryIDs: []int64{1234}, Repositories: []string{"foo"}, Permissions: &InstallationPermissions{ - Contents: String("write"), - Issues: String("read"), + Contents: Ptr("write"), + Issues: Ptr("read"), }, } @@ -467,7 +467,7 @@ func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) { t.Errorf("Apps.CreateInstallationToken returned error: %v", err) } - want := &InstallationToken{Token: String("t")} + want := &InstallationToken{Token: Ptr("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationToken returned %+v, want %+v", token, want) } @@ -480,8 +480,8 @@ func TestAppsService_CreateInstallationTokenListReposWithOptions(t *testing.T) { installationTokenListRepoOptions := &InstallationTokenListRepoOptions{ Repositories: []string{"foo"}, Permissions: &InstallationPermissions{ - Contents: String("write"), - Issues: String("read"), + Contents: Ptr("write"), + Issues: Ptr("read"), }, } @@ -503,7 +503,7 @@ func TestAppsService_CreateInstallationTokenListReposWithOptions(t *testing.T) { t.Errorf("Apps.CreateInstallationTokenListRepos returned error: %v", err) } - want := &InstallationToken{Token: String("t")} + want := &InstallationToken{Token: Ptr("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationTokenListRepos returned %+v, want %+v", token, want) } @@ -524,7 +524,7 @@ func TestAppsService_CreateInstallationTokenListReposWithNoOptions(t *testing.T) t.Errorf("Apps.CreateInstallationTokenListRepos returned error: %v", err) } - want := &InstallationToken{Token: String("t")} + want := &InstallationToken{Token: Ptr("t")} if !cmp.Equal(token, want) { t.Errorf("Apps.CreateInstallationTokenListRepos returned %+v, want %+v", token, want) } @@ -562,7 +562,7 @@ func TestAppsService_CreateAttachment(t *testing.T) { t.Errorf("CreateAttachment returned error: %v", err) } - want := &Attachment{ID: Int64(1), Title: String("title1"), Body: String("body1")} + want := &Attachment{ID: Ptr(int64(1)), Title: Ptr("title1"), Body: Ptr("body1")} if !cmp.Equal(got, want) { t.Errorf("CreateAttachment = %+v, want %+v", got, want) } @@ -597,7 +597,7 @@ func TestAppsService_FindOrganizationInstallation(t *testing.T) { t.Errorf("Apps.FindOrganizationInstallation returned error: %v", err) } - want := &Installation{ID: Int64(1), AppID: Int64(1), TargetID: Int64(1), TargetType: String("Organization")} + want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.FindOrganizationInstallation returned %+v, want %+v", installation, want) } @@ -632,7 +632,7 @@ func TestAppsService_FindRepositoryInstallation(t *testing.T) { t.Errorf("Apps.FindRepositoryInstallation returned error: %v", err) } - want := &Installation{ID: Int64(1), AppID: Int64(1), TargetID: Int64(1), TargetType: String("Organization")} + want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.FindRepositoryInstallation returned %+v, want %+v", installation, want) } @@ -667,7 +667,7 @@ func TestAppsService_FindRepositoryInstallationByID(t *testing.T) { t.Errorf("Apps.FindRepositoryInstallationByID returned error: %v", err) } - want := &Installation{ID: Int64(1), AppID: Int64(1), TargetID: Int64(1), TargetType: String("Organization")} + want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")} if !cmp.Equal(installation, want) { t.Errorf("Apps.FindRepositoryInstallationByID returned %+v, want %+v", installation, want) } @@ -702,7 +702,7 @@ func TestAppsService_FindUserInstallation(t *testing.T) { t.Errorf("Apps.FindUserInstallation returned error: %v", err) } - want := &Installation{ID: Int64(1), AppID: Int64(1), TargetID: Int64(1), TargetType: String("User")} + want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("User")} if !cmp.Equal(installation, want) { t.Errorf("Apps.FindUserInstallation returned %+v, want %+v", installation, want) } @@ -727,9 +727,9 @@ func TestContentReference_Marshal(t *testing.T) { testJSONMarshal(t, &ContentReference{}, "{}") u := &ContentReference{ - ID: Int64(1), - NodeID: String("nid"), - Reference: String("r"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Reference: Ptr("r"), } want := `{ @@ -746,9 +746,9 @@ func TestAttachment_Marshal(t *testing.T) { testJSONMarshal(t, &Attachment{}, "{}") u := &Attachment{ - ID: Int64(1), - Title: String("t"), - Body: String("b"), + ID: Ptr(int64(1)), + Title: Ptr("t"), + Body: Ptr("b"), } want := `{ @@ -765,39 +765,39 @@ func TestInstallationPermissions_Marshal(t *testing.T) { testJSONMarshal(t, &InstallationPermissions{}, "{}") u := &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationCustomOrgRoles: String("ocr"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationCustomOrgRoles: Ptr("ocr"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), } want := `{ @@ -844,95 +844,95 @@ func TestInstallation_Marshal(t *testing.T) { testJSONMarshal(t, &Installation{}, "{}") u := &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - ActionsVariables: String("ac"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationCustomOrgRoles: String("ocr"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + ActionsVariables: Ptr("ac"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationCustomOrgRoles: Ptr("ocr"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -1049,40 +1049,40 @@ func TestInstallationTokenOptions_Marshal(t *testing.T) { u := &InstallationTokenOptions{ RepositoryIDs: []int64{1}, Permissions: &InstallationPermissions{ - Actions: String("a"), - ActionsVariables: String("ac"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationCustomOrgRoles: String("ocr"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + ActionsVariables: Ptr("ac"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationCustomOrgRoles: Ptr("ocr"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, } @@ -1134,49 +1134,49 @@ func TestInstallationToken_Marshal(t *testing.T) { testJSONMarshal(t, &InstallationToken{}, "{}") u := &InstallationToken{ - Token: String("t"), + Token: Ptr("t"), ExpiresAt: &Timestamp{referenceTime}, Permissions: &InstallationPermissions{ - Actions: String("a"), - ActionsVariables: String("ac"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationCustomOrgRoles: String("ocr"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + ActionsVariables: Ptr("ac"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationCustomOrgRoles: Ptr("ocr"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, Repositories: []*Repository{ { - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, } @@ -1237,70 +1237,70 @@ func TestApp_Marshal(t *testing.T) { testJSONMarshal(t, &App{}, "{}") u := &App{ - ID: Int64(1), - Slug: String("s"), - NodeID: String("nid"), + ID: Ptr(int64(1)), + Slug: Ptr("s"), + NodeID: Ptr("nid"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Name: String("n"), - Description: String("d"), - ExternalURL: String("eu"), - HTMLURL: String("hu"), + Name: Ptr("n"), + Description: Ptr("d"), + ExternalURL: Ptr("eu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, Permissions: &InstallationPermissions{ - Actions: String("a"), - ActionsVariables: String("ac"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationCustomOrgRoles: String("ocr"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + ActionsVariables: Ptr("ac"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationCustomOrgRoles: Ptr("ocr"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, Events: []string{"s"}, } diff --git a/github/authorizations_test.go b/github/authorizations_test.go index 6c644996515..1a0612a5080 100644 --- a/github/authorizations_test.go +++ b/github/authorizations_test.go @@ -31,7 +31,7 @@ func TestAuthorizationsService_Check(t *testing.T) { t.Errorf("Authorizations.Check returned error: %v", err) } - want := &Authorization{ID: Int64(1)} + want := &Authorization{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Authorizations.Check returned auth %+v, want %+v", got, want) } @@ -68,7 +68,7 @@ func TestAuthorizationsService_Reset(t *testing.T) { t.Errorf("Authorizations.Reset returned error: %v", err) } - want := &Authorization{ID: Int64(1)} + want := &Authorization{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Authorizations.Reset returned auth %+v, want %+v", got, want) } @@ -159,7 +159,7 @@ func TestAuthorizationsService_CreateImpersonation(t *testing.T) { t.Errorf("Authorizations.CreateImpersonation returned error: %+v", err) } - want := &Authorization{ID: Int64(1)} + want := &Authorization{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Authorizations.CreateImpersonation returned %+v, want %+v", *got.ID, *want.ID) } @@ -212,9 +212,9 @@ func TestAuthorizationUpdateRequest_Marshal(t *testing.T) { Scopes: []string{"s"}, AddScopes: []string{"a"}, RemoveScopes: []string{"r"}, - Note: String("n"), - NoteURL: String("nu"), - Fingerprint: String("f"), + Note: Ptr("n"), + NoteURL: Ptr("nu"), + Fingerprint: Ptr("f"), } want := `{ @@ -235,11 +235,11 @@ func TestAuthorizationRequest_Marshal(t *testing.T) { u := &AuthorizationRequest{ Scopes: []Scope{"s"}, - ClientID: String("cid"), - ClientSecret: String("cs"), - Note: String("n"), - NoteURL: String("nu"), - Fingerprint: String("f"), + ClientID: Ptr("cid"), + ClientSecret: Ptr("cs"), + Note: Ptr("n"), + NoteURL: Ptr("nu"), + Fingerprint: Ptr("f"), } want := `{ @@ -259,9 +259,9 @@ func TestAuthorizationApp_Marshal(t *testing.T) { testJSONMarshal(t, &AuthorizationApp{}, "{}") u := &AuthorizationApp{ - URL: String("u"), - Name: String("n"), - ClientID: String("cid"), + URL: Ptr("u"), + Name: Ptr("n"), + ClientID: Ptr("cid"), } want := `{ @@ -278,12 +278,12 @@ func TestGrant_Marshal(t *testing.T) { testJSONMarshal(t, &Grant{}, "{}") u := &Grant{ - ID: Int64(1), - URL: String("u"), + ID: Ptr(int64(1)), + URL: Ptr("u"), App: &AuthorizationApp{ - URL: String("u"), - Name: String("n"), - ClientID: String("cid"), + URL: Ptr("u"), + Name: Ptr("n"), + ClientID: Ptr("cid"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, @@ -311,39 +311,39 @@ func TestAuthorization_Marshal(t *testing.T) { testJSONMarshal(t, &Authorization{}, "{}") u := &Authorization{ - ID: Int64(1), - URL: String("u"), + ID: Ptr(int64(1)), + URL: Ptr("u"), Scopes: []Scope{"s"}, - Token: String("t"), - TokenLastEight: String("tle"), - HashedToken: String("ht"), + Token: Ptr("t"), + TokenLastEight: Ptr("tle"), + HashedToken: Ptr("ht"), App: &AuthorizationApp{ - URL: String("u"), - Name: String("n"), - ClientID: String("cid"), + URL: Ptr("u"), + Name: Ptr("n"), + ClientID: Ptr("cid"), }, - Note: String("n"), - NoteURL: String("nu"), + Note: Ptr("n"), + NoteURL: Ptr("nu"), UpdatedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, - Fingerprint: String("f"), + Fingerprint: Ptr("f"), User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, diff --git a/github/billing_test.go b/github/billing_test.go index 716f50d3c6b..8fb6499c186 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -472,12 +472,12 @@ func TestBillingService_GetAdvancedSecurityActiveCommittersOrg(t *testing.T) { PurchasedAdvancedSecurityCommitters: 4, Repositories: []*RepositoryActiveCommitters{ { - Name: String("octocat-org/Hello-World"), - AdvancedSecurityCommitters: Int(2), + Name: Ptr("octocat-org/Hello-World"), + AdvancedSecurityCommitters: Ptr(2), AdvancedSecurityCommittersBreakdown: []*AdvancedSecurityCommittersBreakdown{ { - UserLogin: String("octokitten"), - LastPushedDate: String("2021-10-25"), + UserLogin: Ptr("octokitten"), + LastPushedDate: Ptr("2021-10-25"), }, }, }, diff --git a/github/checks_test.go b/github/checks_test.go index 08e934c8d8a..ba3b082017f 100644 --- a/github/checks_test.go +++ b/github/checks_test.go @@ -39,12 +39,12 @@ func TestChecksService_GetCheckRun(t *testing.T) { completeAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") want := &CheckRun{ - ID: Int64(1), - Status: String("completed"), - Conclusion: String("neutral"), + ID: Ptr(int64(1)), + Status: Ptr("completed"), + Conclusion: Ptr("neutral"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{completeAt}, - Name: String("testCheckRun"), + Name: Ptr("testCheckRun"), } if !cmp.Equal(checkRun, want) { t.Errorf("Checks.GetCheckRun return %+v, want %+v", checkRun, want) @@ -87,13 +87,13 @@ func TestChecksService_GetCheckSuite(t *testing.T) { t.Errorf("Checks.GetCheckSuite return error: %v", err) } want := &CheckSuite{ - ID: Int64(1), - HeadBranch: String("master"), - HeadSHA: String("deadbeef"), - AfterSHA: String("deadbeefa"), - BeforeSHA: String("deadbeefb"), - Status: String("completed"), - Conclusion: String("neutral"), + ID: Ptr(int64(1)), + HeadBranch: Ptr("master"), + HeadSHA: Ptr("deadbeef"), + AfterSHA: Ptr("deadbeefa"), + BeforeSHA: Ptr("deadbeefb"), + Status: Ptr("completed"), + Conclusion: Ptr("neutral"), } if !cmp.Equal(checkSuite, want) { t.Errorf("Checks.GetCheckSuite return %+v, want %+v", checkSuite, want) @@ -135,12 +135,12 @@ func TestChecksService_CreateCheckRun(t *testing.T) { checkRunOpt := CreateCheckRunOptions{ Name: "testCreateCheckRun", HeadSHA: "deadbeef", - Status: String("in_progress"), + Status: Ptr("in_progress"), StartedAt: &Timestamp{startedAt}, Output: &CheckRunOutput{ - Title: String("Mighty test report"), - Summary: String(""), - Text: String(""), + Title: Ptr("Mighty test report"), + Summary: Ptr(""), + Text: Ptr(""), }, } @@ -151,15 +151,15 @@ func TestChecksService_CreateCheckRun(t *testing.T) { } want := &CheckRun{ - ID: Int64(1), - Status: String("in_progress"), + ID: Ptr(int64(1)), + Status: Ptr("in_progress"), StartedAt: &Timestamp{startedAt}, - HeadSHA: String("deadbeef"), - Name: String("testCreateCheckRun"), + HeadSHA: Ptr("deadbeef"), + Name: Ptr("testCreateCheckRun"), Output: &CheckRunOutput{ - Title: String("Mighty test report"), - Summary: String(""), - Text: String(""), + Title: Ptr("Mighty test report"), + Summary: Ptr(""), + Text: Ptr(""), }, } if !cmp.Equal(checkRun, want) { @@ -211,15 +211,15 @@ func TestChecksService_ListCheckRunAnnotations(t *testing.T) { } want := []*CheckRunAnnotation{{ - Path: String("README.md"), - StartLine: Int(2), - EndLine: Int(2), - StartColumn: Int(1), - EndColumn: Int(5), - AnnotationLevel: String("warning"), - Message: String("Check your spelling for 'banaas'."), - Title: String("Spell check"), - RawDetails: String("Do you mean 'bananas' or 'banana'?"), + 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'?"), }} if !cmp.Equal(checkRunAnnotations, want) { @@ -260,12 +260,12 @@ func TestChecksService_UpdateCheckRun(t *testing.T) { startedAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") updateCheckRunOpt := UpdateCheckRunOptions{ Name: "testUpdateCheckRun", - Status: String("completed"), + Status: Ptr("completed"), CompletedAt: &Timestamp{startedAt}, Output: &CheckRunOutput{ - Title: String("Mighty test report"), - Summary: String("There are 0 failures, 2 warnings and 1 notice"), - Text: String("You may have misspelled some words."), + Title: Ptr("Mighty test report"), + Summary: Ptr("There are 0 failures, 2 warnings and 1 notice"), + Text: Ptr("You may have misspelled some words."), }, } @@ -276,16 +276,16 @@ func TestChecksService_UpdateCheckRun(t *testing.T) { } want := &CheckRun{ - ID: Int64(1), - Status: String("completed"), + ID: Ptr(int64(1)), + Status: Ptr("completed"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{startedAt}, - Conclusion: String("neutral"), - Name: String("testUpdateCheckRun"), + Conclusion: Ptr("neutral"), + Name: Ptr("testUpdateCheckRun"), Output: &CheckRunOutput{ - Title: String("Mighty test report"), - Summary: String("There are 0 failures, 2 warnings and 1 notice"), - Text: String("You may have misspelled some words."), + Title: Ptr("Mighty test report"), + Summary: Ptr("There are 0 failures, 2 warnings and 1 notice"), + Text: Ptr("You may have misspelled some words."), }, } if !cmp.Equal(checkRun, want) { @@ -335,10 +335,10 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { }) opt := &ListCheckRunsOptions{ - CheckName: String("testing"), - Status: String("completed"), - Filter: String("all"), - AppID: Int64(1), + CheckName: Ptr("testing"), + Status: Ptr("completed"), + Filter: Ptr("all"), + AppID: Ptr(int64(1)), ListOptions: ListOptions{Page: 1}, } ctx := context.Background() @@ -348,15 +348,15 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { } startedAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") want := &ListCheckRunsResults{ - Total: Int(1), + Total: Ptr(1), CheckRuns: []*CheckRun{{ - ID: Int64(1), - Status: String("completed"), + ID: Ptr(int64(1)), + Status: Ptr("completed"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{startedAt}, - Conclusion: String("neutral"), - HeadSHA: String("deadbeef"), - App: &App{ID: Int64(1)}, + Conclusion: Ptr("neutral"), + HeadSHA: Ptr("deadbeef"), + App: &App{ID: Ptr(int64(1))}, }}, } @@ -404,9 +404,9 @@ func TestChecksService_ListCheckRunsCheckSuite(t *testing.T) { }) opt := &ListCheckRunsOptions{ - CheckName: String("testing"), - Status: String("completed"), - Filter: String("all"), + CheckName: Ptr("testing"), + Status: Ptr("completed"), + Filter: Ptr("all"), ListOptions: ListOptions{Page: 1}, } ctx := context.Background() @@ -416,14 +416,14 @@ func TestChecksService_ListCheckRunsCheckSuite(t *testing.T) { } startedAt, _ := time.Parse(time.RFC3339, "2018-05-04T01:14:52Z") want := &ListCheckRunsResults{ - Total: Int(1), + Total: Ptr(1), CheckRuns: []*CheckRun{{ - ID: Int64(1), - Status: String("completed"), + ID: Ptr(int64(1)), + Status: Ptr("completed"), StartedAt: &Timestamp{startedAt}, CompletedAt: &Timestamp{startedAt}, - Conclusion: String("neutral"), - HeadSHA: String("deadbeef"), + Conclusion: Ptr("neutral"), + HeadSHA: Ptr("deadbeef"), }}, } @@ -471,8 +471,8 @@ func TestChecksService_ListCheckSuiteForRef(t *testing.T) { }) opt := &ListCheckSuiteOptions{ - CheckName: String("testing"), - AppID: Int(2), + CheckName: Ptr("testing"), + AppID: Ptr(2), ListOptions: ListOptions{Page: 1}, } ctx := context.Background() @@ -481,15 +481,15 @@ func TestChecksService_ListCheckSuiteForRef(t *testing.T) { t.Errorf("Checks.ListCheckSuitesForRef return error: %v", err) } want := &ListCheckSuiteResults{ - Total: Int(1), + Total: Ptr(1), CheckSuites: []*CheckSuite{{ - ID: Int64(1), - Status: String("completed"), - Conclusion: String("neutral"), - HeadSHA: String("deadbeef"), - HeadBranch: String("master"), - BeforeSHA: String("deadbeefb"), - AfterSHA: String("deadbeefa"), + ID: Ptr(int64(1)), + Status: Ptr("completed"), + Conclusion: Ptr("neutral"), + HeadSHA: Ptr("deadbeef"), + HeadBranch: Ptr("master"), + BeforeSHA: Ptr("deadbeefb"), + AfterSHA: Ptr("deadbeefa"), }}, } @@ -523,8 +523,8 @@ func TestChecksService_SetCheckSuitePreferences(t *testing.T) { fmt.Fprint(w, `{"preferences":{"auto_trigger_checks":[{"app_id": 2,"setting": false}]}}`) }) a := []*AutoTriggerCheck{{ - AppID: Int64(2), - Setting: Bool(false), + AppID: Ptr(int64(2)), + Setting: Ptr(false), }} opt := CheckSuitePreferenceOptions{AutoTriggerChecks: a} ctx := context.Background() @@ -578,7 +578,7 @@ func TestChecksService_CreateCheckSuite(t *testing.T) { checkSuiteOpt := CreateCheckSuiteOptions{ HeadSHA: "deadbeef", - HeadBranch: String("master"), + HeadBranch: Ptr("master"), } ctx := context.Background() @@ -588,13 +588,13 @@ func TestChecksService_CreateCheckSuite(t *testing.T) { } want := &CheckSuite{ - ID: Int64(2), - Status: String("completed"), - HeadSHA: String("deadbeef"), - HeadBranch: String("master"), - Conclusion: String("neutral"), - BeforeSHA: String("deadbeefb"), - AfterSHA: String("deadbeefa"), + ID: Ptr(int64(2)), + Status: Ptr("completed"), + HeadSHA: Ptr("deadbeef"), + HeadBranch: Ptr("master"), + Conclusion: Ptr("neutral"), + BeforeSHA: Ptr("deadbeefb"), + AfterSHA: Ptr("deadbeefa"), } if !cmp.Equal(checkSuite, want) { t.Errorf("Checks.CreateCheckSuite return %+v, want %+v", checkSuite, want) @@ -648,86 +648,86 @@ func Test_CheckRunMarshal(t *testing.T) { ts := now.Format(time.RFC3339Nano) c := CheckRun{ - ID: Int64(1), - NodeID: String("n"), - HeadSHA: String("h"), - ExternalID: String("1"), - URL: String("u"), - HTMLURL: String("u"), - DetailsURL: String("u"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + HeadSHA: Ptr("h"), + ExternalID: Ptr("1"), + URL: Ptr("u"), + HTMLURL: Ptr("u"), + DetailsURL: Ptr("u"), + Status: Ptr("s"), + Conclusion: Ptr("c"), StartedAt: &Timestamp{Time: now}, CompletedAt: &Timestamp{Time: now}, Output: &CheckRunOutput{ Annotations: []*CheckRunAnnotation{ { - AnnotationLevel: String("a"), - EndLine: Int(1), - Message: String("m"), - Path: String("p"), - RawDetails: String("r"), - StartLine: Int(1), - Title: String("t"), + AnnotationLevel: Ptr("a"), + EndLine: Ptr(1), + Message: Ptr("m"), + Path: Ptr("p"), + RawDetails: Ptr("r"), + StartLine: Ptr(1), + Title: Ptr("t"), }, }, - AnnotationsCount: Int(1), - AnnotationsURL: String("a"), + AnnotationsCount: Ptr(1), + AnnotationsURL: Ptr("a"), Images: []*CheckRunImage{ { - Alt: String("a"), - ImageURL: String("i"), - Caption: String("c"), + Alt: Ptr("a"), + ImageURL: Ptr("i"), + Caption: Ptr("c"), }, }, - Title: String("t"), - Summary: String("s"), - Text: String("t"), + Title: Ptr("t"), + Summary: Ptr("s"), + Text: Ptr("t"), }, - Name: String("n"), + Name: Ptr("n"), CheckSuite: &CheckSuite{ - ID: Int64(1), + ID: Ptr(int64(1)), }, App: &App{ - ID: Int64(1), - NodeID: String("n"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Name: String("n"), - Description: String("d"), - HTMLURL: String("h"), - ExternalURL: String("u"), + Name: Ptr("n"), + Description: Ptr("d"), + HTMLURL: Ptr("h"), + ExternalURL: Ptr("u"), CreatedAt: &Timestamp{now}, UpdatedAt: &Timestamp{now}, }, PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, @@ -831,68 +831,68 @@ func Test_CheckSuiteMarshal(t *testing.T) { ts := now.Format(time.RFC3339Nano) c := CheckSuite{ - ID: Int64(1), - NodeID: String("n"), - HeadBranch: String("h"), - HeadSHA: String("h"), - URL: String("u"), - BeforeSHA: String("b"), - AfterSHA: String("a"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + HeadBranch: Ptr("h"), + HeadSHA: Ptr("h"), + URL: Ptr("u"), + BeforeSHA: Ptr("b"), + AfterSHA: Ptr("a"), + Status: Ptr("s"), + Conclusion: Ptr("c"), App: &App{ - ID: Int64(1), - NodeID: String("n"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Name: String("n"), - Description: String("d"), - HTMLURL: String("h"), - ExternalURL: String("u"), + Name: Ptr("n"), + Description: Ptr("d"), + HTMLURL: Ptr("h"), + ExternalURL: Ptr("u"), CreatedAt: &Timestamp{now}, UpdatedAt: &Timestamp{now}, }, Repository: &Repository{ - ID: Int64(1), + ID: Ptr(int64(1)), }, PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, }, HeadCommit: &Commit{ - SHA: String("s"), + SHA: Ptr("s"), }, - LatestCheckRunsCount: Int64(1), - Rerequstable: Bool(true), - RunsRerequstable: Bool(true), + LatestCheckRunsCount: Ptr(int64(1)), + Rerequstable: Ptr(true), + RunsRerequstable: Ptr(true), } w := fmt.Sprintf(`{ @@ -968,15 +968,15 @@ func TestCheckRunAnnotation_Marshal(t *testing.T) { testJSONMarshal(t, &CheckRunAnnotation{}, "{}") u := &CheckRunAnnotation{ - Path: String("p"), - StartLine: Int(1), - EndLine: Int(1), - StartColumn: Int(1), - EndColumn: Int(1), - AnnotationLevel: String("al"), - Message: String("m"), - Title: String("t"), - RawDetails: String("rd"), + Path: Ptr("p"), + StartLine: Ptr(1), + EndLine: Ptr(1), + StartColumn: Ptr(1), + EndColumn: Ptr(1), + AnnotationLevel: Ptr("al"), + Message: Ptr("m"), + Title: Ptr("t"), + RawDetails: Ptr("rd"), } want := `{ @@ -999,9 +999,9 @@ func TestCheckRunImage_Marshal(t *testing.T) { testJSONMarshal(t, &CheckRunImage{}, "{}") u := &CheckRunImage{ - Alt: String("a"), - ImageURL: String("i"), - Caption: String("c"), + Alt: Ptr("a"), + ImageURL: Ptr("i"), + Caption: Ptr("c"), } want := `{ @@ -1037,8 +1037,8 @@ func TestAutoTriggerCheck_Marshal(t *testing.T) { testJSONMarshal(t, &AutoTriggerCheck{}, "{}") u := &AutoTriggerCheck{ - AppID: Int64(1), - Setting: Bool(false), + AppID: Ptr(int64(1)), + Setting: Ptr(false), } want := `{ @@ -1055,7 +1055,7 @@ func TestCreateCheckSuiteOptions_Marshal(t *testing.T) { u := &CreateCheckSuiteOptions{ HeadSHA: "hsha", - HeadBranch: String("hb"), + HeadBranch: Ptr("hb"), } want := `{ @@ -1071,29 +1071,29 @@ func TestCheckRunOutput_Marshal(t *testing.T) { testJSONMarshal(t, &CheckRunOutput{}, "{}") u := &CheckRunOutput{ - Title: String("ti"), - Summary: String("s"), - Text: String("t"), - AnnotationsCount: Int(1), - AnnotationsURL: String("au"), + Title: Ptr("ti"), + Summary: Ptr("s"), + Text: Ptr("t"), + AnnotationsCount: Ptr(1), + AnnotationsURL: Ptr("au"), Annotations: []*CheckRunAnnotation{ { - Path: String("p"), - StartLine: Int(1), - EndLine: Int(1), - StartColumn: Int(1), - EndColumn: Int(1), - AnnotationLevel: String("al"), - Message: String("m"), - Title: String("t"), - RawDetails: String("rd"), + Path: Ptr("p"), + StartLine: Ptr(1), + EndLine: Ptr(1), + StartColumn: Ptr(1), + EndColumn: Ptr(1), + AnnotationLevel: Ptr("al"), + Message: Ptr("m"), + Title: Ptr("t"), + RawDetails: Ptr("rd"), }, }, Images: []*CheckRunImage{ { - Alt: String("a"), - ImageURL: String("i"), - Caption: String("c"), + Alt: Ptr("a"), + ImageURL: Ptr("i"), + Caption: Ptr("c"), }, }, } @@ -1136,36 +1136,36 @@ func TestCreateCheckRunOptions_Marshal(t *testing.T) { u := &CreateCheckRunOptions{ Name: "n", HeadSHA: "hsha", - DetailsURL: String("durl"), - ExternalID: String("eid"), - Status: String("s"), - Conclusion: String("c"), + DetailsURL: Ptr("durl"), + ExternalID: Ptr("eid"), + Status: Ptr("s"), + Conclusion: Ptr("c"), StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, Output: &CheckRunOutput{ - Title: String("ti"), - Summary: String("s"), - Text: String("t"), - AnnotationsCount: Int(1), - AnnotationsURL: String("au"), + Title: Ptr("ti"), + Summary: Ptr("s"), + Text: Ptr("t"), + AnnotationsCount: Ptr(1), + AnnotationsURL: Ptr("au"), Annotations: []*CheckRunAnnotation{ { - Path: String("p"), - StartLine: Int(1), - EndLine: Int(1), - StartColumn: Int(1), - EndColumn: Int(1), - AnnotationLevel: String("al"), - Message: String("m"), - Title: String("t"), - RawDetails: String("rd"), + Path: Ptr("p"), + StartLine: Ptr(1), + EndLine: Ptr(1), + StartColumn: Ptr(1), + EndColumn: Ptr(1), + AnnotationLevel: Ptr("al"), + Message: Ptr("m"), + Title: Ptr("t"), + RawDetails: Ptr("rd"), }, }, Images: []*CheckRunImage{ { - Alt: String("a"), - ImageURL: String("i"), - Caption: String("c"), + Alt: Ptr("a"), + ImageURL: Ptr("i"), + Caption: Ptr("c"), }, }, }, @@ -1232,35 +1232,35 @@ func TestUpdateCheckRunOptions_Marshal(t *testing.T) { u := &UpdateCheckRunOptions{ Name: "n", - DetailsURL: String("durl"), - ExternalID: String("eid"), - Status: String("s"), - Conclusion: String("c"), + DetailsURL: Ptr("durl"), + ExternalID: Ptr("eid"), + Status: Ptr("s"), + Conclusion: Ptr("c"), CompletedAt: &Timestamp{referenceTime}, Output: &CheckRunOutput{ - Title: String("ti"), - Summary: String("s"), - Text: String("t"), - AnnotationsCount: Int(1), - AnnotationsURL: String("au"), + Title: Ptr("ti"), + Summary: Ptr("s"), + Text: Ptr("t"), + AnnotationsCount: Ptr(1), + AnnotationsURL: Ptr("au"), Annotations: []*CheckRunAnnotation{ { - Path: String("p"), - StartLine: Int(1), - EndLine: Int(1), - StartColumn: Int(1), - EndColumn: Int(1), - AnnotationLevel: String("al"), - Message: String("m"), - Title: String("t"), - RawDetails: String("rd"), + Path: Ptr("p"), + StartLine: Ptr(1), + EndLine: Ptr(1), + StartColumn: Ptr(1), + EndColumn: Ptr(1), + AnnotationLevel: Ptr("al"), + Message: Ptr("m"), + Title: Ptr("t"), + RawDetails: Ptr("rd"), }, }, Images: []*CheckRunImage{ { - Alt: String("a"), - ImageURL: String("i"), - Caption: String("c"), + Alt: Ptr("a"), + ImageURL: Ptr("i"), + Caption: Ptr("c"), }, }, }, @@ -1324,89 +1324,89 @@ func TestListCheckRunsResults_Marshal(t *testing.T) { testJSONMarshal(t, &ListCheckRunsResults{}, "{}") l := &ListCheckRunsResults{ - Total: Int(1), + Total: Ptr(1), CheckRuns: []*CheckRun{ { - ID: Int64(1), - NodeID: String("n"), - HeadSHA: String("h"), - ExternalID: String("1"), - URL: String("u"), - HTMLURL: String("u"), - DetailsURL: String("u"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + HeadSHA: Ptr("h"), + ExternalID: Ptr("1"), + URL: Ptr("u"), + HTMLURL: Ptr("u"), + DetailsURL: Ptr("u"), + Status: Ptr("s"), + Conclusion: Ptr("c"), StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, Output: &CheckRunOutput{ Annotations: []*CheckRunAnnotation{ { - AnnotationLevel: String("a"), - EndLine: Int(1), - Message: String("m"), - Path: String("p"), - RawDetails: String("r"), - StartLine: Int(1), - Title: String("t"), + AnnotationLevel: Ptr("a"), + EndLine: Ptr(1), + Message: Ptr("m"), + Path: Ptr("p"), + RawDetails: Ptr("r"), + StartLine: Ptr(1), + Title: Ptr("t"), }, }, - AnnotationsCount: Int(1), - AnnotationsURL: String("a"), + AnnotationsCount: Ptr(1), + AnnotationsURL: Ptr("a"), Images: []*CheckRunImage{ { - Alt: String("a"), - ImageURL: String("i"), - Caption: String("c"), + Alt: Ptr("a"), + ImageURL: Ptr("i"), + Caption: Ptr("c"), }, }, - Title: String("t"), - Summary: String("s"), - Text: String("t"), + Title: Ptr("t"), + Summary: Ptr("s"), + Text: Ptr("t"), }, - Name: String("n"), + Name: Ptr("n"), CheckSuite: &CheckSuite{ - ID: Int64(1), + ID: Ptr(int64(1)), }, App: &App{ - ID: Int64(1), - NodeID: String("n"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Name: String("n"), - Description: String("d"), - HTMLURL: String("h"), - ExternalURL: String("u"), + Name: Ptr("n"), + Description: Ptr("d"), + HTMLURL: Ptr("h"), + ExternalURL: Ptr("u"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, @@ -1515,67 +1515,67 @@ func TestListCheckSuiteResults_Marshal(t *testing.T) { testJSONMarshal(t, &ListCheckSuiteResults{}, "{}") l := &ListCheckSuiteResults{ - Total: Int(1), + Total: Ptr(1), CheckSuites: []*CheckSuite{ { - ID: Int64(1), - NodeID: String("n"), - HeadBranch: String("h"), - HeadSHA: String("h"), - URL: String("u"), - BeforeSHA: String("b"), - AfterSHA: String("a"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + HeadBranch: Ptr("h"), + HeadSHA: Ptr("h"), + URL: Ptr("u"), + BeforeSHA: Ptr("b"), + AfterSHA: Ptr("a"), + Status: Ptr("s"), + Conclusion: Ptr("c"), App: &App{ - ID: Int64(1), - NodeID: String("n"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Name: String("n"), - Description: String("d"), - HTMLURL: String("h"), - ExternalURL: String("u"), + Name: Ptr("n"), + Description: Ptr("d"), + HTMLURL: Ptr("h"), + ExternalURL: Ptr("u"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Repository: &Repository{ - ID: Int64(1), + ID: Ptr(int64(1)), }, PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, }, HeadCommit: &Commit{ - SHA: String("s"), + SHA: Ptr("s"), }, }, }, @@ -1658,8 +1658,8 @@ func TestCheckSuitePreferenceOptions_Marshal(t *testing.T) { u := &CheckSuitePreferenceOptions{ AutoTriggerChecks: []*AutoTriggerCheck{ { - AppID: Int64(1), - Setting: Bool(false), + AppID: Ptr(int64(1)), + Setting: Ptr(false), }, }, } @@ -1683,8 +1683,8 @@ func TestPreferenceList_Marshal(t *testing.T) { u := &PreferenceList{ AutoTriggerChecks: []*AutoTriggerCheck{ { - AppID: Int64(1), - Setting: Bool(false), + AppID: Ptr(int64(1)), + Setting: Ptr(false), }, }, } @@ -1709,15 +1709,15 @@ func TestCheckSuitePreferenceResults_Marshal(t *testing.T) { Preferences: &PreferenceList{ AutoTriggerChecks: []*AutoTriggerCheck{ { - AppID: Int64(1), - Setting: Bool(false), + AppID: Ptr(int64(1)), + Setting: Ptr(false), }, }, }, Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, } diff --git a/github/code_scanning_test.go b/github/code_scanning_test.go index 64cb49a1aed..4e9bbc57a79 100644 --- a/github/code_scanning_test.go +++ b/github/code_scanning_test.go @@ -28,7 +28,7 @@ func TestCodeScanningService_Alert_ID(t *testing.T) { // Test: Valid HTMLURL a = &Alert{ - HTMLURL: String("https://github.com/o/r/security/code-scanning/88"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), } id = a.ID() want = 88 @@ -46,7 +46,7 @@ func TestCodeScanningService_Alert_ID(t *testing.T) { // Test: ID can't be parsed as an int a = &Alert{ - HTMLURL: String("https://github.com/o/r/security/code-scanning/bad88"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/bad88"), } id = a.ID() want = 0 @@ -60,15 +60,15 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { client, mux, _ := setup(t) expectedSarifID := &SarifID{ - ID: String("testid"), - URL: String("https://example.com/testurl"), + ID: Ptr("testid"), + URL: Ptr("https://example.com/testurl"), } mux.HandleFunc("/repos/o/r/code-scanning/sarifs", func(w http.ResponseWriter, r *http.Request) { v := new(SarifAnalysis) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") - want := &SarifAnalysis{CommitSHA: String("abc"), Ref: String("ref/head/main"), Sarif: String("abc"), CheckoutURI: String("uri"), StartedAt: &Timestamp{time.Date(2006, time.January, 02, 15, 04, 05, 0, time.UTC)}, ToolName: String("codeql-cli")} + want := &SarifAnalysis{CommitSHA: Ptr("abc"), Ref: Ptr("ref/head/main"), Sarif: Ptr("abc"), CheckoutURI: Ptr("uri"), StartedAt: &Timestamp{time.Date(2006, time.January, 02, 15, 04, 05, 0, time.UTC)}, ToolName: Ptr("codeql-cli")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -79,7 +79,7 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { }) ctx := context.Background() - sarifAnalysis := &SarifAnalysis{CommitSHA: String("abc"), Ref: String("ref/head/main"), Sarif: String("abc"), CheckoutURI: String("uri"), StartedAt: &Timestamp{time.Date(2006, time.January, 02, 15, 04, 05, 0, time.UTC)}, ToolName: String("codeql-cli")} + sarifAnalysis := &SarifAnalysis{CommitSHA: Ptr("abc"), Ref: Ptr("ref/head/main"), Sarif: Ptr("abc"), CheckoutURI: Ptr("uri"), StartedAt: &Timestamp{time.Date(2006, time.January, 02, 15, 04, 05, 0, time.UTC)}, ToolName: Ptr("codeql-cli")} respSarifID, _, err := client.CodeScanning.UploadSarif(ctx, "o", "r", sarifAnalysis) if err != nil { t.Errorf("CodeScanning.UploadSarif returned error: %v", err) @@ -119,8 +119,8 @@ func TestCodeScanningService_GetSARIF(t *testing.T) { } want := &SARIFUpload{ - ProcessingStatus: String("s"), - AnalysesURL: String("u"), + ProcessingStatus: Ptr("s"), + AnalysesURL: Ptr("u"), } if !cmp.Equal(sarifUpload, want) { t.Errorf("CodeScanning.GetSARIF returned %+v, want %+v", sarifUpload, want) @@ -250,77 +250,77 @@ func TestCodeScanningService_ListAlertsForOrg(t *testing.T) { want := []*Alert{ { Repository: &Repository{ - ID: Int64(1), - URL: String("url"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("url"), + Name: Ptr("n"), }, - RuleID: String("js/trivial-conditional"), - RuleSeverity: String("warning"), - RuleDescription: String("Useless conditional"), - Tool: &Tool{Name: String("CodeQL"), GUID: nil, Version: String("1.4.0")}, + RuleID: Ptr("js/trivial-conditional"), + RuleSeverity: Ptr("warning"), + RuleDescription: Ptr("Useless conditional"), + Tool: &Tool{Name: Ptr("CodeQL"), GUID: nil, Version: Ptr("1.4.0")}, Rule: &Rule{ - ID: String("js/trivial-conditional"), - Severity: String("warning"), - Description: String("Useless conditional"), - Name: String("js/trivial-conditional"), - FullDescription: String("Expression has no effect"), - Help: String("Expression has no effect"), + 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"), }, CreatedAt: &date, - State: String("open"), + State: Ptr("open"), ClosedBy: nil, ClosedAt: nil, - URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/25"), - HTMLURL: String("https://github.com/o/r/security/code-scanning/25"), + URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/25"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/25"), MostRecentInstance: &MostRecentInstance{ - Ref: String("refs/heads/main"), - State: String("open"), - CommitSHA: String("abcdefg12345"), + Ref: Ptr("refs/heads/main"), + State: Ptr("open"), + CommitSHA: Ptr("abcdefg12345"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, }, { - RuleID: String("js/useless-expression"), - RuleSeverity: String("warning"), - RuleDescription: String("Expression has no effect"), - Tool: &Tool{Name: String("CodeQL"), GUID: nil, Version: String("1.4.0")}, + 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")}, Rule: &Rule{ - ID: String("js/useless-expression"), - Severity: String("warning"), - Description: String("Expression has no effect"), - Name: String("js/useless-expression"), - FullDescription: String("Expression has no effect"), - Help: String("Expression has no effect"), + 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"), }, CreatedAt: &date, - State: String("open"), + State: Ptr("open"), ClosedBy: nil, ClosedAt: nil, - URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: String("https://github.com/o/r/security/code-scanning/88"), + URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: String("refs/heads/main"), - State: String("open"), - CommitSHA: String("abcdefg12345"), + Ref: Ptr("refs/heads/main"), + State: Ptr("open"), + CommitSHA: Ptr("abcdefg12345"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, @@ -412,41 +412,41 @@ func TestCodeScanningService_ListAlertsForOrgLisCursorOptions(t *testing.T) { want := []*Alert{ { Repository: &Repository{ - ID: Int64(1), - URL: String("url"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("url"), + Name: Ptr("n"), }, - RuleID: String("js/trivial-conditional"), - RuleSeverity: String("warning"), - RuleDescription: String("Useless conditional"), - Tool: &Tool{Name: String("CodeQL"), GUID: nil, Version: String("1.4.0")}, + RuleID: Ptr("js/trivial-conditional"), + RuleSeverity: Ptr("warning"), + RuleDescription: Ptr("Useless conditional"), + Tool: &Tool{Name: Ptr("CodeQL"), GUID: nil, Version: Ptr("1.4.0")}, Rule: &Rule{ - ID: String("js/trivial-conditional"), - Severity: String("warning"), - Description: String("Useless conditional"), - Name: String("js/trivial-conditional"), - FullDescription: String("Expression has no effect"), - Help: String("Expression has no effect"), + 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"), }, CreatedAt: &date, - State: String("open"), + State: Ptr("open"), ClosedBy: nil, ClosedAt: nil, - URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/25"), - HTMLURL: String("https://github.com/o/r/security/code-scanning/25"), + URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/25"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/25"), MostRecentInstance: &MostRecentInstance{ - Ref: String("refs/heads/main"), - State: String("open"), - CommitSHA: String("abcdefg12345"), + Ref: Ptr("refs/heads/main"), + State: Ptr("open"), + CommitSHA: Ptr("abcdefg12345"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, @@ -574,73 +574,73 @@ func TestCodeScanningService_ListAlertsForRepo(t *testing.T) { date := Timestamp{time.Date(2020, time.May, 06, 12, 00, 00, 0, time.UTC)} want := []*Alert{ { - RuleID: String("js/trivial-conditional"), - RuleSeverity: String("warning"), - RuleDescription: String("Useless conditional"), - Tool: &Tool{Name: String("CodeQL"), GUID: nil, Version: String("1.4.0")}, + RuleID: Ptr("js/trivial-conditional"), + RuleSeverity: Ptr("warning"), + RuleDescription: Ptr("Useless conditional"), + Tool: &Tool{Name: Ptr("CodeQL"), GUID: nil, Version: Ptr("1.4.0")}, Rule: &Rule{ - ID: String("js/trivial-conditional"), - Severity: String("warning"), - Description: String("Useless conditional"), - Name: String("js/trivial-conditional"), - FullDescription: String("Expression has no effect"), - Help: String("Expression has no effect"), + 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"), }, CreatedAt: &date, - State: String("open"), + State: Ptr("open"), ClosedBy: nil, ClosedAt: nil, - URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/25"), - HTMLURL: String("https://github.com/o/r/security/code-scanning/25"), + URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/25"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/25"), MostRecentInstance: &MostRecentInstance{ - Ref: String("refs/heads/main"), - State: String("open"), - CommitSHA: String("abcdefg12345"), + Ref: Ptr("refs/heads/main"), + State: Ptr("open"), + CommitSHA: Ptr("abcdefg12345"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, }, { - RuleID: String("js/useless-expression"), - RuleSeverity: String("warning"), - RuleDescription: String("Expression has no effect"), - Tool: &Tool{Name: String("CodeQL"), GUID: nil, Version: String("1.4.0")}, + 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")}, Rule: &Rule{ - ID: String("js/useless-expression"), - Severity: String("warning"), - Description: String("Expression has no effect"), - Name: String("js/useless-expression"), - FullDescription: String("Expression has no effect"), - Help: String("Expression has no effect"), + 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"), }, CreatedAt: &date, - State: String("open"), + State: Ptr("open"), ClosedBy: nil, ClosedAt: nil, - URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: String("https://github.com/o/r/security/code-scanning/88"), + URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: String("refs/heads/main"), - State: String("open"), - CommitSHA: String("abcdefg12345"), + Ref: Ptr("refs/heads/main"), + State: Ptr("open"), + CommitSHA: Ptr("abcdefg12345"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, @@ -716,9 +716,9 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { }) ctx := context.Background() - dismissedComment := String("This alert is not actually correct as sanitizer is used") - dismissedReason := String("false positive") - state := String("dismissed") + dismissedComment := Ptr("This alert is not actually correct as sanitizer is used") + dismissedReason := Ptr("false positive") + state := Ptr("dismissed") stateInfo := &CodeScanningAlertState{State: *state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} alert, _, err := client.CodeScanning.UpdateAlert(ctx, "o", "r", 88, stateInfo) if err != nil { @@ -727,17 +727,17 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { date := Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)} want := &Alert{ - RuleID: String("js/useless-expression"), - RuleSeverity: String("warning"), - RuleDescription: String("Expression has no effect"), - Tool: &Tool{Name: String("CodeQL"), GUID: nil, Version: String("1.4.0")}, + 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")}, Rule: &Rule{ - ID: String("useless expression"), - Severity: String("warning"), - Description: String("Expression has no effect"), - Name: String("useless expression"), - FullDescription: String("Expression has no effect"), - Help: String("Expression has no effect"), + 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"), }, CreatedAt: &date, State: state, @@ -745,21 +745,21 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { DismissedComment: dismissedComment, ClosedBy: nil, ClosedAt: nil, - URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: String("https://github.com/o/r/security/code-scanning/88"), + URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: String("refs/heads/main"), - State: String("dismissed"), - CommitSHA: String("abcdefg12345"), + Ref: Ptr("refs/heads/main"), + State: Ptr("dismissed"), + CommitSHA: Ptr("abcdefg12345"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, @@ -824,21 +824,21 @@ func TestCodeScanningService_ListAlertInstances(t *testing.T) { want := []*MostRecentInstance{ { - Ref: String("refs/heads/main"), - AnalysisKey: String(".github/workflows/codeql-analysis.yml:analyze"), - Category: String(".github/workflows/codeql-analysis.yml:analyze"), - Environment: String(""), - State: String("open"), - CommitSHA: String("abcdefg12345"), + 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"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, @@ -920,37 +920,37 @@ func TestCodeScanningService_GetAlert(t *testing.T) { date := Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)} want := &Alert{ - RuleID: String("js/useless-expression"), - RuleSeverity: String("warning"), - RuleDescription: String("Expression has no effect"), - Tool: &Tool{Name: String("CodeQL"), GUID: nil, Version: String("1.4.0")}, + 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")}, Rule: &Rule{ - ID: String("useless expression"), - Severity: String("warning"), - Description: String("Expression has no effect"), - Name: String("useless expression"), - FullDescription: String("Expression has no effect"), - Help: String("Expression has no effect"), + 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"), }, CreatedAt: &date, - State: String("open"), + State: Ptr("open"), ClosedBy: nil, ClosedAt: nil, - URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/88"), - HTMLURL: String("https://github.com/o/r/security/code-scanning/88"), + URL: Ptr("https://api.github.com/repos/o/r/code-scanning/alerts/88"), + HTMLURL: Ptr("https://github.com/o/r/security/code-scanning/88"), MostRecentInstance: &MostRecentInstance{ - Ref: String("refs/heads/main"), - State: String("open"), - CommitSHA: String("abcdefg12345"), + Ref: Ptr("refs/heads/main"), + State: Ptr("open"), + CommitSHA: Ptr("abcdefg12345"), Message: &Message{ - Text: String("This path depends on a user-provided value."), + Text: Ptr("This path depends on a user-provided value."), }, Location: &Location{ - Path: String("spec-main/api-session-spec.ts"), - StartLine: Int(917), - EndLine: Int(917), - StartColumn: Int(7), - EndColumn: Int(18), + Path: Ptr("spec-main/api-session-spec.ts"), + StartLine: Ptr(917), + EndLine: Ptr(917), + StartColumn: Ptr(7), + EndColumn: Ptr(18), }, Classifications: []string{"test"}, }, @@ -979,28 +979,28 @@ func TestAlert_Marshal(t *testing.T) { testJSONMarshal(t, &Alert{}, "{}") u := &Alert{ - RuleID: String("rid"), - RuleSeverity: String("rs"), - RuleDescription: String("rd"), + RuleID: Ptr("rid"), + RuleSeverity: Ptr("rs"), + RuleDescription: Ptr("rd"), Tool: &Tool{ - Name: String("n"), - GUID: String("g"), - Version: String("v"), + Name: Ptr("n"), + GUID: Ptr("g"), + Version: Ptr("v"), }, CreatedAt: &Timestamp{referenceTime}, - State: String("fixed"), + State: Ptr("fixed"), ClosedBy: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, ClosedAt: &Timestamp{referenceTime}, - URL: String("url"), - HTMLURL: String("hurl"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), } want := `{ @@ -1036,11 +1036,11 @@ func TestLocation_Marshal(t *testing.T) { testJSONMarshal(t, &Location{}, "{}") u := &Location{ - Path: String("path"), - StartLine: Int(1), - EndLine: Int(2), - StartColumn: Int(3), - EndColumn: Int(4), + Path: Ptr("path"), + StartLine: Ptr(1), + EndLine: Ptr(2), + StartColumn: Ptr(3), + EndColumn: Ptr(4), } want := `{ @@ -1059,14 +1059,14 @@ func TestRule_Marshal(t *testing.T) { testJSONMarshal(t, &Rule{}, "{}") u := &Rule{ - ID: String("1"), - Severity: String("3"), - Description: String("description"), - Name: String("first"), - SecuritySeverityLevel: String("2"), - FullDescription: String("summary"), + ID: Ptr("1"), + Severity: Ptr("3"), + Description: Ptr("description"), + Name: Ptr("first"), + SecuritySeverityLevel: Ptr("2"), + FullDescription: Ptr("summary"), Tags: []string{"tag1", "tag2"}, - Help: String("Help Text"), + Help: Ptr("Help Text"), } want := `{ @@ -1088,9 +1088,9 @@ func TestTool_Marshal(t *testing.T) { testJSONMarshal(t, &Tool{}, "{}") u := &Tool{ - Name: String("name"), - GUID: String("guid"), - Version: String("ver"), + Name: Ptr("name"), + GUID: Ptr("guid"), + Version: Ptr("ver"), } want := `{ @@ -1107,7 +1107,7 @@ func TestMessage_Marshal(t *testing.T) { testJSONMarshal(t, &Message{}, "{}") u := &Message{ - Text: String("text"), + Text: Ptr("text"), } want := `{ @@ -1170,7 +1170,7 @@ func TestCodeScanningService_ListAnalysesForRepo(t *testing.T) { ]`) }) - opts := &AnalysesListOptions{SarifID: String("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), Ref: String("heads/master")} + opts := &AnalysesListOptions{SarifID: Ptr("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), Ref: Ptr("heads/master")} ctx := context.Background() analyses, _, err := client.CodeScanning.ListAnalysesForRepo(ctx, "o", "r", opts) if err != nil { @@ -1180,46 +1180,46 @@ func TestCodeScanningService_ListAnalysesForRepo(t *testing.T) { date := &Timestamp{time.Date(2020, time.August, 27, 15, 05, 21, 0, time.UTC)} want := []*ScanningAnalysis{ { - ID: Int64(201), - Ref: String("refs/heads/main"), - CommitSHA: String("d99612c3e1f2970085cfbaeadf8f010ef69bad83"), - AnalysisKey: String(".github/workflows/codeql-analysis.yml:analyze"), - Environment: String("{\"language\":\"python\"}"), - Error: String(""), - Category: String(".github/workflows/codeql-analysis.yml:analyze/language:python"), + 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"), CreatedAt: date, - ResultsCount: Int(17), - RulesCount: Int(49), - URL: String("https://api.github.com/repos/o/r/code-scanning/analyses/201"), - SarifID: String("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), + 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"), Tool: &Tool{ - Name: String("CodeQL"), + Name: Ptr("CodeQL"), GUID: nil, - Version: String("2.4.0"), + Version: Ptr("2.4.0"), }, - Deletable: Bool(true), - Warning: String(""), + Deletable: Ptr(true), + Warning: Ptr(""), }, { - ID: Int64(200), - Ref: String("refs/heads/my-branch"), - CommitSHA: String("c8cff6510d4d084fb1b4aa13b64b97ca12b07321"), - AnalysisKey: String(".github/workflows/shiftleft.yml:build"), - Environment: String("{}"), - Error: String(""), - Category: String(".github/workflows/shiftleft.yml:build/"), + 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/"), CreatedAt: date, - ResultsCount: Int(17), - RulesCount: Int(32), - URL: String("https://api.github.com/repos/o/r/code-scanning/analyses/200"), - SarifID: String("8981cd8e-b078-4ac3-a3be-1dad7dbd0b582"), + 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"), Tool: &Tool{ - Name: String("Python Security ScanningAnalysis"), + Name: Ptr("Python Security ScanningAnalysis"), GUID: nil, - Version: String("1.2.0"), + Version: Ptr("1.2.0"), }, - Deletable: Bool(true), - Warning: String(""), + Deletable: Ptr(true), + Warning: Ptr(""), }, } if !cmp.Equal(analyses, want) { @@ -1278,25 +1278,25 @@ func TestCodeScanningService_GetAnalysis(t *testing.T) { date := &Timestamp{time.Date(2021, time.January, 13, 11, 55, 49, 0, time.UTC)} want := &ScanningAnalysis{ - ID: Int64(3602840), - Ref: String("refs/heads/main"), - CommitSHA: String("c18c69115654ff0166991962832dc2bd7756e655"), - AnalysisKey: String(".github/workflows/codeql-analysis.yml:analyze"), - Environment: String("{\"language\":\"javascript\"}"), - Error: String(""), - Category: String(".github/workflows/codeql-analysis.yml:analyze/language:javascript"), + 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"), CreatedAt: date, - ResultsCount: Int(3), - RulesCount: Int(67), - URL: String("https://api.github.com/repos/o/r/code-scanning/analyses/201"), - SarifID: String("47177e22-5596-11eb-80a1-c1e54ef945c6"), + 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"), Tool: &Tool{ - Name: String("CodeQL"), + Name: Ptr("CodeQL"), GUID: nil, - Version: String("2.4.0"), + Version: Ptr("2.4.0"), }, - Deletable: Bool(true), - Warning: String(""), + Deletable: Ptr(true), + Warning: Ptr(""), } if !cmp.Equal(analysis, want) { t.Errorf("CodeScanning.GetAnalysis returned %+v, want %+v", analysis, want) @@ -1336,8 +1336,8 @@ func TestCodeScanningService_DeleteAnalysis(t *testing.T) { } want := &DeleteAnalysis{ - NextAnalysisURL: String("a"), - ConfirmDeleteURL: String("b"), + NextAnalysisURL: Ptr("a"), + ConfirmDeleteURL: Ptr("b"), } if !cmp.Equal(analysis, want) { t.Errorf("CodeScanning.DeleteAnalysis returned %+v, want %+v", analysis, want) @@ -1407,34 +1407,34 @@ func TestCodeScanningService_ListCodeQLDatabases(t *testing.T) { date := &Timestamp{time.Date(2021, time.January, 13, 11, 55, 49, 0, time.UTC)} want := []*CodeQLDatabase{ { - ID: Int64(1), - Name: String("name"), - Language: String("language"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + Language: Ptr("language"), Uploader: &User{ - Login: String("a"), - ID: Int64(1), - NodeID: String("b"), - AvatarURL: String("c"), - GravatarID: String("d"), - URL: String("e"), - HTMLURL: String("f"), - FollowersURL: String("g"), - FollowingURL: String("h"), - GistsURL: String("i"), - StarredURL: String("j"), - SubscriptionsURL: String("k"), - OrganizationsURL: String("l"), - ReposURL: String("m"), - EventsURL: String("n"), - ReceivedEventsURL: String("o"), - Type: String("p"), - SiteAdmin: Bool(false), + 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), }, - ContentType: String("r"), - Size: Int64(1024), + ContentType: Ptr("r"), + Size: Ptr(int64(1024)), CreatedAt: date, UpdatedAt: date, - URL: String("s"), + URL: Ptr("s"), }, } @@ -1503,34 +1503,34 @@ func TestCodeScanningService_GetCodeQLDatabase(t *testing.T) { date := &Timestamp{time.Date(2021, time.January, 13, 11, 55, 49, 0, time.UTC)} want := &CodeQLDatabase{ - ID: Int64(1), - Name: String("name"), - Language: String("language"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + Language: Ptr("language"), Uploader: &User{ - Login: String("a"), - ID: Int64(1), - NodeID: String("b"), - AvatarURL: String("c"), - GravatarID: String("d"), - URL: String("e"), - HTMLURL: String("f"), - FollowersURL: String("g"), - FollowingURL: String("h"), - GistsURL: String("i"), - StarredURL: String("j"), - SubscriptionsURL: String("k"), - OrganizationsURL: String("l"), - ReposURL: String("m"), - EventsURL: String("n"), - ReceivedEventsURL: String("o"), - Type: String("p"), - SiteAdmin: Bool(false), + 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), }, - ContentType: String("r"), - Size: Int64(1024), + ContentType: Ptr("r"), + Size: Ptr(int64(1024)), CreatedAt: date, UpdatedAt: date, - URL: String("s"), + URL: Ptr("s"), } if !cmp.Equal(database, want) { @@ -1581,9 +1581,9 @@ func TestCodeScanningService_GetDefaultSetupConfiguration(t *testing.T) { date := &Timestamp{time.Date(2006, time.January, 02, 15, 04, 05, 0, time.UTC)} want := &DefaultSetupConfiguration{ - State: String("configured"), + State: Ptr("configured"), Languages: []string{"javascript", "javascript-typescript", "typescript"}, - QuerySuite: String("default"), + QuerySuite: Ptr("default"), UpdatedAt: date, } if !cmp.Equal(cfg, want) { @@ -1624,7 +1624,7 @@ func TestCodeScanningService_UpdateDefaultSetupConfiguration(t *testing.T) { options := &UpdateDefaultSetupConfigurationOptions{ State: "configured", Languages: []string{"go"}, - QuerySuite: String("default"), + QuerySuite: Ptr("default"), } got, _, err := client.CodeScanning.UpdateDefaultSetupConfiguration(ctx, "o", "r", options) if err != nil { @@ -1632,8 +1632,8 @@ func TestCodeScanningService_UpdateDefaultSetupConfiguration(t *testing.T) { } want := &UpdateDefaultSetupConfigurationResponse{ - RunID: Int64(5301214200), - RunURL: String("https://api.github.com/repos/o/r/actions/runs/5301214200"), + RunID: Ptr(int64(5301214200)), + RunURL: Ptr("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 7d237791b13..a1f0aefe8ca 100644 --- a/github/codesofconduct_test.go +++ b/github/codesofconduct_test.go @@ -34,9 +34,9 @@ func TestCodesOfConductService_List(t *testing.T) { want := []*CodeOfConduct{ { - Key: String("key"), - Name: String("name"), - URL: String("url"), + Key: Ptr("key"), + Name: Ptr("name"), + URL: Ptr("url"), }} if !cmp.Equal(want, cs) { t.Errorf("returned %+v, want %+v", cs, want) @@ -72,10 +72,10 @@ func TestCodesOfConductService_Get(t *testing.T) { assertNilError(t, err) want := &CodeOfConduct{ - Key: String("key"), - Name: String("name"), - URL: String("url"), - Body: String("body"), + Key: Ptr("key"), + Name: Ptr("name"), + URL: Ptr("url"), + Body: Ptr("body"), } if !cmp.Equal(want, coc) { t.Errorf("returned %+v, want %+v", coc, want) @@ -101,10 +101,10 @@ func TestCodeOfConduct_Marshal(t *testing.T) { testJSONMarshal(t, &CodeOfConduct{}, "{}") a := &CodeOfConduct{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - Body: String("body"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + Body: Ptr("body"), } want := `{ diff --git a/github/codespaces_secrets_test.go b/github/codespaces_secrets_test.go index 9199a93b935..9529143cee5 100644 --- a/github/codespaces_secrets_test.go +++ b/github/codespaces_secrets_test.go @@ -463,7 +463,7 @@ func TestCodespacesService_GetPublicKey(t *testing.T) { t.Errorf("Codespaces.%v returned error: %v", tt.methodName, err) } - want := &PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Codespaces.%v returned %+v, want %+v", tt.methodName, key, want) } @@ -543,9 +543,9 @@ func TestCodespacesService_ListSelectedReposForSecret(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ - {ID: Int64(1)}, + {ID: Ptr(int64(1))}, }, } @@ -652,7 +652,7 @@ func TestCodespacesService_AddSelectedReposForSecret(t *testing.T) { badCall func(context.Context, *Client) (*Response, error) methodName string } - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} tests := []test{ { name: "User", @@ -720,7 +720,7 @@ func TestCodespacesService_RemoveSelectedReposFromSecret(t *testing.T) { badCall func(context.Context, *Client) (*Response, error) methodName string } - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} tests := []test{ { name: "User", diff --git a/github/codespaces_test.go b/github/codespaces_test.go index 13ceb92a057..64146ec848c 100644 --- a/github/codespaces_test.go +++ b/github/codespaces_test.go @@ -35,55 +35,55 @@ func TestCodespacesService_ListInRepo(t *testing.T) { t.Errorf("Codespaces.ListInRepo returned error: %v", err) } - want := &ListCodespaces{TotalCount: Int(2), Codespaces: []*Codespace{ + want := &ListCodespaces{TotalCount: Ptr(2), Codespaces: []*Codespace{ { - ID: Int64(1), - Name: String("monalisa-octocat-hello-world-g4wpq6h95q"), - EnvironmentID: String("26a7c758-7299-4a73-b978-5a92a7ae98a0"), + ID: Ptr(int64(1)), + Name: Ptr("monalisa-octocat-hello-world-g4wpq6h95q"), + EnvironmentID: Ptr("26a7c758-7299-4a73-b978-5a92a7ae98a0"), Owner: &User{ - Login: String("octocat"), + Login: Ptr("octocat"), }, BillableOwner: &User{ - Login: String("octocat"), + Login: Ptr("octocat"), }, Repository: &Repository{ - ID: Int64(1296269), + ID: Ptr(int64(1296269)), }, Machine: &CodespacesMachine{ - Name: String("standardLinux"), - DisplayName: String("4 cores, 8 GB RAM, 64 GB storage"), - OperatingSystem: String("linux"), - StorageInBytes: Int64(68719476736), - MemoryInBytes: Int64(8589934592), - CPUs: Int(4), + 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), }, - Prebuild: Bool(false), - DevcontainerPath: String(".devcontainer/devcontainer.json"), + Prebuild: Ptr(false), + DevcontainerPath: Ptr(".devcontainer/devcontainer.json"), CreatedAt: &Timestamp{time.Date(2021, 10, 14, 0, 53, 30, 0, time.FixedZone("", -6*60*60))}, UpdatedAt: &Timestamp{time.Date(2021, 10, 14, 0, 53, 32, 0, time.FixedZone("", -6*60*60))}, LastUsedAt: &Timestamp{time.Date(2021, 10, 14, 0, 53, 30, 0, time.FixedZone("", -6*60*60))}, - State: String("Available"), - URL: String("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q"), + State: Ptr("Available"), + URL: Ptr("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q"), GitStatus: &CodespacesGitStatus{ - Ahead: Int(0), - Behind: Int(0), - HasUnpushedChanges: Bool(false), - HasUncommittedChanges: Bool(false), - Ref: String("main"), + Ahead: Ptr(0), + Behind: Ptr(0), + HasUnpushedChanges: Ptr(false), + HasUncommittedChanges: Ptr(false), + Ref: Ptr("main"), }, - Location: String("WestUs2"), - IdleTimeoutMinutes: Int(60), - WebURL: String("https://monalisa-octocat-hello-world-g4wpq6h95q.github.dev"), - MachinesURL: String("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/machines"), - StartURL: String("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/start"), - StopURL: String("https://api.github.com/user/codespaces/monalisa-octocat-hello-world-g4wpq6h95q/stop"), + 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"), RecentFolders: []string{ "testfolder1", "testfolder2", }, }, { - ID: Int64(2), + ID: Ptr(int64(2)), }, }} if !cmp.Equal(codespaces, want) { @@ -121,11 +121,11 @@ func TestCodespacesService_List(t *testing.T) { t.Errorf("Codespaces.List returned error: %v", err) } - want := &ListCodespaces{TotalCount: Int(1), Codespaces: []*Codespace{ + want := &ListCodespaces{TotalCount: Ptr(1), Codespaces: []*Codespace{ { - ID: Int64(1), + ID: Ptr(int64(1)), Repository: &Repository{ - ID: Int64(1296269), + ID: Ptr(int64(1296269)), }, }, }} @@ -154,10 +154,10 @@ func TestCodespacesService_CreateInRepo(t *testing.T) { fmt.Fprint(w, `{"id":1, "repository": {"id": 1296269}}`) }) input := &CreateCodespaceOptions{ - Ref: String("main"), - Geo: String("WestUs2"), - Machine: String("standardLinux"), - IdleTimeoutMinutes: Int(60), + Ref: Ptr("main"), + Geo: Ptr("WestUs2"), + Machine: Ptr("standardLinux"), + IdleTimeoutMinutes: Ptr(60), } ctx := context.Background() codespace, _, err := client.Codespaces.CreateInRepo(ctx, "owner", "repo", input) @@ -165,9 +165,9 @@ func TestCodespacesService_CreateInRepo(t *testing.T) { t.Errorf("Codespaces.CreateInRepo returned error: %v", err) } want := &Codespace{ - ID: Int64(1), + ID: Ptr(int64(1)), Repository: &Repository{ - ID: Int64(1296269), + ID: Ptr(int64(1296269)), }, } @@ -204,9 +204,9 @@ func TestCodespacesService_Start(t *testing.T) { t.Errorf("Codespaces.Start returned error: %v", err) } want := &Codespace{ - ID: Int64(1), + ID: Ptr(int64(1)), Repository: &Repository{ - ID: Int64(1296269), + ID: Ptr(int64(1296269)), }, } @@ -243,9 +243,9 @@ func TestCodespacesService_Stop(t *testing.T) { t.Errorf("Codespaces.Stop returned error: %v", err) } want := &Codespace{ - ID: Int64(1), + ID: Ptr(int64(1)), Repository: &Repository{ - ID: Int64(1296269), + ID: Ptr(int64(1296269)), }, } diff --git a/github/copilot_test.go b/github/copilot_test.go index a299bf0735a..cc23b0c613c 100644 --- a/github/copilot_test.go +++ b/github/copilot_test.go @@ -150,8 +150,8 @@ func TestCopilotService_GetSeatDetailsUser(t *testing.T) { } want := &User{ - ID: Int64(1), - Type: String("User"), + ID: Ptr(int64(1)), + Type: Ptr("User"), } if got, ok := seatDetails.GetUser(); ok && !cmp.Equal(got, want) { @@ -168,8 +168,8 @@ func TestCopilotService_GetSeatDetailsUser(t *testing.T) { }` bad := &Organization{ - ID: Int64(1), - Type: String("Organization"), + ID: Ptr(int64(1)), + Type: Ptr("Organization"), } err = json.Unmarshal([]byte(data), seatDetails) @@ -199,7 +199,7 @@ func TestCopilotService_GetSeatDetailsTeam(t *testing.T) { } want := &Team{ - ID: Int64(1), + ID: Ptr(int64(1)), } if got, ok := seatDetails.GetTeam(); ok && !cmp.Equal(got, want) { @@ -216,8 +216,8 @@ func TestCopilotService_GetSeatDetailsTeam(t *testing.T) { }` bad := &User{ - ID: Int64(1), - Type: String("User"), + ID: Ptr(int64(1)), + Type: Ptr("User"), } err = json.Unmarshal([]byte(data), seatDetails) @@ -247,8 +247,8 @@ func TestCopilotService_GetSeatDetailsOrganization(t *testing.T) { } want := &Organization{ - ID: Int64(1), - Type: String("Organization"), + ID: Ptr(int64(1)), + Type: Ptr("Organization"), } if got, ok := seatDetails.GetOrganization(); ok && !cmp.Equal(got, want) { @@ -265,7 +265,7 @@ func TestCopilotService_GetSeatDetailsOrganization(t *testing.T) { }` bad := &Team{ - ID: Int64(1), + ID: Ptr(int64(1)), } err = json.Unmarshal([]byte(data), seatDetails) @@ -495,97 +495,97 @@ func TestCopilotService_ListCopilotSeats(t *testing.T) { Seats: []*CopilotSeatDetails{ { Assignee: &User{ - Login: String("octocat"), - ID: Int64(1), - NodeID: String("MDQ6VXNlcjE="), - AvatarURL: String("https://github.com/images/error/octocat_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/octocat"), - HTMLURL: String("https://github.com/octocat"), - FollowersURL: String("https://api.github.com/users/octocat/followers"), - FollowingURL: String("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: String("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/octocat/orgs"), - ReposURL: String("https://api.github.com/users/octocat/repos"), - EventsURL: String("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/octocat/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, AssigningTeam: &Team{ - ID: Int64(1), - NodeID: String("MDQ6VGVhbTE="), - URL: String("https://api.github.com/teams/1"), - HTMLURL: String("https://github.com/orgs/github/teams/justice-league"), - Name: String("Justice League"), - Slug: String("justice-league"), - Description: String("A great team."), - Privacy: String("closed"), - Permission: String("admin"), - MembersURL: String("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: String("https://api.github.com/teams/1/repos"), + 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"), + MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), Parent: nil, }, CreatedAt: &createdAt1, UpdatedAt: &updatedAt1, PendingCancellationDate: nil, LastActivityAt: &lastActivityAt1, - LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), }, { Assignee: &User{ - Login: String("octokitten"), - ID: Int64(1), - NodeID: String("MDQ76VNlcjE="), - AvatarURL: String("https://github.com/images/error/octokitten_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/octokitten"), - HTMLURL: String("https://github.com/octokitten"), - FollowersURL: String("https://api.github.com/users/octokitten/followers"), - FollowingURL: String("https://api.github.com/users/octokitten/following{/other_user}"), - GistsURL: String("https://api.github.com/users/octokitten/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/octokitten/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/octokitten/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/octokitten/orgs"), - ReposURL: String("https://api.github.com/users/octokitten/repos"), - EventsURL: String("https://api.github.com/users/octokitten/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/octokitten/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, AssigningTeam: nil, CreatedAt: &createdAt2, UpdatedAt: &updatedAt2, - PendingCancellationDate: String("2021-11-01"), + PendingCancellationDate: Ptr("2021-11-01"), LastActivityAt: &lastActivityAt2, - LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), }, { Assignee: &Team{ - ID: Int64(1), - Name: String("octokittens"), + ID: Ptr(int64(1)), + Name: Ptr("octokittens"), }, AssigningTeam: nil, CreatedAt: &createdAt2, UpdatedAt: &updatedAt2, - PendingCancellationDate: String("2021-11-01"), + PendingCancellationDate: Ptr("2021-11-01"), LastActivityAt: &lastActivityAt2, - LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), }, { Assignee: &Organization{ - ID: Int64(1), - Name: String("octocats"), - Type: String("Organization"), + ID: Ptr(int64(1)), + Name: Ptr("octocats"), + Type: Ptr("Organization"), }, AssigningTeam: nil, CreatedAt: &createdAt2, UpdatedAt: &updatedAt2, - PendingCancellationDate: String("2021-11-01"), + PendingCancellationDate: Ptr("2021-11-01"), LastActivityAt: &lastActivityAt2, - LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), }, }, } @@ -745,73 +745,73 @@ func TestCopilotService_ListCopilotEnterpriseSeats(t *testing.T) { Seats: []*CopilotSeatDetails{ { Assignee: &User{ - Login: String("octocat"), - ID: Int64(1), - NodeID: String("MDQ6VXNlcjE="), - AvatarURL: String("https://github.com/images/error/octocat_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/octocat"), - HTMLURL: String("https://github.com/octocat"), - FollowersURL: String("https://api.github.com/users/octocat/followers"), - FollowingURL: String("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: String("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/octocat/orgs"), - ReposURL: String("https://api.github.com/users/octocat/repos"), - EventsURL: String("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/octocat/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, AssigningTeam: &Team{ - ID: Int64(1), - NodeID: String("MDQ6VGVhbTE="), - URL: String("https://api.github.com/teams/1"), - HTMLURL: String("https://github.com/orgs/github/teams/justice-league"), - Name: String("Justice League"), - Slug: String("justice-league"), - Description: String("A great team."), - Privacy: String("closed"), - Permission: String("admin"), - MembersURL: String("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: String("https://api.github.com/teams/1/repos"), + 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"), + MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), Parent: nil, }, CreatedAt: &createdAt1, UpdatedAt: &updatedAt1, PendingCancellationDate: nil, LastActivityAt: &lastActivityAt1, - LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), - PlanType: String("business"), + LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), + PlanType: Ptr("business"), }, { Assignee: &User{ - Login: String("octokitten"), - ID: Int64(1), - NodeID: String("MDQ76VNlcjE="), - AvatarURL: String("https://github.com/images/error/octokitten_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/octokitten"), - HTMLURL: String("https://github.com/octokitten"), - FollowersURL: String("https://api.github.com/users/octokitten/followers"), - FollowingURL: String("https://api.github.com/users/octokitten/following{/other_user}"), - GistsURL: String("https://api.github.com/users/octokitten/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/octokitten/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/octokitten/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/octokitten/orgs"), - ReposURL: String("https://api.github.com/users/octokitten/repos"), - EventsURL: String("https://api.github.com/users/octokitten/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/octokitten/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, AssigningTeam: nil, CreatedAt: &createdAt2, UpdatedAt: &updatedAt2, - PendingCancellationDate: String("2021-11-01"), + PendingCancellationDate: Ptr("2021-11-01"), LastActivityAt: &lastActivityAt2, - LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), PlanType: nil, }, }, @@ -1067,44 +1067,44 @@ func TestCopilotService_GetSeatDetails(t *testing.T) { want := &CopilotSeatDetails{ Assignee: &User{ - Login: String("octocat"), - ID: Int64(1), - NodeID: String("MDQ6VXNlcjE="), - AvatarURL: String("https://github.com/images/error/octocat_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/octocat"), - HTMLURL: String("https://github.com/octocat"), - FollowersURL: String("https://api.github.com/users/octocat/followers"), - FollowingURL: String("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: String("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/octocat/orgs"), - ReposURL: String("https://api.github.com/users/octocat/repos"), - EventsURL: String("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/octocat/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, AssigningTeam: &Team{ - ID: Int64(1), - NodeID: String("MDQ6VGVhbTE="), - URL: String("https://api.github.com/teams/1"), - HTMLURL: String("https://github.com/orgs/github/teams/justice-league"), - Name: String("Justice League"), - Slug: String("justice-league"), - Description: String("A great team."), - Privacy: String("closed"), - Permission: String("admin"), - MembersURL: String("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: String("https://api.github.com/teams/1/repos"), + 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"), + MembersURL: Ptr("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: Ptr("https://api.github.com/teams/1/repos"), Parent: nil, }, CreatedAt: &createdAt, UpdatedAt: &updatedAt, PendingCancellationDate: nil, LastActivityAt: &lastActivityAt, - LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + LastActivityEditor: Ptr("vscode/1.77.3/copilot/1.86.82"), } if !cmp.Equal(got, want) { @@ -2155,7 +2155,7 @@ func TestCopilotService_GetEnterpriseMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -2198,7 +2198,7 @@ func TestCopilotService_GetEnterpriseMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -2243,7 +2243,7 @@ func TestCopilotService_GetEnterpriseMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, @@ -2498,7 +2498,7 @@ func TestCopilotService_GetEnterpriseTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -2541,7 +2541,7 @@ func TestCopilotService_GetEnterpriseTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -2586,7 +2586,7 @@ func TestCopilotService_GetEnterpriseTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, @@ -2841,7 +2841,7 @@ func TestCopilotService_GetOrganizationMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -2884,7 +2884,7 @@ func TestCopilotService_GetOrganizationMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -2929,7 +2929,7 @@ func TestCopilotService_GetOrganizationMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, @@ -3184,7 +3184,7 @@ func TestCopilotService_GetOrganizationTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), Languages: []*CopilotIDECodeCompletionsModelLanguage{ { Name: "typescript", @@ -3227,7 +3227,7 @@ func TestCopilotService_GetOrganizationTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalEngagedUsers: 1, TotalChats: 10, TotalChatInsertionEvents: 11, @@ -3272,7 +3272,7 @@ func TestCopilotService_GetOrganizationTeamMetrics(t *testing.T) { { Name: "a-custom-model", IsCustomModel: true, - CustomModelTrainingDate: String("2024-02-01"), + CustomModelTrainingDate: Ptr("2024-02-01"), TotalPRSummariesCreated: 10, TotalEngagedUsers: 4, }, diff --git a/github/dependabot_alerts_test.go b/github/dependabot_alerts_test.go index e5c31875a77..3908ab29459 100644 --- a/github/dependabot_alerts_test.go +++ b/github/dependabot_alerts_test.go @@ -24,7 +24,7 @@ func TestDependabotService_ListRepoAlerts(t *testing.T) { fmt.Fprint(w, `[{"number":1,"state":"open"},{"number":42,"state":"fixed"}]`) }) - opts := &ListAlertsOptions{State: String("open")} + opts := &ListAlertsOptions{State: Ptr("open")} ctx := context.Background() alerts, _, err := client.Dependabot.ListRepoAlerts(ctx, "o", "r", opts) if err != nil { @@ -32,8 +32,8 @@ func TestDependabotService_ListRepoAlerts(t *testing.T) { } want := []*DependabotAlert{ - {Number: Int(1), State: String("open")}, - {Number: Int(42), State: String("fixed")}, + {Number: Ptr(1), State: Ptr("open")}, + {Number: Ptr(42), State: Ptr("fixed")}, } if !cmp.Equal(alerts, want) { t.Errorf("Dependabot.ListRepoAlerts returned %+v, want %+v", alerts, want) @@ -70,8 +70,8 @@ func TestDependabotService_GetRepoAlert(t *testing.T) { } want := &DependabotAlert{ - Number: Int(42), - State: String("fixed"), + Number: Ptr(42), + State: Ptr("fixed"), } if !cmp.Equal(alert, want) { t.Errorf("Dependabot.GetRepoAlert returned %+v, want %+v", alert, want) @@ -102,7 +102,7 @@ func TestDependabotService_ListOrgAlerts(t *testing.T) { fmt.Fprint(w, `[{"number":1,"state":"open"},{"number":42,"state":"fixed"}]`) }) - opts := &ListAlertsOptions{State: String("open")} + opts := &ListAlertsOptions{State: Ptr("open")} ctx := context.Background() alerts, _, err := client.Dependabot.ListOrgAlerts(ctx, "o", opts) if err != nil { @@ -110,8 +110,8 @@ func TestDependabotService_ListOrgAlerts(t *testing.T) { } want := []*DependabotAlert{ - {Number: Int(1), State: String("open")}, - {Number: Int(42), State: String("fixed")}, + {Number: Ptr(1), State: Ptr("open")}, + {Number: Ptr(42), State: Ptr("fixed")}, } if !cmp.Equal(alerts, want) { t.Errorf("Dependabot.ListOrgAlerts returned %+v, want %+v", alerts, want) @@ -136,9 +136,9 @@ func TestDependabotService_UpdateAlert(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - state := String("dismissed") - dismissedReason := String("no_bandwidth") - dismissedComment := String("no time to fix this") + state := Ptr("dismissed") + dismissedReason := Ptr("no_bandwidth") + dismissedComment := Ptr("no time to fix this") alertState := &DependabotAlertState{State: *state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} @@ -154,10 +154,10 @@ func TestDependabotService_UpdateAlert(t *testing.T) { } want := &DependabotAlert{ - Number: Int(42), - State: String("dismissed"), - DismissedReason: String("no_bandwidth"), - DismissedComment: String("no time to fix this"), + Number: Ptr(42), + State: Ptr("dismissed"), + DismissedReason: Ptr("no_bandwidth"), + DismissedComment: Ptr("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 7b7ea5f85a1..21f72ca22a7 100644 --- a/github/dependabot_secrets_test.go +++ b/github/dependabot_secrets_test.go @@ -30,7 +30,7 @@ func TestDependabotService_GetRepoPublicKey(t *testing.T) { t.Errorf("Dependabot.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Dependabot.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -65,7 +65,7 @@ func TestDependabotService_GetRepoPublicKeyNumeric(t *testing.T) { t.Errorf("Dependabot.GetRepoPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("1234"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("1234"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Dependabot.GetRepoPublicKey returned %+v, want %+v", key, want) } @@ -240,7 +240,7 @@ func TestDependabotService_GetOrgPublicKey(t *testing.T) { t.Errorf("Dependabot.GetOrgPublicKey returned error: %v", err) } - want := &PublicKey{KeyID: String("012345678"), Key: String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} + want := &PublicKey{KeyID: Ptr("012345678"), Key: Ptr("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234")} if !cmp.Equal(key, want) { t.Errorf("Dependabot.GetOrgPublicKey returned %+v, want %+v", key, want) } @@ -397,9 +397,9 @@ func TestDependabotService_ListSelectedReposForOrgSecret(t *testing.T) { } want := &SelectedReposList{ - TotalCount: Int(1), + TotalCount: Ptr(1), Repositories: []*Repository{ - {ID: Int64(1)}, + {ID: Ptr(int64(1))}, }, } if !cmp.Equal(repos, want) { @@ -456,7 +456,7 @@ func TestDependabotService_AddSelectedRepoToOrgSecret(t *testing.T) { testMethod(t, r, "PUT") }) - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} ctx := context.Background() _, err := client.Dependabot.AddSelectedRepoToOrgSecret(ctx, "o", "NAME", repo) if err != nil { @@ -482,7 +482,7 @@ func TestDependabotService_RemoveSelectedRepoFromOrgSecret(t *testing.T) { testMethod(t, r, "DELETE") }) - repo := &Repository{ID: Int64(1234)} + repo := &Repository{ID: Ptr(int64(1234))} ctx := context.Background() _, err := client.Dependabot.RemoveSelectedRepoFromOrgSecret(ctx, "o", "NAME", repo) if err != nil { diff --git a/github/dependency_graph_snapshots_test.go b/github/dependency_graph_snapshots_test.go index 604edeca91a..40d73a6733f 100644 --- a/github/dependency_graph_snapshots_test.go +++ b/github/dependency_graph_snapshots_test.go @@ -28,40 +28,40 @@ func TestDependencyGraphService_CreateSnapshot(t *testing.T) { ctx := context.Background() snapshot := &DependencyGraphSnapshot{ Version: 0, - Sha: String("ce587453ced02b1526dfb4cb910479d431683101"), - Ref: String("refs/heads/main"), + Sha: Ptr("ce587453ced02b1526dfb4cb910479d431683101"), + Ref: Ptr("refs/heads/main"), Job: &DependencyGraphSnapshotJob{ - Correlator: String("yourworkflowname_youractionname"), - ID: String("yourrunid"), - HTMLURL: String("https://example.com"), + Correlator: Ptr("yourworkflowname_youractionname"), + ID: Ptr("yourrunid"), + HTMLURL: Ptr("https://example.com"), }, Detector: &DependencyGraphSnapshotDetector{ - Name: String("octo-detector"), - Version: String("0.0.1"), - URL: String("https://github.com/octo-org/octo-repo"), + Name: Ptr("octo-detector"), + Version: Ptr("0.0.1"), + URL: Ptr("https://github.com/octo-org/octo-repo"), }, Scanned: &Timestamp{time.Date(2022, time.June, 14, 20, 25, 00, 0, time.UTC)}, Manifests: map[string]*DependencyGraphSnapshotManifest{ "package-lock.json": { - Name: String("package-lock.json"), - File: &DependencyGraphSnapshotManifestFile{SourceLocation: String("src/package-lock.json")}, + Name: Ptr("package-lock.json"), + File: &DependencyGraphSnapshotManifestFile{SourceLocation: Ptr("src/package-lock.json")}, Resolved: map[string]*DependencyGraphSnapshotResolvedDependency{ "@actions/core": { - PackageURL: String("pkg:/npm/%40actions/core@1.1.9"), - Relationship: String("direct"), - Scope: String("runtime"), + PackageURL: Ptr("pkg:/npm/%40actions/core@1.1.9"), + Relationship: Ptr("direct"), + Scope: Ptr("runtime"), Dependencies: []string{"@actions/http-client"}, }, "@actions/http-client": { - PackageURL: String("pkg:/npm/%40actions/http-client@1.0.7"), - Relationship: String("indirect"), - Scope: String("runtime"), + PackageURL: Ptr("pkg:/npm/%40actions/http-client@1.0.7"), + Relationship: Ptr("indirect"), + Scope: Ptr("runtime"), Dependencies: []string{"tunnel"}, }, "tunnel": { - PackageURL: String("pkg:/npm/tunnel@0.0.6"), - Relationship: String("indirect"), - Scope: String("runtime"), + PackageURL: Ptr("pkg:/npm/tunnel@0.0.6"), + Relationship: Ptr("indirect"), + Scope: Ptr("runtime"), }, }, }, @@ -76,8 +76,8 @@ func TestDependencyGraphService_CreateSnapshot(t *testing.T) { want := &DependencyGraphSnapshotCreationData{ ID: 12345, CreatedAt: &Timestamp{time.Date(2022, time.June, 14, 20, 25, 01, 0, time.UTC)}, - Message: String("Dependency results for the repo have been successfully updated."), - Result: String("SUCCESS"), + Message: Ptr("Dependency results for the repo have been successfully updated."), + Result: Ptr("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 0bef36df28d..8b4f29e37d6 100644 --- a/github/dependency_graph_test.go +++ b/github/dependency_graph_test.go @@ -49,11 +49,11 @@ func TestDependencyGraphService_GetSBOM(t *testing.T) { CreationInfo: &CreationInfo{ Created: &Timestamp{testTime}, }, - Name: String("owner/repo"), + Name: Ptr("owner/repo"), Packages: []*RepoDependencies{ { - Name: String("rubygems:rails"), - VersionInfo: String("1.0.0"), + Name: Ptr("rubygems:rails"), + VersionInfo: Ptr("1.0.0"), }, }, }, diff --git a/github/doc.go b/github/doc.go index 7196394fb9c..58169af6675 100644 --- a/github/doc.go +++ b/github/doc.go @@ -156,8 +156,8 @@ bool, and int values. For example: // create a new private repository named "foo" repo := &github.Repository{ - Name: github.String("foo"), - Private: github.Bool(true), + Name: github.Ptr("foo"), + Private: github.Ptr(true), } client.Repositories.Create(ctx, "", repo) diff --git a/github/enterprise_actions_runner_groups_test.go b/github/enterprise_actions_runner_groups_test.go index 7612ba55909..e4d2bfffc2f 100644 --- a/github/enterprise_actions_runner_groups_test.go +++ b/github/enterprise_actions_runner_groups_test.go @@ -32,11 +32,11 @@ func TestEnterpriseService_ListRunnerGroups(t *testing.T) { } want := &EnterpriseRunnerGroups{ - TotalCount: Int(3), + TotalCount: Ptr(3), RunnerGroups: []*EnterpriseRunnerGroup{ - {ID: Int64(1), Name: String("Default"), Visibility: String("all"), Default: Bool(true), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(true), SelectedWorkflows: []string{"a", "b"}}, - {ID: Int64(2), Name: String("octo-runner-group"), Visibility: String("selected"), Default: Bool(false), SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, - {ID: Int64(3), Name: String("expensive-hardware"), Visibility: String("private"), Default: Bool(false), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + {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{}}, }, } if !cmp.Equal(groups, want) { @@ -76,11 +76,11 @@ func TestEnterpriseService_ListRunnerGroupsVisibleToOrganization(t *testing.T) { } want := &EnterpriseRunnerGroups{ - TotalCount: Int(3), + TotalCount: Ptr(3), RunnerGroups: []*EnterpriseRunnerGroup{ - {ID: Int64(1), Name: String("Default"), Visibility: String("all"), Default: Bool(true), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, - {ID: Int64(2), Name: String("octo-runner-group"), Visibility: String("selected"), Default: Bool(false), SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, - {ID: Int64(3), Name: String("expensive-hardware"), Visibility: String("private"), Default: Bool(false), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + {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{}}, }, } if !cmp.Equal(groups, want) { @@ -118,15 +118,15 @@ func TestEnterpriseService_GetRunnerGroup(t *testing.T) { } want := &EnterpriseRunnerGroup{ - ID: Int64(2), - Name: String("octo-runner-group"), - Visibility: String("selected"), - Default: Bool(false), - SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), - RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), - Inherited: Bool(false), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + 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), SelectedWorkflows: []string{}, } @@ -185,10 +185,10 @@ func TestEnterpriseService_CreateRunnerGroup(t *testing.T) { ctx := context.Background() req := CreateEnterpriseRunnerGroupRequest{ - Name: String("octo-runner-group"), - Visibility: String("selected"), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + Name: Ptr("octo-runner-group"), + Visibility: Ptr("selected"), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } group, _, err := client.Enterprise.CreateEnterpriseRunnerGroup(ctx, "o", req) @@ -197,15 +197,15 @@ func TestEnterpriseService_CreateRunnerGroup(t *testing.T) { } want := &EnterpriseRunnerGroup{ - ID: Int64(2), - Name: String("octo-runner-group"), - Visibility: String("selected"), - Default: Bool(false), - SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), - RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), - Inherited: Bool(false), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + 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), SelectedWorkflows: []string{}, } @@ -239,10 +239,10 @@ func TestEnterpriseService_UpdateRunnerGroup(t *testing.T) { ctx := context.Background() req := UpdateEnterpriseRunnerGroupRequest{ - Name: String("octo-runner-group"), - Visibility: String("selected"), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + Name: Ptr("octo-runner-group"), + Visibility: Ptr("selected"), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } group, _, err := client.Enterprise.UpdateEnterpriseRunnerGroup(ctx, "o", 2, req) @@ -251,15 +251,15 @@ func TestEnterpriseService_UpdateRunnerGroup(t *testing.T) { } want := &EnterpriseRunnerGroup{ - ID: Int64(2), - Name: String("octo-runner-group"), - Visibility: String("selected"), - Default: Bool(false), - SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), - RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), - Inherited: Bool(false), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + 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), SelectedWorkflows: []string{}, } @@ -300,9 +300,9 @@ func TestEnterpriseService_ListOrganizationAccessRunnerGroup(t *testing.T) { } want := &ListOrganizations{ - TotalCount: Int(1), + TotalCount: Ptr(1), Organizations: []*Organization{ - {ID: Int64(43), NodeID: String("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: String("Hello-World"), Login: String("octocat")}, + {ID: Ptr(int64(43)), NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: Ptr("Hello-World"), Login: Ptr("octocat")}, }, } if !cmp.Equal(groups, want) { @@ -426,8 +426,8 @@ func TestEnterpriseService_ListEnterpriseRunnerGroupRunners(t *testing.T) { want := &Runners{ TotalCount: 2, Runners: []*Runner{ - {ID: Int64(23), Name: String("MBP"), OS: String("macos"), Status: String("online")}, - {ID: Int64(24), Name: String("iMac"), OS: String("macos"), Status: String("offline")}, + {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")}, }, } if !cmp.Equal(runners, want) { @@ -536,15 +536,15 @@ func TestEnterpriseRunnerGroup_Marshal(t *testing.T) { testJSONMarshal(t, &EnterpriseRunnerGroup{}, "{}") u := &EnterpriseRunnerGroup{ - ID: Int64(1), - Name: String("n"), - Visibility: String("v"), - Default: Bool(true), - SelectedOrganizationsURL: String("s"), - RunnersURL: String("r"), - Inherited: Bool(true), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Visibility: Ptr("v"), + Default: Ptr(true), + SelectedOrganizationsURL: Ptr("s"), + RunnersURL: Ptr("r"), + Inherited: Ptr(true), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } @@ -569,18 +569,18 @@ func TestEnterpriseRunnerGroups_Marshal(t *testing.T) { testJSONMarshal(t, &EnterpriseRunnerGroups{}, "{}") u := &EnterpriseRunnerGroups{ - TotalCount: Int(1), + TotalCount: Ptr(1), RunnerGroups: []*EnterpriseRunnerGroup{ { - ID: Int64(1), - Name: String("n"), - Visibility: String("v"), - Default: Bool(true), - SelectedOrganizationsURL: String("s"), - RunnersURL: String("r"), - Inherited: Bool(true), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Visibility: Ptr("v"), + Default: Ptr(true), + SelectedOrganizationsURL: Ptr("s"), + RunnersURL: Ptr("r"), + Inherited: Ptr(true), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, }, }, @@ -610,12 +610,12 @@ func TestCreateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { testJSONMarshal(t, &CreateEnterpriseRunnerGroupRequest{}, "{}") u := &CreateEnterpriseRunnerGroupRequest{ - Name: String("n"), - Visibility: String("v"), + Name: Ptr("n"), + Visibility: Ptr("v"), SelectedOrganizationIDs: []int64{1}, Runners: []int64{1}, - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(true), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(true), SelectedWorkflows: []string{"a", "b"}, } @@ -637,10 +637,10 @@ func TestUpdateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { testJSONMarshal(t, &UpdateEnterpriseRunnerGroupRequest{}, "{}") u := &UpdateEnterpriseRunnerGroupRequest{ - Name: String("n"), - Visibility: String("v"), - AllowsPublicRepositories: Bool(true), - RestrictedToWorkflows: Bool(false), + Name: Ptr("n"), + Visibility: Ptr("v"), + AllowsPublicRepositories: Ptr(true), + RestrictedToWorkflows: Ptr(false), SelectedWorkflows: []string{}, } diff --git a/github/enterprise_actions_runners_test.go b/github/enterprise_actions_runners_test.go index 114ece8745d..b3a5770b6ad 100644 --- a/github/enterprise_actions_runners_test.go +++ b/github/enterprise_actions_runners_test.go @@ -43,7 +43,7 @@ func TestEnterpriseService_GenerateEnterpriseJITConfig(t *testing.T) { t.Errorf("Enterprise.GenerateEnterpriseJITConfig returned error: %v", err) } - want := &JITRunnerConfig{EncodedJITConfig: String("foo")} + want := &JITRunnerConfig{EncodedJITConfig: Ptr("foo")} if !cmp.Equal(jitConfig, want) { t.Errorf("Enterprise.GenerateEnterpriseJITConfig returned %+v, want %+v", jitConfig, want) } @@ -78,7 +78,7 @@ func TestEnterpriseService_CreateRegistrationToken(t *testing.T) { t.Errorf("Enterprise.CreateRegistrationToken returned error: %v", err) } - want := &RegistrationToken{Token: String("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), + want := &RegistrationToken{Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 22, 12, 13, 35, 123000000, time.UTC)}} if !cmp.Equal(token, want) { @@ -111,7 +111,7 @@ func TestEnterpriseService_ListRunners(t *testing.T) { }) opts := &ListRunnersOptions{ - Name: String("MBP"), + Name: Ptr("MBP"), ListOptions: ListOptions{Page: 2, PerPage: 2}, } ctx := context.Background() @@ -123,7 +123,7 @@ func TestEnterpriseService_ListRunners(t *testing.T) { want := &Runners{ TotalCount: 1, Runners: []*Runner{ - {ID: Int64(23), Name: String("MBP"), OS: String("macos"), Status: String("online")}, + {ID: Ptr(int64(23)), Name: Ptr("MBP"), OS: Ptr("macos"), Status: Ptr("online")}, }, } if !cmp.Equal(runners, want) { @@ -161,10 +161,10 @@ func TestEnterpriseService_GetRunner(t *testing.T) { } want := &Runner{ - ID: Int64(23), - Name: String("MBP"), - OS: String("macos"), - Status: String("online"), + ID: Ptr(int64(23)), + Name: Ptr("MBP"), + OS: Ptr("macos"), + Status: Ptr("online"), } if !cmp.Equal(runner, want) { t.Errorf("Enterprise.GetRunner returned %+v, want %+v", runner, want) @@ -226,11 +226,11 @@ func TestEnterpriseService_ListRunnerApplicationDownloads(t *testing.T) { } want := []*RunnerApplicationDownload{ - {OS: String("osx"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz"), Filename: String("actions-runner-osx-x64-2.164.0.tar.gz")}, - {OS: String("linux"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz"), Filename: String("actions-runner-linux-x64-2.164.0.tar.gz")}, - {OS: String("linux"), Architecture: String("arm"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz"), Filename: String("actions-runner-linux-arm-2.164.0.tar.gz")}, - {OS: String("win"), Architecture: String("x64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip"), Filename: String("actions-runner-win-x64-2.164.0.zip")}, - {OS: String("linux"), Architecture: String("arm64"), DownloadURL: String("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz"), Filename: String("actions-runner-linux-arm64-2.164.0.tar.gz")}, + {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")}, } if !cmp.Equal(downloads, want) { t.Errorf("Enterprise.ListRunnerApplicationDownloads returned %+v, want %+v", downloads, want) diff --git a/github/enterprise_audit_log_test.go b/github/enterprise_audit_log_test.go index 77a4dc162cc..08ecd23c996 100644 --- a/github/enterprise_audit_log_test.go +++ b/github/enterprise_audit_log_test.go @@ -43,9 +43,9 @@ func TestEnterpriseService_GetAuditLog(t *testing.T) { ]`) }) getOpts := GetAuditLogOptions{ - Include: String("all"), - Phrase: String("action:workflows"), - Order: String("asc"), + Include: Ptr("all"), + Phrase: Ptr("action:workflows"), + Order: Ptr("asc"), } ctx := context.Background() auditEntries, _, err := client.Enterprise.GetAuditLog(ctx, "e", &getOpts) @@ -56,11 +56,11 @@ func TestEnterpriseService_GetAuditLog(t *testing.T) { want := []*AuditEntry{ { Timestamp: &Timestamp{timestamp}, - DocumentID: String("beeZYapIUe-wKg5-beadb33"), - Action: String("workflows.completed_workflow_run"), - Actor: String("testactor"), + DocumentID: Ptr("beeZYapIUe-wKg5-beadb33"), + Action: Ptr("workflows.completed_workflow_run"), + Actor: Ptr("testactor"), CreatedAt: &Timestamp{timestamp}, - Org: String("o"), + Org: Ptr("o"), AdditionalFields: map[string]interface{}{ "completed_at": "2021-03-07T00:35:08.000Z", "conclusion": "success", diff --git a/github/enterprise_code_security_and_analysis_test.go b/github/enterprise_code_security_and_analysis_test.go index 2cf5c310323..6080299b723 100644 --- a/github/enterprise_code_security_and_analysis_test.go +++ b/github/enterprise_code_security_and_analysis_test.go @@ -41,11 +41,11 @@ func TestEnterpriseService_GetCodeSecurityAndAnalysis(t *testing.T) { t.Errorf("Enterprise.%v returned error: %v", methodName, err) } want := &EnterpriseSecurityAnalysisSettings{ - AdvancedSecurityEnabledForNewRepositories: Bool(true), - SecretScanningEnabledForNewRepositories: Bool(true), - SecretScanningPushProtectionEnabledForNewRepositories: Bool(true), - SecretScanningPushProtectionCustomLink: String("https://github.com/test-org/test-repo/blob/main/README.md"), - SecretScanningValidityChecksEnabled: Bool(true), + 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), } if !cmp.Equal(settings, want) { @@ -71,11 +71,11 @@ func TestEnterpriseService_UpdateCodeSecurityAndAnalysis(t *testing.T) { client, mux, _ := setup(t) input := &EnterpriseSecurityAnalysisSettings{ - AdvancedSecurityEnabledForNewRepositories: Bool(true), - SecretScanningEnabledForNewRepositories: Bool(true), - SecretScanningPushProtectionEnabledForNewRepositories: Bool(true), - SecretScanningPushProtectionCustomLink: String("https://github.com/test-org/test-repo/blob/main/README.md"), - SecretScanningValidityChecksEnabled: Bool(true), + 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), } mux.HandleFunc("/enterprises/e/code_security_and_analysis", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/event_test.go b/github/event_test.go index 7d5ad54e514..bc37e12f563 100644 --- a/github/event_test.go +++ b/github/event_test.go @@ -55,47 +55,47 @@ func TestEvent_Marshal(t *testing.T) { jsonMsg, _ := json.Marshal(&l) u := &Event{ - Type: String("t"), - Public: Bool(false), + Type: Ptr("t"), + Public: Ptr(false), RawPayload: (*json.RawMessage)(&jsonMsg), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Actor: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, CreatedAt: &Timestamp{referenceTime}, - ID: String("id"), + ID: Ptr("id"), } want := `{ diff --git a/github/event_types_test.go b/github/event_types_test.go index b09b92799f1..fbdba78212e 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -16,7 +16,7 @@ func TestEditChange_Marshal_TitleChange(t *testing.T) { u := &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: nil, Base: nil, @@ -38,7 +38,7 @@ func TestEditChange_Marshal_BodyChange(t *testing.T) { u := &EditChange{ Title: nil, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: nil, } @@ -58,10 +58,10 @@ func TestEditChange_Marshal_BaseChange(t *testing.T) { base := EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, } @@ -92,7 +92,7 @@ func TestEditChange_Marshal_Repo(t *testing.T) { u := &EditChange{ Repo: &EditRepo{ Name: &RepoName{ - From: String("old-repo-name"), + From: Ptr("old-repo-name"), }, }, Topics: &EditTopics{ @@ -125,13 +125,13 @@ func TestEditChange_Marshal_TransferFromUser(t *testing.T) { Owner: &EditOwner{ OwnerInfo: &OwnerInfo{ User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, }, }, @@ -164,13 +164,13 @@ func TestEditChange_Marshal_TransferFromOrg(t *testing.T) { Owner: &EditOwner{ OwnerInfo: &OwnerInfo{ Org: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, }, }, @@ -200,7 +200,7 @@ func TestProjectChange_Marshal_NameChange(t *testing.T) { testJSONMarshal(t, &ProjectChange{}, "{}") u := &ProjectChange{ - Name: &ProjectName{From: String("NameFrom")}, + Name: &ProjectName{From: Ptr("NameFrom")}, Body: nil, } @@ -219,7 +219,7 @@ func TestProjectChange_Marshal_BodyChange(t *testing.T) { u := &ProjectChange{ Name: nil, - Body: &ProjectBody{From: String("BodyFrom")}, + Body: &ProjectBody{From: Ptr("BodyFrom")}, } want := `{ @@ -236,7 +236,7 @@ func TestProjectCardChange_Marshal_NoteChange(t *testing.T) { testJSONMarshal(t, &ProjectCardChange{}, "{}") u := &ProjectCardChange{ - Note: &ProjectCardNote{From: String("NoteFrom")}, + Note: &ProjectCardNote{From: Ptr("NoteFrom")}, } want := `{ @@ -253,7 +253,7 @@ func TestProjectColumnChange_Marshal_NameChange(t *testing.T) { testJSONMarshal(t, &ProjectColumnChange{}, "{}") u := &ProjectColumnChange{ - Name: &ProjectColumnName{From: String("NameFrom")}, + Name: &ProjectColumnName{From: Ptr("NameFrom")}, } want := `{ @@ -269,27 +269,27 @@ func TestBranchProtectionConfigurationEvent_Marshal(t *testing.T) { t.Parallel() testJSONMarshal(t, &BranchProtectionConfigurationEvent{}, "{}") u := &BranchProtectionConfigurationEvent{ - Action: String("enabled"), + Action: Ptr("enabled"), Repo: &Repository{ - ID: Int64(12345), - NodeID: String("MDEwOlJlcG9zaXRvcnkxMjM0NQ=="), - Name: String("example-repo"), + ID: Ptr(int64(12345)), + NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjM0NQ=="), + Name: Ptr("example-repo"), }, Org: &Organization{ - Login: String("example-org"), - ID: Int64(67890), + Login: Ptr("example-org"), + ID: Ptr(int64(67890)), }, Sender: &User{ - Login: String("example-user"), - ID: Int64(1111), + Login: Ptr("example-user"), + ID: Ptr(int64(1111)), }, Installation: &Installation{ - ID: Int64(2222), + ID: Ptr(int64(2222)), }, Enterprise: &Enterprise{ - ID: Int(3333), - Slug: String("example-enterprise"), - Name: String("Example Enterprise"), + ID: Ptr(3333), + Slug: Ptr("example-enterprise"), + Name: Ptr("Example Enterprise"), }, } @@ -326,168 +326,168 @@ func TestTeamAddEvent_Marshal(t *testing.T) { u := &TeamAddEvent{ Team: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - MembersURL: String("m"), - RepositoriesURL: String("r"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + MembersURL: Ptr("m"), + RepositoriesURL: Ptr("r"), Organization: &Organization{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - HTMLURL: String("h"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), + 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"), }, Parent: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - }, - LDAPDN: String("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + }, + LDAPDN: Ptr("l"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -678,43 +678,43 @@ func TestStarEvent_Marshal(t *testing.T) { testJSONMarshal(t, &StarEvent{}, "{}") u := &StarEvent{ - Action: String("a"), + Action: Ptr("a"), StarredAt: &Timestamp{referenceTime}, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -767,190 +767,190 @@ func TestTeamEvent_Marshal(t *testing.T) { testJSONMarshal(t, &TeamEvent{}, "{}") u := &TeamEvent{ - Action: String("a"), + Action: Ptr("a"), Team: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - MembersURL: String("m"), - RepositoriesURL: String("r"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + MembersURL: Ptr("m"), + RepositoriesURL: Ptr("r"), Organization: &Organization{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - HTMLURL: String("h"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), + 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"), }, Parent: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - }, - LDAPDN: String("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + }, + LDAPDN: Ptr("l"), }, Changes: &TeamChange{ Description: &TeamDescription{ - From: String("from"), + From: Ptr("from"), }, Name: &TeamName{ - From: String("from"), + From: Ptr("from"), }, Privacy: &TeamPrivacy{ - From: String("from"), + From: Ptr("from"), }, Repository: &TeamRepository{ Permissions: &TeamPermissions{ From: &TeamPermissionsFrom{ - Admin: Bool(true), - Pull: Bool(true), - Push: Bool(true), + Admin: Ptr(true), + Pull: Ptr(true), + Push: Ptr(true), }, }, }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -1162,119 +1162,119 @@ func TestInstallationRepositoriesEvent_Marshal(t *testing.T) { testJSONMarshal(t, &InstallationRepositoriesEvent{}, "{}") u := &InstallationRepositoriesEvent{ - Action: String("a"), + Action: Ptr("a"), RepositoriesAdded: []*Repository{ { - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, RepositoriesRemoved: []*Repository{ { - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, - RepositorySelection: String("rs"), + RepositorySelection: Ptr("rs"), Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -1416,165 +1416,165 @@ func TestInstallationTargetEvent_Marshal(t *testing.T) { u := &InstallationTargetEvent{ Account: &User{ - Login: String("u"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("l"), - }, - Action: String("a"), + Login: Ptr("u"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("l"), + }, + Action: Ptr("a"), Changes: &InstallationChanges{ Login: &InstallationLoginChange{ - From: String("p"), + From: Ptr("p"), }, Slug: &InstallationSlugChange{ - From: String("j"), + From: Ptr("j"), }, }, Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Repository: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - TargetType: String("running"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + TargetType: Ptr("running"), } want := `{ @@ -1752,7 +1752,7 @@ func TestEditTitle_Marshal(t *testing.T) { testJSONMarshal(t, &EditTitle{}, "{}") u := &EditTitle{ - From: String("EditTitleFrom"), + From: Ptr("EditTitleFrom"), } want := `{ @@ -1767,7 +1767,7 @@ func TestEditBody_Marshal(t *testing.T) { testJSONMarshal(t, &EditBody{}, "{}") u := &EditBody{ - From: String("EditBodyFrom"), + From: Ptr("EditBodyFrom"), } want := `{ @@ -1783,10 +1783,10 @@ func TestEditBase_Marshal(t *testing.T) { u := &EditBase{ Ref: &EditRef{ - From: String("EditRefFrom"), + From: Ptr("EditRefFrom"), }, SHA: &EditSHA{ - From: String("EditSHAFrom"), + From: Ptr("EditSHAFrom"), }, } @@ -1807,7 +1807,7 @@ func TestEditRef_Marshal(t *testing.T) { testJSONMarshal(t, &EditRef{}, "{}") u := &EditRef{ - From: String("EditRefFrom"), + From: Ptr("EditRefFrom"), } want := `{ @@ -1822,7 +1822,7 @@ func TestEditSHA_Marshal(t *testing.T) { testJSONMarshal(t, &EditSHA{}, "{}") u := &EditSHA{ - From: String("EditSHAFrom"), + From: Ptr("EditSHAFrom"), } want := `{ @@ -1837,7 +1837,7 @@ func TestProjectName_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectName{}, "{}") u := &ProjectName{ - From: String("ProjectNameFrom"), + From: Ptr("ProjectNameFrom"), } want := `{ @@ -1852,7 +1852,7 @@ func TestProjectBody_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectBody{}, "{}") u := &ProjectBody{ - From: String("ProjectBodyFrom"), + From: Ptr("ProjectBodyFrom"), } want := `{ @@ -1867,7 +1867,7 @@ func TestProjectCardNote_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectCardNote{}, "{}") u := &ProjectCardNote{ - From: String("ProjectCardNoteFrom"), + From: Ptr("ProjectCardNoteFrom"), } want := `{ @@ -1882,7 +1882,7 @@ func TestProjectColumnName_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectColumnName{}, "{}") u := &ProjectColumnName{ - From: String("ProjectColumnNameFrom"), + From: Ptr("ProjectColumnNameFrom"), } want := `{ @@ -1897,7 +1897,7 @@ func TestTeamDescription_Marshal(t *testing.T) { testJSONMarshal(t, &TeamDescription{}, "{}") u := &TeamDescription{ - From: String("TeamDescriptionFrom"), + From: Ptr("TeamDescriptionFrom"), } want := `{ @@ -1912,7 +1912,7 @@ func TestTeamName_Marshal(t *testing.T) { testJSONMarshal(t, &TeamName{}, "{}") u := &TeamName{ - From: String("TeamNameFrom"), + From: Ptr("TeamNameFrom"), } want := `{ @@ -1927,7 +1927,7 @@ func TestTeamPrivacy_Marshal(t *testing.T) { testJSONMarshal(t, &TeamPrivacy{}, "{}") u := &TeamPrivacy{ - From: String("TeamPrivacyFrom"), + From: Ptr("TeamPrivacyFrom"), } want := `{ @@ -1944,9 +1944,9 @@ func TestTeamRepository_Marshal(t *testing.T) { u := &TeamRepository{ Permissions: &TeamPermissions{ From: &TeamPermissionsFrom{ - Admin: Bool(true), - Pull: Bool(true), - Push: Bool(true), + Admin: Ptr(true), + Pull: Ptr(true), + Push: Ptr(true), }, }, } @@ -1970,9 +1970,9 @@ func TestTeamPermissions_Marshal(t *testing.T) { u := &TeamPermissions{ From: &TeamPermissionsFrom{ - Admin: Bool(true), - Pull: Bool(true), - Push: Bool(true), + Admin: Ptr(true), + Pull: Ptr(true), + Push: Ptr(true), }, } @@ -1992,9 +1992,9 @@ func TestTeamPermissionsFrom_Marshal(t *testing.T) { testJSONMarshal(t, &TeamPermissionsFrom{}, "{}") u := &TeamPermissionsFrom{ - Admin: Bool(true), - Pull: Bool(true), - Push: Bool(true), + Admin: Ptr(true), + Pull: Ptr(true), + Push: Ptr(true), } want := `{ @@ -2011,22 +2011,22 @@ func TestRepositoryVulnerabilityAlert_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryVulnerabilityAlert{}, "{}") u := &RepositoryVulnerabilityAlert{ - ID: Int64(1), - AffectedRange: String("ar"), - AffectedPackageName: String("apn"), - ExternalReference: String("er"), - ExternalIdentifier: String("ei"), - FixedIn: String("fi"), + ID: Ptr(int64(1)), + AffectedRange: Ptr("ar"), + AffectedPackageName: Ptr("apn"), + ExternalReference: Ptr("er"), + ExternalIdentifier: Ptr("ei"), + FixedIn: Ptr("fi"), Dismisser: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - DismissReason: String("dr"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + DismissReason: Ptr("dr"), DismissedAt: &Timestamp{referenceTime}, } @@ -2058,12 +2058,12 @@ func TestPage_Marshal(t *testing.T) { testJSONMarshal(t, &Page{}, "{}") u := &Page{ - PageName: String("p"), - Title: String("t"), - Summary: String("s"), - Action: String("a"), - SHA: String("s"), - HTMLURL: String("h"), + PageName: Ptr("p"), + Title: Ptr("t"), + Summary: Ptr("s"), + Action: Ptr("a"), + SHA: Ptr("s"), + HTMLURL: Ptr("h"), } want := `{ @@ -2084,20 +2084,20 @@ func TestTeamChange_Marshal(t *testing.T) { u := &TeamChange{ Description: &TeamDescription{ - From: String("DescriptionFrom"), + From: Ptr("DescriptionFrom"), }, Name: &TeamName{ - From: String("NameFrom"), + From: Ptr("NameFrom"), }, Privacy: &TeamPrivacy{ - From: String("PrivacyFrom"), + From: Ptr("PrivacyFrom"), }, Repository: &TeamRepository{ Permissions: &TeamPermissions{ From: &TeamPermissionsFrom{ - Admin: Bool(false), - Pull: Bool(false), - Push: Bool(false), + Admin: Ptr(false), + Pull: Ptr(false), + Push: Ptr(false), }, }, }, @@ -2132,153 +2132,153 @@ func TestIssueCommentEvent_Marshal(t *testing.T) { testJSONMarshal(t, &IssueCommentEvent{}, "{}") u := &IssueCommentEvent{ - Action: String("a"), - Issue: &Issue{ID: Int64(1)}, - Comment: &IssueComment{ID: Int64(1)}, + Action: Ptr("a"), + Issue: &Issue{ID: Ptr(int64(1))}, + Comment: &IssueComment{ID: Ptr(int64(1))}, Changes: &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: &EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, } @@ -2449,136 +2449,136 @@ func TestIssuesEvent_Marshal(t *testing.T) { testJSONMarshal(t, &IssuesEvent{}, "{}") u := &IssuesEvent{ - Action: String("a"), - Issue: &Issue{ID: Int64(1)}, + Action: Ptr("a"), + Issue: &Issue{ID: Ptr(int64(1))}, Assignee: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - Label: &Label{ID: Int64(1)}, + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + Label: &Label{ID: Ptr(int64(1))}, Changes: &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: &EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -2740,139 +2740,139 @@ func TestLabelEvent_Marshal(t *testing.T) { testJSONMarshal(t, &LabelEvent{}, "{}") u := &LabelEvent{ - Action: String("a"), - Label: &Label{ID: Int64(1)}, + Action: Ptr("a"), + Label: &Label{ID: Ptr(int64(1))}, Changes: &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: &EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -3035,148 +3035,148 @@ func TestMilestoneEvent_Marshal(t *testing.T) { testJSONMarshal(t, &MilestoneEvent{}, "{}") u := &MilestoneEvent{ - Action: String("a"), - Milestone: &Milestone{ID: Int64(1)}, + Action: Ptr("a"), + Milestone: &Milestone{ID: Ptr(int64(1))}, Changes: &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: &EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -3349,107 +3349,107 @@ func TestPublicEvent_Marshal(t *testing.T) { u := &PublicEvent{ Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -3579,137 +3579,137 @@ func TestPullRequestReviewEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestReviewEvent{}, "{}") u := &PullRequestReviewEvent{ - Action: String("a"), - Review: &PullRequestReview{ID: Int64(1)}, - PullRequest: &PullRequest{ID: Int64(1)}, + Action: Ptr("a"), + Review: &PullRequestReview{ID: Ptr(int64(1))}, + PullRequest: &PullRequest{ID: Ptr(int64(1))}, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, } @@ -3864,152 +3864,152 @@ func TestPushEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PushEvent{}, "{}") u := &PushEvent{ - PushID: Int64(1), - Head: String("h"), - Ref: String("ref"), - Size: Int(1), + PushID: Ptr(int64(1)), + Head: Ptr("h"), + Ref: Ptr("ref"), + Size: Ptr(1), Commits: []*HeadCommit{ - {ID: String("id")}, - }, - Before: String("b"), - DistinctSize: Int(1), - After: String("a"), - Created: Bool(true), - Deleted: Bool(true), - Forced: Bool(true), - BaseRef: String("a"), - Compare: String("a"), - Repo: &PushEventRepository{ID: Int64(1)}, - HeadCommit: &HeadCommit{ID: String("id")}, + {ID: Ptr("id")}, + }, + Before: Ptr("b"), + DistinctSize: Ptr(1), + After: Ptr("a"), + Created: Ptr(true), + Deleted: Ptr(true), + Forced: Ptr(true), + BaseRef: Ptr("a"), + Compare: Ptr("a"), + Repo: &PushEventRepository{ID: Ptr(int64(1))}, + HeadCommit: &HeadCommit{ID: Ptr("id")}, Pusher: &CommitAuthor{ - Login: String("l"), + Login: Ptr("l"), Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), + Name: Ptr("n"), + Email: Ptr("e"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, } @@ -4181,120 +4181,120 @@ func TestStatusEvent_Marshal(t *testing.T) { testJSONMarshal(t, &StatusEvent{}, "{}") u := &StatusEvent{ - SHA: String("sha"), - State: String("s"), - Description: String("d"), - TargetURL: String("turl"), + SHA: Ptr("sha"), + State: Ptr("s"), + Description: Ptr("d"), + TargetURL: Ptr("turl"), Branches: []*Branch{ { - Name: String("n"), - Commit: &RepositoryCommit{NodeID: String("nid")}, - Protected: Bool(false), + Name: Ptr("n"), + Commit: &RepositoryCommit{NodeID: Ptr("nid")}, + Protected: Ptr(false), }, }, - ID: Int64(1), - Name: String("n"), - Context: String("c"), - Commit: &RepositoryCommit{NodeID: String("nid")}, + ID: Ptr(int64(1)), + Name: Ptr("n"), + Context: Ptr("c"), + Commit: &RepositoryCommit{NodeID: Ptr("nid")}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -4440,151 +4440,151 @@ func TestMarketplacePurchaseEvent_Marshal(t *testing.T) { testJSONMarshal(t, &MarketplacePurchaseEvent{}, "{}") u := &MarketplacePurchaseEvent{ - Action: String("a"), + Action: Ptr("a"), EffectiveDate: &Timestamp{referenceTime}, MarketplacePurchase: &MarketplacePurchase{ - BillingCycle: String("bc"), + BillingCycle: Ptr("bc"), NextBillingDate: &Timestamp{referenceTime}, - UnitCount: Int(1), + UnitCount: Ptr(1), Plan: &MarketplacePlan{ - URL: String("u"), - AccountsURL: String("au"), - ID: Int64(1), - Number: Int(1), - Name: String("n"), - Description: String("d"), - MonthlyPriceInCents: Int(1), - YearlyPriceInCents: Int(1), - PriceModel: String("pm"), - UnitName: String("un"), + URL: Ptr("u"), + AccountsURL: Ptr("au"), + ID: Ptr(int64(1)), + Number: Ptr(1), + Name: Ptr("n"), + Description: Ptr("d"), + MonthlyPriceInCents: Ptr(1), + YearlyPriceInCents: Ptr(1), + PriceModel: Ptr("pm"), + UnitName: Ptr("un"), Bullets: &[]string{"b"}, - State: String("s"), - HasFreeTrial: Bool(false), + State: Ptr("s"), + HasFreeTrial: Ptr(false), }, - OnFreeTrial: Bool(false), + OnFreeTrial: Ptr(false), FreeTrialEndsOn: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, PreviousMarketplacePurchase: &MarketplacePurchase{ - BillingCycle: String("bc"), + BillingCycle: Ptr("bc"), NextBillingDate: &Timestamp{referenceTime}, - UnitCount: Int(1), + UnitCount: Ptr(1), Plan: &MarketplacePlan{ - URL: String("u"), - AccountsURL: String("au"), - ID: Int64(1), - Number: Int(1), - Name: String("n"), - Description: String("d"), - MonthlyPriceInCents: Int(1), - YearlyPriceInCents: Int(1), - PriceModel: String("pm"), - UnitName: String("un"), + URL: Ptr("u"), + AccountsURL: Ptr("au"), + ID: Ptr(int64(1)), + Number: Ptr(1), + Name: Ptr("n"), + Description: Ptr("d"), + MonthlyPriceInCents: Ptr(1), + YearlyPriceInCents: Ptr(1), + PriceModel: Ptr("pm"), + UnitName: Ptr("un"), Bullets: &[]string{"b"}, - State: String("s"), - HasFreeTrial: Bool(false), + State: Ptr("s"), + HasFreeTrial: Ptr(false), }, - OnFreeTrial: Bool(false), + OnFreeTrial: Ptr(false), FreeTrialEndsOn: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -4761,164 +4761,164 @@ func TestOrganizationEvent_Marshal(t *testing.T) { testJSONMarshal(t, &OrganizationEvent{}, "{}") u := &OrganizationEvent{ - Action: String("a"), - Invitation: &Invitation{ID: Int64(1)}, + Action: Ptr("a"), + Invitation: &Invitation{ID: Ptr(int64(1))}, Membership: &Membership{ - URL: String("url"), - State: String("s"), - Role: String("r"), - OrganizationURL: String("ou"), + URL: Ptr("url"), + State: Ptr("s"), + Role: Ptr("r"), + OrganizationURL: Ptr("ou"), Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -5106,110 +5106,110 @@ func TestPageBuildEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PageBuildEvent{}, "{}") u := &PageBuildEvent{ - Build: &PagesBuild{URL: String("url")}, - ID: Int64(1), + Build: &PagesBuild{URL: Ptr("url")}, + ID: Ptr(int64(1)), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -5344,141 +5344,141 @@ func TestCommitCommentEvent_Marshal(t *testing.T) { u := &CommitCommentEvent{ Comment: &RepositoryComment{ - HTMLURL: String("hurl"), - URL: String("url"), - ID: Int64(1), - NodeID: String("nid"), - CommitID: String("cid"), + HTMLURL: Ptr("hurl"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + CommitID: Ptr("cid"), User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Reactions: &Reactions{ - TotalCount: Int(1), - PlusOne: Int(1), - MinusOne: Int(1), - Laugh: Int(1), - Confused: Int(1), - Heart: Int(1), - Hooray: Int(1), - Rocket: Int(1), - Eyes: Int(1), - URL: String("url"), + TotalCount: Ptr(1), + PlusOne: Ptr(1), + MinusOne: Ptr(1), + Laugh: Ptr(1), + Confused: Ptr(1), + Heart: Ptr(1), + Hooray: Ptr(1), + Rocket: Ptr(1), + Eyes: Ptr(1), + URL: Ptr("url"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Body: String("b"), - Path: String("path"), - Position: Int(1), + Body: Ptr("b"), + Path: Ptr("path"), + Position: Ptr(1), }, - Action: String("a"), + Action: Ptr("a"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -5648,183 +5648,183 @@ func TestDeploymentEvent_Marshal(t *testing.T) { u := &DeploymentEvent{ Deployment: &Deployment{ - URL: String("url"), - ID: Int64(1), - SHA: String("sha"), - Ref: String("ref"), - Task: String("t"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + SHA: Ptr("sha"), + Ref: Ptr("ref"), + Task: Ptr("t"), Payload: jsonMsg, - Environment: String("e"), - Description: String("d"), + Environment: Ptr("e"), + Description: Ptr("d"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - StatusesURL: String("surl"), - RepositoryURL: String("rurl"), - NodeID: String("nid"), + StatusesURL: Ptr("surl"), + RepositoryURL: Ptr("rurl"), + NodeID: Ptr("nid"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Workflow: &Workflow{ - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - Path: String("p"), - State: String("s"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + Path: Ptr("p"), + State: Ptr("s"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("u"), - HTMLURL: String("h"), - BadgeURL: String("b"), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + BadgeURL: Ptr("b"), }, WorkflowRun: &WorkflowRun{ - ID: Int64(1), - Name: String("n"), - NodeID: String("nid"), - HeadBranch: String("hb"), - HeadSHA: String("hs"), - RunNumber: Int(1), - RunAttempt: Int(1), - Event: String("e"), - Status: String("s"), - Conclusion: String("c"), - WorkflowID: Int64(1), - URL: String("u"), - HTMLURL: String("h"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + NodeID: Ptr("nid"), + HeadBranch: Ptr("hb"), + HeadSHA: Ptr("hs"), + RunNumber: Ptr(1), + RunAttempt: Ptr(1), + Event: Ptr("e"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + WorkflowID: Ptr(int64(1)), + URL: Ptr("u"), + HTMLURL: Ptr("h"), PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, @@ -5832,42 +5832,42 @@ func TestDeploymentEvent_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, RunStartedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), - PreviousAttemptURL: String("p"), + JobsURL: Ptr("j"), + LogsURL: Ptr("l"), + CheckSuiteURL: Ptr("c"), + ArtifactsURL: Ptr("a"), + CancelURL: Ptr("c"), + RerunURL: Ptr("r"), + PreviousAttemptURL: Ptr("p"), HeadCommit: &HeadCommit{ - Message: String("m"), + Message: Ptr("m"), Author: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, - URL: String("u"), - Distinct: Bool(false), - SHA: String("s"), - ID: String("i"), - TreeID: String("tid"), + URL: Ptr("u"), + Distinct: Ptr(false), + SHA: Ptr("s"), + ID: Ptr("i"), + TreeID: Ptr("tid"), Timestamp: &Timestamp{referenceTime}, Committer: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, }, - WorkflowURL: String("w"), + WorkflowURL: Ptr("w"), Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, HeadRepository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, } @@ -6117,182 +6117,182 @@ func TestDeploymentProtectionRuleEvent_Marshal(t *testing.T) { jsonMsg, _ := json.Marshal(&l) u := &DeploymentProtectionRuleEvent{ - Action: String("a"), - Environment: String("e"), - DeploymentCallbackURL: String("b"), + Action: Ptr("a"), + Environment: Ptr("e"), + DeploymentCallbackURL: Ptr("b"), Deployment: &Deployment{ - URL: String("url"), - ID: Int64(1), - SHA: String("sha"), - Ref: String("ref"), - Task: String("t"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + SHA: Ptr("sha"), + Ref: Ptr("ref"), + Task: Ptr("t"), Payload: jsonMsg, - Environment: String("e"), - Description: String("d"), + Environment: Ptr("e"), + Description: Ptr("d"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - StatusesURL: String("surl"), - RepositoryURL: String("rurl"), - NodeID: String("nid"), + StatusesURL: Ptr("surl"), + RepositoryURL: Ptr("rurl"), + NodeID: Ptr("nid"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -6498,252 +6498,252 @@ func TestDeploymentReviewEvent_Marshal(t *testing.T) { testJSONMarshal(t, &DeploymentReviewEvent{}, "{}") u := &DeploymentReviewEvent{ - Action: String("a"), - Environment: String("e"), + Action: Ptr("a"), + Environment: Ptr("e"), Requester: &User{ - AvatarURL: String("a"), - Email: String("e"), - EventsURL: String("e"), - FollowersURL: String("f"), - FollowingURL: String("f"), - GistsURL: String("g"), - GravatarID: String("g"), - HTMLURL: String("h"), - ID: Int64(1), - Login: String("l"), - Name: String("n"), - NodeID: String("n"), - OrganizationsURL: String("o"), - ReceivedEventsURL: String("r"), - ReposURL: String("r"), - SiteAdmin: Bool(false), - StarredURL: String("s"), - SubscriptionsURL: String("s"), - Type: String("User"), - URL: String("u"), + AvatarURL: Ptr("a"), + Email: Ptr("e"), + EventsURL: Ptr("e"), + FollowersURL: Ptr("f"), + FollowingURL: Ptr("f"), + GistsURL: Ptr("g"), + GravatarID: Ptr("g"), + HTMLURL: Ptr("h"), + ID: Ptr(int64(1)), + Login: Ptr("l"), + Name: Ptr("n"), + NodeID: Ptr("n"), + OrganizationsURL: Ptr("o"), + ReceivedEventsURL: Ptr("r"), + ReposURL: Ptr("r"), + SiteAdmin: Ptr(false), + StarredURL: Ptr("s"), + SubscriptionsURL: Ptr("s"), + Type: Ptr("User"), + URL: Ptr("u"), }, Reviewers: []*RequiredReviewer{ { - Type: String("User"), + Type: Ptr("User"), Reviewer: &User{ - AvatarURL: String("a"), - Email: String("e"), - EventsURL: String("e"), - FollowersURL: String("f"), - FollowingURL: String("f"), - GistsURL: String("g"), - GravatarID: String("g"), - HTMLURL: String("h"), - ID: Int64(1), - Login: String("l"), - Name: String("n"), - NodeID: String("n"), - OrganizationsURL: String("o"), - ReceivedEventsURL: String("r"), - ReposURL: String("r"), - SiteAdmin: Bool(false), - StarredURL: String("s"), - SubscriptionsURL: String("s"), - Type: String("User"), - URL: String("u"), + AvatarURL: Ptr("a"), + Email: Ptr("e"), + EventsURL: Ptr("e"), + FollowersURL: Ptr("f"), + FollowingURL: Ptr("f"), + GistsURL: Ptr("g"), + GravatarID: Ptr("g"), + HTMLURL: Ptr("h"), + ID: Ptr(int64(1)), + Login: Ptr("l"), + Name: Ptr("n"), + NodeID: Ptr("n"), + OrganizationsURL: Ptr("o"), + ReceivedEventsURL: Ptr("r"), + ReposURL: Ptr("r"), + SiteAdmin: Ptr(false), + StarredURL: Ptr("s"), + SubscriptionsURL: Ptr("s"), + Type: Ptr("User"), + URL: Ptr("u"), }, }, { - Type: String("Team"), + Type: Ptr("Team"), Reviewer: &Team{ - ID: Int64(1), - Name: String("n"), - Slug: String("s"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + Slug: Ptr("s"), }, }, }, Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - Since: String("s"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + Since: Ptr("s"), WorkflowJobRun: &WorkflowJobRun{ - ID: Int64(1), - Conclusion: String("c"), - Environment: String("e"), - HTMLURL: String("h"), - Name: String("n"), - Status: String("s"), + ID: Ptr(int64(1)), + Conclusion: Ptr("c"), + Environment: Ptr("e"), + HTMLURL: Ptr("h"), + Name: Ptr("n"), + Status: Ptr("s"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, WorkflowRun: &WorkflowRun{ - ID: Int64(1), - Name: String("n"), - NodeID: String("nid"), - HeadBranch: String("hb"), - HeadSHA: String("hs"), - RunNumber: Int(1), - RunAttempt: Int(1), - Event: String("e"), - Status: String("s"), - Conclusion: String("c"), - WorkflowID: Int64(1), - URL: String("u"), - HTMLURL: String("h"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + NodeID: Ptr("nid"), + HeadBranch: Ptr("hb"), + HeadSHA: Ptr("hs"), + RunNumber: Ptr(1), + RunAttempt: Ptr(1), + Event: Ptr("e"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + WorkflowID: Ptr(int64(1)), + URL: Ptr("u"), + HTMLURL: Ptr("h"), PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, @@ -6751,42 +6751,42 @@ func TestDeploymentReviewEvent_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, RunStartedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), - PreviousAttemptURL: String("p"), + JobsURL: Ptr("j"), + LogsURL: Ptr("l"), + CheckSuiteURL: Ptr("c"), + ArtifactsURL: Ptr("a"), + CancelURL: Ptr("c"), + RerunURL: Ptr("r"), + PreviousAttemptURL: Ptr("p"), HeadCommit: &HeadCommit{ - Message: String("m"), + Message: Ptr("m"), Author: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, - URL: String("u"), - Distinct: Bool(false), - SHA: String("s"), - ID: String("i"), - TreeID: String("tid"), + URL: Ptr("u"), + Distinct: Ptr(false), + SHA: Ptr("s"), + ID: Ptr("i"), + TreeID: Ptr("tid"), Timestamp: &Timestamp{referenceTime}, Committer: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, }, - WorkflowURL: String("w"), + WorkflowURL: Ptr("w"), Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, HeadRepository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, } @@ -7103,155 +7103,155 @@ func TestDeploymentStatusEvent_Marshal(t *testing.T) { u := &DeploymentStatusEvent{ Deployment: &Deployment{ - URL: String("url"), - ID: Int64(1), - SHA: String("sha"), - Ref: String("ref"), - Task: String("t"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + SHA: Ptr("sha"), + Ref: Ptr("ref"), + Task: Ptr("t"), Payload: jsonMsg, - Environment: String("e"), - Description: String("d"), + Environment: Ptr("e"), + Description: Ptr("d"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - StatusesURL: String("surl"), - RepositoryURL: String("rurl"), - NodeID: String("nid"), + StatusesURL: Ptr("surl"), + RepositoryURL: Ptr("rurl"), + NodeID: Ptr("nid"), }, DeploymentStatus: &DeploymentStatus{ - ID: Int64(1), - State: String("s"), + ID: Ptr(int64(1)), + State: Ptr("s"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - Description: String("s"), - Environment: String("s"), - NodeID: String("s"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + Description: Ptr("s"), + Environment: Ptr("s"), + NodeID: Ptr("s"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - TargetURL: String("s"), - DeploymentURL: String("s"), - RepositoryURL: String("s"), - EnvironmentURL: String("s"), - LogURL: String("s"), - URL: String("s"), + TargetURL: Ptr("s"), + DeploymentURL: Ptr("s"), + RepositoryURL: Ptr("s"), + EnvironmentURL: Ptr("s"), + LogURL: Ptr("s"), + URL: Ptr("s"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -7432,199 +7432,199 @@ func TestDiscussionCommentEvent_Marshal(t *testing.T) { u := &DiscussionCommentEvent{ Comment: &CommentDiscussion{ - AuthorAssociation: String("aa"), - Body: String("bo"), - ChildCommentCount: Int(1), + AuthorAssociation: Ptr("aa"), + Body: Ptr("bo"), + ChildCommentCount: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - DiscussionID: Int64(1), - HTMLURL: String("hurl"), - ID: Int64(1), - NodeID: String("nid"), - ParentID: Int64(1), + DiscussionID: Ptr(int64(1)), + HTMLURL: Ptr("hurl"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + ParentID: Ptr(int64(1)), Reactions: &Reactions{ - TotalCount: Int(1), - PlusOne: Int(1), - MinusOne: Int(1), - Laugh: Int(1), - Confused: Int(1), - Heart: Int(1), - Hooray: Int(1), - Rocket: Int(1), - Eyes: Int(1), - URL: String("url"), - }, - RepositoryURL: String("rurl"), + TotalCount: Ptr(1), + PlusOne: Ptr(1), + MinusOne: Ptr(1), + Laugh: Ptr(1), + Confused: Ptr(1), + Heart: Ptr(1), + Hooray: Ptr(1), + Rocket: Ptr(1), + Eyes: Ptr(1), + URL: Ptr("url"), + }, + RepositoryURL: Ptr("rurl"), UpdatedAt: &Timestamp{referenceTime}, User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, }, Discussion: &Discussion{ - RepositoryURL: String("rurl"), + RepositoryURL: Ptr("rurl"), DiscussionCategory: &DiscussionCategory{ - ID: Int64(1), - NodeID: String("nid"), - RepositoryID: Int64(1), - Emoji: String("emoji"), - Name: String("name"), - Description: String("description"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + RepositoryID: Ptr(int64(1)), + Emoji: Ptr("emoji"), + Name: Ptr("name"), + Description: Ptr("description"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Slug: String("slug"), - IsAnswerable: Bool(false), - }, - HTMLURL: String("hurl"), - ID: Int64(1), - NodeID: String("nurl"), - Number: Int(1), - Title: String("title"), + Slug: Ptr("slug"), + IsAnswerable: Ptr(false), + }, + HTMLURL: Ptr("hurl"), + ID: Ptr(int64(1)), + NodeID: Ptr("nurl"), + Number: Ptr(1), + Title: Ptr("title"), User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - State: String("st"), - Locked: Bool(false), - Comments: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + State: Ptr("st"), + Locked: Ptr(false), + Comments: Ptr(1), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - AuthorAssociation: String("aa"), - Body: String("bo"), + AuthorAssociation: Ptr("aa"), + Body: Ptr("bo"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -7847,165 +7847,165 @@ func TestDiscussionEvent_Marshal(t *testing.T) { u := &DiscussionEvent{ Discussion: &Discussion{ - RepositoryURL: String("rurl"), + RepositoryURL: Ptr("rurl"), DiscussionCategory: &DiscussionCategory{ - ID: Int64(1), - NodeID: String("nid"), - RepositoryID: Int64(1), - Emoji: String("emoji"), - Name: String("name"), - Description: String("description"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + RepositoryID: Ptr(int64(1)), + Emoji: Ptr("emoji"), + Name: Ptr("name"), + Description: Ptr("description"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Slug: String("slug"), - IsAnswerable: Bool(false), - }, - HTMLURL: String("hurl"), - ID: Int64(1), - NodeID: String("nurl"), - Number: Int(1), - Title: String("title"), + Slug: Ptr("slug"), + IsAnswerable: Ptr(false), + }, + HTMLURL: Ptr("hurl"), + ID: Ptr(int64(1)), + NodeID: Ptr("nurl"), + Number: Ptr(1), + Title: Ptr("title"), User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - State: String("st"), - Locked: Bool(false), - Comments: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + State: Ptr("st"), + Locked: Ptr(false), + Comments: Ptr(1), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - AuthorAssociation: String("aa"), - Body: String("bo"), + AuthorAssociation: Ptr("aa"), + Body: Ptr("bo"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -8193,61 +8193,61 @@ func TestPackageEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PackageEvent{}, "{}") u := &PackageEvent{ - Action: String("a"), + Action: Ptr("a"), Package: &Package{ - ID: Int64(1), - Name: String("n"), - PackageType: String("pt"), - HTMLURL: String("hurl"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + PackageType: Ptr("pt"), + HTMLURL: Ptr("hurl"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - PackageVersion: &PackageVersion{ID: Int64(1)}, - Registry: &PackageRegistry{Name: String("n")}, + PackageVersion: &PackageVersion{ID: Ptr(int64(1))}, + Registry: &PackageRegistry{Name: Ptr("n")}, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -8322,32 +8322,32 @@ func TestPersonalAccessTokenRequestEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PersonalAccessTokenRequestEvent{}, "{}") event := &PersonalAccessTokenRequestEvent{ - Action: String("a"), + Action: Ptr("a"), PersonalAccessTokenRequest: &PersonalAccessTokenRequest{ - ID: Int64(1), - Owner: &User{Login: String("l")}, + ID: Ptr(int64(1)), + Owner: &User{Login: Ptr("l")}, PermissionsAdded: &PersonalAccessTokenPermissions{ Org: map[string]string{"organization_events": "read"}, Repo: map[string]string{"security_events": "write"}, }, CreatedAt: &Timestamp{referenceTime}, - TokenExpired: Bool(false), + TokenExpired: Ptr(false), TokenExpiresAt: &Timestamp{referenceTime}, TokenLastUsedAt: &Timestamp{referenceTime}, - RepositoryCount: Int64(1), - RepositorySelection: String("rs"), + RepositoryCount: Ptr(int64(1)), + RepositorySelection: Ptr("rs"), Repositories: []*Repository{ { - Name: String("n"), + Name: Ptr("n"), }, }, }, - Org: &Organization{Name: String("n")}, + Org: &Organization{Name: Ptr("n")}, Sender: &User{ - Login: String("l"), + Login: Ptr("l"), }, Installation: &Installation{ - ID: Int64(1), + ID: Ptr(int64(1)), }, } @@ -8401,110 +8401,110 @@ func TestPingEvent_Marshal(t *testing.T) { hookConfig := new(HookConfig) u := &PingEvent{ - Zen: String("z"), - HookID: Int64(1), + Zen: Ptr("z"), + HookID: Ptr(int64(1)), Hook: &Hook{ CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("url"), - ID: Int64(1), - Type: String("t"), - Name: String("n"), - TestURL: String("tu"), - PingURL: String("pu"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + Type: Ptr("t"), + Name: Ptr("n"), + TestURL: Ptr("tu"), + PingURL: Ptr("pu"), LastResponse: l, Config: hookConfig, Events: []string{"a"}, - Active: Bool(true), + Active: Ptr(true), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -8647,134 +8647,134 @@ func TestRepositoryDispatchEvent_Marshal(t *testing.T) { jsonMsg, _ := json.Marshal(&l) u := &RepositoryDispatchEvent{ - Action: String("a"), - Branch: String("b"), + Action: Ptr("a"), + Branch: Ptr("b"), ClientPayload: jsonMsg, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -8931,42 +8931,42 @@ func TestRepositoryImportEvent_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryImportEvent{}, "{}") u := &RepositoryImportEvent{ - Status: String("success"), + Status: Ptr("success"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -9018,131 +9018,131 @@ func TestRepositoryEvent_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryEvent{}, "{}") u := &RepositoryEvent{ - Action: String("a"), + Action: Ptr("a"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -9295,125 +9295,125 @@ func TestReleaseEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ReleaseEvent{}, "{}") u := &ReleaseEvent{ - Action: String("a"), + Action: Ptr("a"), Release: &RepositoryRelease{ - Name: String("n"), - DiscussionCategoryName: String("dcn"), - ID: Int64(2), + Name: Ptr("n"), + DiscussionCategoryName: Ptr("dcn"), + ID: Ptr(int64(2)), CreatedAt: &Timestamp{referenceTime}, PublishedAt: &Timestamp{referenceTime}, - URL: String("url"), - HTMLURL: String("htmlurl"), - AssetsURL: String("assetsurl"), - Assets: []*ReleaseAsset{{ID: Int64(1)}}, - UploadURL: String("uploadurl"), - ZipballURL: String("zipballurl"), - TarballURL: String("tarballurl"), - Author: &User{Name: String("octocat")}, - NodeID: String("nid"), + URL: Ptr("url"), + HTMLURL: Ptr("htmlurl"), + AssetsURL: Ptr("assetsurl"), + Assets: []*ReleaseAsset{{ID: Ptr(int64(1))}}, + UploadURL: Ptr("uploadurl"), + ZipballURL: Ptr("zipballurl"), + TarballURL: Ptr("tarballurl"), + Author: &User{Name: Ptr("octocat")}, + NodeID: Ptr("nid"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -9571,161 +9571,161 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { jsonMsg, _ := json.Marshal(&l) u := &RepositoryRulesetEvent{ - Action: String("a"), + Action: Ptr("a"), Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, RepositoryRuleset: &RepositoryRuleset{ ID: 1, Name: "n", - Target: String("branch"), - SourceType: String("Repository"), + Target: Ptr("branch"), + SourceType: Ptr("Repository"), Source: "s", Enforcement: "disabled", BypassActors: []*BypassActor{ { - ActorID: Int64(234), - ActorType: String("Team"), - BypassMode: String("Always"), + ActorID: Ptr(int64(234)), + ActorType: Ptr("Team"), + BypassMode: Ptr("Always"), }, }, - CurrentUserCanBypass: String("always"), - NodeID: String("n"), + CurrentUserCanBypass: Ptr("always"), + NodeID: Ptr("n"), Links: &RepositoryRulesetLink{ Self: &RulesetLink{ - HRef: String("href"), + HRef: Ptr("href"), }, HTML: &RulesetLink{ - HRef: String("href"), + HRef: Ptr("href"), }, }, Conditions: json.RawMessage(jsonMsg), @@ -9783,7 +9783,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, @@ -9795,8 +9795,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }, @@ -9811,8 +9811,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }, @@ -9820,8 +9820,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }, @@ -9829,8 +9829,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }, @@ -9865,7 +9865,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredWorkflows: []*RuleRequiredWorkflow{ { Path: ".github/workflows/test.yml", - RepositoryID: Int64(1), + RepositoryID: Ptr(int64(1)), }, }, }, @@ -9887,10 +9887,10 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { }, Changes: &RepositoryRulesetEditedChanges{ Name: &RepositoryRulesetEditedSource{ - From: String("f"), + From: Ptr("f"), }, Enforcement: &RepositoryRulesetEditedSource{ - From: String("e"), + From: Ptr("e"), }, Conditions: &RepositoryRulesetEditedConditions{ Added: []*RepositoryRulesetRefCondition{ @@ -9919,10 +9919,10 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { }, Changes: &RepositoryRulesetUpdatedConditionsEdited{ ConditionType: &RepositoryRulesetEditedSource{ - From: String("c"), + From: Ptr("c"), }, Target: &RepositoryRulesetEditedSource{ - From: String("t"), + From: Ptr("t"), }, Include: &RepositoryRulesetEditedSources{ From: []string{"from"}, @@ -9990,7 +9990,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, @@ -10002,8 +10002,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }, @@ -10018,8 +10018,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }, @@ -10027,8 +10027,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }, @@ -10036,8 +10036,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }, @@ -10072,7 +10072,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredWorkflows: []*RuleRequiredWorkflow{ { Path: ".github/workflows/test.yml", - RepositoryID: Int64(1), + RepositoryID: Ptr(int64(1)), }, }, }, @@ -10144,7 +10144,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, @@ -10156,8 +10156,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }, @@ -10172,8 +10172,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }, @@ -10181,8 +10181,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }, @@ -10190,8 +10190,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }, @@ -10226,7 +10226,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredWorkflows: []*RuleRequiredWorkflow{ { Path: ".github/workflows/test.yml", - RepositoryID: Int64(1), + RepositoryID: Ptr(int64(1)), }, }, }, @@ -10298,7 +10298,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, @@ -10310,8 +10310,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }, @@ -10326,8 +10326,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }, @@ -10335,8 +10335,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }, @@ -10344,8 +10344,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }, @@ -10380,7 +10380,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { RequiredWorkflows: []*RuleRequiredWorkflow{ { Path: ".github/workflows/test.yml", - RepositoryID: Int64(1), + RepositoryID: Ptr(int64(1)), }, }, }, @@ -10412,13 +10412,13 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { }, }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -11343,114 +11343,114 @@ func TestContentReferenceEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ContentReferenceEvent{}, "{}") u := &ContentReferenceEvent{ - Action: String("a"), + Action: Ptr("a"), ContentReference: &ContentReference{ - ID: Int64(1), - NodeID: String("nid"), - Reference: String("ref"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Reference: Ptr("ref"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -11586,128 +11586,128 @@ func TestMemberEvent_Marshal(t *testing.T) { testJSONMarshal(t, &MemberEvent{}, "{}") u := &MemberEvent{ - Action: String("a"), + Action: Ptr("a"), Member: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Changes: &MemberChanges{ Permission: &MemberChangesPermission{ - From: String("f"), - To: String("t"), + From: Ptr("f"), + To: Ptr("t"), }, RoleName: &MemberChangesRoleName{ - From: String("f"), - To: String("t"), + From: Ptr("f"), + To: Ptr("t"), }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -11857,175 +11857,175 @@ func TestMembershipEvent_Marshal(t *testing.T) { testJSONMarshal(t, &MembershipEvent{}, "{}") u := &MembershipEvent{ - Action: String("a"), - Scope: String("s"), + Action: Ptr("a"), + Scope: Ptr("s"), Member: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Team: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - MembersURL: String("m"), - RepositoriesURL: String("r"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + MembersURL: Ptr("m"), + RepositoriesURL: Ptr("r"), Organization: &Organization{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - HTMLURL: String("h"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), + 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"), }, Parent: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - }, - LDAPDN: String("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + }, + LDAPDN: Ptr("l"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -12222,138 +12222,138 @@ func TestMergeGroupEvent_Marshal(t *testing.T) { testJSONMarshal(t, &MergeGroupEvent{}, "{}") u := &MergeGroupEvent{ - Action: String("a"), + Action: Ptr("a"), MergeGroup: &MergeGroup{ - HeadSHA: String("hs"), - HeadRef: String("hr"), - BaseSHA: String("bs"), - BaseRef: String("br"), - HeadCommit: &Commit{NodeID: String("nid")}, + HeadSHA: Ptr("hs"), + HeadRef: Ptr("hr"), + BaseSHA: Ptr("bs"), + BaseRef: Ptr("br"), + HeadCommit: &Commit{NodeID: Ptr("nid")}, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -12515,135 +12515,135 @@ func TestOrgBlockEvent_Marshal(t *testing.T) { testJSONMarshal(t, &OrgBlockEvent{}, "{}") u := &OrgBlockEvent{ - Action: String("a"), + Action: Ptr("a"), BlockedUser: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -12802,116 +12802,116 @@ func TestGollumEvent_Marshal(t *testing.T) { u := &GollumEvent{ Pages: []*Page{ { - PageName: String("pn"), - Title: String("t"), - Summary: String("s"), - Action: String("a"), - SHA: String("sha"), - HTMLURL: String("hu"), + PageName: Ptr("pn"), + Title: Ptr("t"), + Summary: Ptr("s"), + Action: Ptr("a"), + SHA: Ptr("sha"), + HTMLURL: Ptr("hu"), }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -13051,54 +13051,54 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) { testJSONMarshal(t, &WorkflowRunEvent{}, "{}") u := &WorkflowRunEvent{ - Action: String("a"), + Action: Ptr("a"), Workflow: &Workflow{ - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - Path: String("p"), - State: String("s"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + Path: Ptr("p"), + State: Ptr("s"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("u"), - HTMLURL: String("h"), - BadgeURL: String("b"), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + BadgeURL: Ptr("b"), }, WorkflowRun: &WorkflowRun{ - ID: Int64(1), - Name: String("n"), - NodeID: String("nid"), - HeadBranch: String("hb"), - HeadSHA: String("hs"), - RunNumber: Int(1), - RunAttempt: Int(1), - Event: String("e"), - Status: String("s"), - Conclusion: String("c"), - WorkflowID: Int64(1), - URL: String("u"), - HTMLURL: String("h"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + NodeID: Ptr("nid"), + HeadBranch: Ptr("hb"), + HeadSHA: Ptr("hs"), + RunNumber: Ptr(1), + RunAttempt: Ptr(1), + Event: Ptr("e"), + Status: Ptr("s"), + Conclusion: Ptr("c"), + WorkflowID: Ptr(int64(1)), + URL: Ptr("u"), + HTMLURL: Ptr("h"), PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, @@ -13106,79 +13106,79 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, RunStartedAt: &Timestamp{referenceTime}, - JobsURL: String("j"), - LogsURL: String("l"), - CheckSuiteURL: String("c"), - ArtifactsURL: String("a"), - CancelURL: String("c"), - RerunURL: String("r"), - PreviousAttemptURL: String("p"), + JobsURL: Ptr("j"), + LogsURL: Ptr("l"), + CheckSuiteURL: Ptr("c"), + ArtifactsURL: Ptr("a"), + CancelURL: Ptr("c"), + RerunURL: Ptr("r"), + PreviousAttemptURL: Ptr("p"), HeadCommit: &HeadCommit{ - Message: String("m"), + Message: Ptr("m"), Author: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, - URL: String("u"), - Distinct: Bool(false), - SHA: String("s"), - ID: String("i"), - TreeID: String("tid"), + URL: Ptr("u"), + Distinct: Ptr(false), + SHA: Ptr("s"), + ID: Ptr("i"), + TreeID: Ptr("tid"), Timestamp: &Timestamp{referenceTime}, Committer: &CommitAuthor{ - Name: String("n"), - Email: String("e"), - Login: String("l"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("l"), }, }, - WorkflowURL: String("w"), + WorkflowURL: Ptr("w"), Repository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, HeadRepository: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -13327,43 +13327,43 @@ func TestWorkflowDispatchEvent_Marshal(t *testing.T) { jsonMsg, _ := json.Marshal(i) u := &WorkflowDispatchEvent{ Inputs: jsonMsg, - Ref: String("r"), - Workflow: String("w"), + Ref: Ptr("r"), + Workflow: Ptr("w"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -13419,109 +13419,109 @@ func TestWatchEvent_Marshal(t *testing.T) { testJSONMarshal(t, &WatchEvent{}, "{}") u := &WatchEvent{ - Action: String("a"), + Action: Ptr("a"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -13653,36 +13653,36 @@ func TestUserEvent_Marshal(t *testing.T) { u := &UserEvent{ User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, // The action performed. Possible values are: "created" or "deleted". - Action: String("a"), + Action: Ptr("a"), Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -13729,216 +13729,216 @@ func TestCheckRunEvent_Marshal(t *testing.T) { r := &CheckRunEvent{ CheckRun: &CheckRun{ - ID: Int64(1), - NodeID: String("n"), - HeadSHA: String("h"), - ExternalID: String("1"), - URL: String("u"), - HTMLURL: String("u"), - DetailsURL: String("u"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + HeadSHA: Ptr("h"), + ExternalID: Ptr("1"), + URL: Ptr("u"), + HTMLURL: Ptr("u"), + DetailsURL: Ptr("u"), + Status: Ptr("s"), + Conclusion: Ptr("c"), StartedAt: &Timestamp{referenceTime}, CompletedAt: &Timestamp{referenceTime}, Output: &CheckRunOutput{ Annotations: []*CheckRunAnnotation{ { - AnnotationLevel: String("a"), - EndLine: Int(1), - Message: String("m"), - Path: String("p"), - RawDetails: String("r"), - StartLine: Int(1), - Title: String("t"), + AnnotationLevel: Ptr("a"), + EndLine: Ptr(1), + Message: Ptr("m"), + Path: Ptr("p"), + RawDetails: Ptr("r"), + StartLine: Ptr(1), + Title: Ptr("t"), }, }, - AnnotationsCount: Int(1), - AnnotationsURL: String("a"), + AnnotationsCount: Ptr(1), + AnnotationsURL: Ptr("a"), Images: []*CheckRunImage{ { - Alt: String("a"), - ImageURL: String("i"), - Caption: String("c"), + Alt: Ptr("a"), + ImageURL: Ptr("i"), + Caption: Ptr("c"), }, }, - Title: String("t"), - Summary: String("s"), - Text: String("t"), + Title: Ptr("t"), + Summary: Ptr("s"), + Text: Ptr("t"), }, - Name: String("n"), + Name: Ptr("n"), CheckSuite: &CheckSuite{ - ID: Int64(1), + ID: Ptr(int64(1)), }, App: &App{ - ID: Int64(1), - NodeID: String("n"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Name: String("n"), - Description: String("d"), - HTMLURL: String("h"), - ExternalURL: String("u"), + Name: Ptr("n"), + Description: Ptr("d"), + HTMLURL: Ptr("h"), + ExternalURL: Ptr("u"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, }, }, - Action: String("a"), + Action: Ptr("a"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -14184,191 +14184,191 @@ func TestCheckSuiteEvent_Marshal(t *testing.T) { r := &CheckSuiteEvent{ CheckSuite: &CheckSuite{ - ID: Int64(1), - NodeID: String("n"), - HeadBranch: String("h"), - HeadSHA: String("h"), - URL: String("u"), - BeforeSHA: String("b"), - AfterSHA: String("a"), - Status: String("s"), - Conclusion: String("c"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + HeadBranch: Ptr("h"), + HeadSHA: Ptr("h"), + URL: Ptr("u"), + BeforeSHA: Ptr("b"), + AfterSHA: Ptr("a"), + Status: Ptr("s"), + Conclusion: Ptr("c"), App: &App{ - ID: Int64(1), - NodeID: String("n"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Name: String("n"), - Description: String("d"), - HTMLURL: String("h"), - ExternalURL: String("u"), + Name: Ptr("n"), + Description: Ptr("d"), + HTMLURL: Ptr("h"), + ExternalURL: Ptr("u"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Repository: &Repository{ - ID: Int64(1), + ID: Ptr(int64(1)), }, PullRequests: []*PullRequest{ { - URL: String("u"), - ID: Int64(1), - Number: Int(1), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, }, Base: &PullRequestBranch{ - Ref: String("r"), - SHA: String("s"), + Ref: Ptr("r"), + SHA: Ptr("s"), Repo: &Repository{ - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, }, }, HeadCommit: &Commit{ - SHA: String("s"), + SHA: Ptr("s"), }, }, - Action: String("a"), + Action: Ptr("a"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -14582,51 +14582,51 @@ func TestDeployKeyEvent_Marshal(t *testing.T) { testJSONMarshal(t, &DeployKeyEvent{}, "{}") u := &DeployKeyEvent{ - Action: String("a"), + Action: Ptr("a"), Key: &Key{ - ID: Int64(1), - Key: String("k"), - URL: String("k"), - Title: String("k"), - ReadOnly: Bool(false), - Verified: Bool(false), + ID: Ptr(int64(1)), + Key: Ptr("k"), + URL: Ptr("k"), + Title: Ptr("k"), + ReadOnly: Ptr(false), + Verified: Ptr(false), CreatedAt: &Timestamp{referenceTime}, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - URL: String("u"), - EventsURL: String("e"), - ReposURL: String("r"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + AvatarURL: Ptr("a"), + URL: Ptr("u"), + EventsURL: Ptr("e"), + ReposURL: Ptr("r"), }, } @@ -14689,25 +14689,25 @@ func TestMetaEvent_Marshal(t *testing.T) { v := make(map[string]interface{}) v["a"] = "b" hookConfig := &HookConfig{ - ContentType: String("json"), + ContentType: Ptr("json"), } u := &MetaEvent{ - Action: String("a"), - HookID: Int64(1), + Action: Ptr("a"), + HookID: Ptr(int64(1)), Hook: &Hook{ CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("u"), - ID: Int64(1), - Type: String("t"), - Name: String("n"), - TestURL: String("tu"), - PingURL: String("pu"), + URL: Ptr("u"), + ID: Ptr(int64(1)), + Type: Ptr("t"), + Name: Ptr("n"), + TestURL: Ptr("tu"), + PingURL: Ptr("pu"), LastResponse: v, Config: hookConfig, Events: []string{"a"}, - Active: Bool(true), + Active: Ptr(true), }, } @@ -14759,113 +14759,113 @@ func TestCreateEvent_Marshal(t *testing.T) { testJSONMarshal(t, &CreateEvent{}, "{}") r := &CreateEvent{ - Ref: String("r"), - RefType: String("rt"), - MasterBranch: String("mb"), - Description: String("d"), - PusherType: String("pt"), + Ref: Ptr("r"), + RefType: Ptr("rt"), + MasterBranch: Ptr("mb"), + Description: Ptr("d"), + PusherType: Ptr("pt"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -15000,111 +15000,111 @@ func TestDeleteEvent_Marshal(t *testing.T) { testJSONMarshal(t, &DeleteEvent{}, "{}") r := &DeleteEvent{ - Ref: String("r"), - RefType: String("rt"), - PusherType: String("pt"), + Ref: Ptr("r"), + RefType: Ptr("rt"), + PusherType: Ptr("pt"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -15237,52 +15237,52 @@ func TestDependabotAlertEvent_Marshal(t *testing.T) { testJSONMarshal(t, &DependabotAlertEvent{}, "{}") e := &DependabotAlertEvent{ - Action: String("a"), + Action: Ptr("a"), Alert: &DependabotAlert{ - Number: Int(1), - State: String("s"), + Number: Ptr(1), + State: Ptr("s"), Dependency: &Dependency{ Package: &VulnerabilityPackage{ - Ecosystem: String("e"), - Name: String("n"), + Ecosystem: Ptr("e"), + Name: Ptr("n"), }, - ManifestPath: String("mp"), - Scope: String("s"), + ManifestPath: Ptr("mp"), + Scope: Ptr("s"), }, SecurityAdvisory: &DependabotSecurityAdvisory{ - GHSAID: String("ghsaid"), - CVEID: String("cveid"), - Summary: String("s"), - Description: String("d"), + GHSAID: Ptr("ghsaid"), + CVEID: Ptr("cveid"), + Summary: Ptr("s"), + Description: Ptr("d"), Vulnerabilities: []*AdvisoryVulnerability{ { Package: &VulnerabilityPackage{ - Ecosystem: String("e"), - Name: String("n"), + Ecosystem: Ptr("e"), + Name: Ptr("n"), }, - Severity: String("s"), + Severity: Ptr("s"), }, }, - Severity: String("s"), + Severity: Ptr("s"), CVSS: &AdvisoryCVSS{ - Score: Float64(1.0), - VectorString: String("vs"), + Score: Ptr(1.0), + VectorString: Ptr("vs"), }, CWEs: []*AdvisoryCWEs{ { - CWEID: String("cweid"), - Name: String("n"), + CWEID: Ptr("cweid"), + Name: Ptr("n"), }, }, Identifiers: []*AdvisoryIdentifier{ { - Value: String("v"), - Type: String("t"), + Value: Ptr("v"), + Type: Ptr("t"), }, }, References: []*AdvisoryReference{ { - URL: String("u"), + URL: Ptr("u"), }, }, PublishedAt: &Timestamp{referenceTime}, @@ -15291,170 +15291,170 @@ func TestDependabotAlertEvent_Marshal(t *testing.T) { }, SecurityVulnerability: &AdvisoryVulnerability{ Package: &VulnerabilityPackage{ - Ecosystem: String("e"), - Name: String("n"), + Ecosystem: Ptr("e"), + Name: Ptr("n"), }, - Severity: String("s"), - VulnerableVersionRange: String("vvr"), + Severity: Ptr("s"), + VulnerableVersionRange: Ptr("vvr"), FirstPatchedVersion: &FirstPatchedVersion{ - Identifier: String("i"), + Identifier: Ptr("i"), }, }, - URL: String("u"), - HTMLURL: String("hu"), + URL: Ptr("u"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, DismissedAt: &Timestamp{referenceTime}, DismissedBy: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - DismissedReason: String("dr"), - DismissedComment: String("dc"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + DismissedReason: Ptr("dr"), + DismissedComment: Ptr("dc"), FixedAt: &Timestamp{referenceTime}, AutoDismissedAt: &Timestamp{referenceTime}, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -15700,112 +15700,112 @@ func TestForkEvent_Marshal(t *testing.T) { u := &ForkEvent{ Forkee: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -15940,15 +15940,15 @@ func TestGitHubAppAuthorizationEvent_Marshal(t *testing.T) { testJSONMarshal(t, &GitHubAppAuthorizationEvent{}, "{}") u := &GitHubAppAuthorizationEvent{ - Action: String("a"), + Action: Ptr("a"), Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -15973,111 +15973,111 @@ func TestInstallationEvent_Marshal(t *testing.T) { testJSONMarshal(t, &InstallationEvent{}, "{}") u := &InstallationEvent{ - Action: String("a"), + Action: Ptr("a"), Repositories: []*Repository{ { - ID: Int64(1), - URL: String("u"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Name: Ptr("n"), }, }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -16210,24 +16210,24 @@ func TestHeadCommit_Marshal(t *testing.T) { testJSONMarshal(t, &HeadCommit{}, "{}") u := &HeadCommit{ - Message: String("m"), + Message: Ptr("m"), Author: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), - }, - URL: String("u"), - Distinct: Bool(true), - SHA: String("s"), - ID: String("id"), - TreeID: String("tid"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), + }, + URL: Ptr("u"), + Distinct: Ptr(true), + SHA: Ptr("s"), + ID: Ptr("id"), + TreeID: Ptr("tid"), Timestamp: &Timestamp{referenceTime}, Committer: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), }, Added: []string{"a"}, Removed: []string{"r"}, @@ -16273,58 +16273,58 @@ func TestPushEventRepository_Marshal(t *testing.T) { testJSONMarshal(t, &PushEventRepository{}, "{}") u := &PushEventRepository{ - ID: Int64(1), - NodeID: String("nid"), - Name: String("n"), - FullName: String("fn"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Name: Ptr("n"), + FullName: Ptr("fn"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, - Private: Bool(true), - Description: String("d"), - Fork: Bool(true), + Private: Ptr(true), + Description: Ptr("d"), + Fork: Ptr(true), CreatedAt: &Timestamp{referenceTime}, PushedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Homepage: String("h"), - PullsURL: String("p"), - Size: Int(1), - StargazersCount: Int(1), - WatchersCount: Int(1), - Language: String("l"), - HasIssues: Bool(true), - HasDownloads: Bool(true), - HasWiki: Bool(true), - HasPages: Bool(true), - ForksCount: Int(1), - Archived: Bool(true), - Disabled: Bool(true), - OpenIssuesCount: Int(1), - DefaultBranch: String("d"), - MasterBranch: String("m"), - Organization: String("o"), - URL: String("u"), - ArchiveURL: String("a"), - HTMLURL: String("h"), - StatusesURL: String("s"), - GitURL: String("g"), - SSHURL: String("s"), - CloneURL: String("c"), - SVNURL: String("s"), + Homepage: Ptr("h"), + PullsURL: Ptr("p"), + Size: Ptr(1), + StargazersCount: Ptr(1), + WatchersCount: Ptr(1), + Language: Ptr("l"), + HasIssues: Ptr(true), + HasDownloads: Ptr(true), + HasWiki: Ptr(true), + HasPages: Ptr(true), + ForksCount: Ptr(1), + Archived: Ptr(true), + Disabled: Ptr(true), + OpenIssuesCount: Ptr(1), + DefaultBranch: Ptr("d"), + MasterBranch: Ptr("m"), + Organization: Ptr("o"), + URL: Ptr("u"), + ArchiveURL: Ptr("a"), + HTMLURL: Ptr("h"), + StatusesURL: Ptr("s"), + GitURL: Ptr("g"), + SSHURL: Ptr("s"), + CloneURL: Ptr("c"), + SVNURL: Ptr("s"), Topics: []string{"octocat", "api"}, } @@ -16392,8 +16392,8 @@ func TestPushEventRepoOwner_Marshal(t *testing.T) { testJSONMarshal(t, &PushEventRepoOwner{}, "{}") u := &PushEventRepoOwner{ - Name: String("n"), - Email: String("e"), + Name: Ptr("n"), + Email: Ptr("e"), } want := `{ @@ -16409,136 +16409,136 @@ func TestProjectEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectEvent{}, "{}") u := &ProjectEvent{ - Project: &Project{ID: Int64(1)}, - Action: String("a"), + Project: &Project{ID: Ptr(int64(1))}, + Action: Ptr("a"), Changes: &ProjectChange{ - Name: &ProjectName{From: String("NameFrom")}, - Body: &ProjectBody{From: String("BodyFrom")}, + Name: &ProjectName{From: Ptr("NameFrom")}, + Body: &ProjectBody{From: Ptr("BodyFrom")}, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -16702,136 +16702,136 @@ func TestProjectCardEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectCardEvent{}, "{}") u := &ProjectCardEvent{ - Action: String("a"), + Action: Ptr("a"), Changes: &ProjectCardChange{ - Note: &ProjectCardNote{From: String("NoteFrom")}, + Note: &ProjectCardNote{From: Ptr("NoteFrom")}, }, - AfterID: Int64(1), - ProjectCard: &ProjectCard{ID: Int64(1)}, + AfterID: Ptr(int64(1)), + ProjectCard: &ProjectCard{ID: Ptr(int64(1))}, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -16993,136 +16993,136 @@ func TestProjectColumnEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectColumnEvent{}, "{}") u := &ProjectColumnEvent{ - Action: String("a"), + Action: Ptr("a"), Changes: &ProjectColumnChange{ - Name: &ProjectColumnName{From: String("NameFrom")}, + Name: &ProjectColumnName{From: Ptr("NameFrom")}, }, - AfterID: Int64(1), - ProjectColumn: &ProjectColumn{ID: Int64(1)}, + AfterID: Ptr(int64(1)), + ProjectColumn: &ProjectColumn{ID: Ptr(int64(1))}, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -17284,101 +17284,101 @@ func TestProjectV2Event_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectV2Event{}, "{}") u := &ProjectV2Event{ - Action: String("a"), + Action: Ptr("a"), ProjectsV2: &ProjectsV2{ - ID: Int64(1), - NodeID: String("nid"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Creator: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - Title: String("t"), - Description: String("d"), - Public: Bool(true), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + Title: Ptr("t"), + Description: Ptr("d"), + Public: Ptr(true), ClosedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, DeletedAt: &Timestamp{referenceTime}, - Number: Int(1), - ShortDescription: String("sd"), + Number: Ptr(1), + ShortDescription: Ptr("sd"), DeletedBy: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -17495,7 +17495,7 @@ func TestProjectV2ItemEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectV2ItemEvent{}, "{}") u := &ProjectV2ItemEvent{ - Action: String("a"), + Action: Ptr("a"), Changes: &ProjectV2ItemChange{ ArchivedAt: &ArchivedAt{ From: &Timestamp{referenceTime}, @@ -17503,78 +17503,78 @@ func TestProjectV2ItemEvent_Marshal(t *testing.T) { }, }, ProjectV2Item: &ProjectV2Item{ - ID: Int64(1), - NodeID: String("nid"), - ProjectNodeID: String("pnid"), - ContentNodeID: String("cnid"), - ContentType: String("ct"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + ProjectNodeID: Ptr("pnid"), + ContentNodeID: Ptr("cnid"), + ContentType: Ptr("ct"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, ArchivedAt: &Timestamp{referenceTime}, }, Org: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -17676,180 +17676,180 @@ func TestPullRequestEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestEvent{}, "{}") u := &PullRequestEvent{ - Action: String("a"), + Action: Ptr("a"), Assignee: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - Number: Int(1), - PullRequest: &PullRequest{ID: Int64(1)}, + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + Number: Ptr(1), + PullRequest: &PullRequest{ID: Ptr(int64(1))}, Changes: &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: &EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, }, }, RequestedReviewer: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - RequestedTeam: &Team{ID: Int64(1)}, - Label: &Label{ID: Int64(1)}, - Before: String("before"), - After: String("after"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + RequestedTeam: &Team{ID: Ptr(int64(1))}, + Label: &Label{ID: Ptr(int64(1))}, + Before: Ptr("before"), + After: Ptr("after"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, PerformedViaGithubApp: &App{ - ID: Int64(1), - NodeID: String("n"), - Slug: String("s"), - Name: String("n"), - Description: String("d"), - ExternalURL: String("e"), - HTMLURL: String("h"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Slug: Ptr("s"), + Name: Ptr("n"), + Description: Ptr("d"), + ExternalURL: Ptr("e"), + HTMLURL: Ptr("h"), }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -18057,127 +18057,127 @@ func TestPullRequestReviewCommentEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestReviewCommentEvent{}, "{}") u := &PullRequestReviewCommentEvent{ - Action: String("a"), - PullRequest: &PullRequest{ID: Int64(1)}, - Comment: &PullRequestComment{ID: Int64(1)}, + Action: Ptr("a"), + PullRequest: &PullRequest{ID: Ptr(int64(1))}, + Comment: &PullRequestComment{ID: Ptr(int64(1))}, Changes: &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: &EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, }, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -18330,113 +18330,113 @@ func TestPullRequestReviewThreadEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestReviewThreadEvent{}, "{}") u := &PullRequestReviewThreadEvent{ - Action: String("a"), - PullRequest: &PullRequest{ID: Int64(1)}, + Action: Ptr("a"), + PullRequest: &PullRequest{ID: Ptr(int64(1))}, Thread: &PullRequestThread{ - Comments: []*PullRequestComment{{ID: Int64(1)}, {ID: Int64(2)}}, + Comments: []*PullRequestComment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -18580,180 +18580,180 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestTargetEvent{}, "{}") u := &PullRequestTargetEvent{ - Action: String("a"), + Action: Ptr("a"), Assignee: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - Number: Int(1), - PullRequest: &PullRequest{ID: Int64(1)}, + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + Number: Ptr(1), + PullRequest: &PullRequest{ID: Ptr(int64(1))}, Changes: &EditChange{ Title: &EditTitle{ - From: String("TitleFrom"), + From: Ptr("TitleFrom"), }, Body: &EditBody{ - From: String("BodyFrom"), + From: Ptr("BodyFrom"), }, Base: &EditBase{ Ref: &EditRef{ - From: String("BaseRefFrom"), + From: Ptr("BaseRefFrom"), }, SHA: &EditSHA{ - From: String("BaseSHAFrom"), + From: Ptr("BaseSHAFrom"), }, }, }, RequestedReviewer: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - RequestedTeam: &Team{ID: Int64(1)}, - Label: &Label{ID: Int64(1)}, - Before: String("before"), - After: String("after"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + RequestedTeam: &Team{ID: Ptr(int64(1))}, + Label: &Label{ID: Ptr(int64(1))}, + Before: Ptr("before"), + After: Ptr("after"), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, PerformedViaGithubApp: &App{ - ID: Int64(1), - NodeID: String("n"), - Slug: String("s"), - Name: String("n"), - Description: String("d"), - ExternalURL: String("e"), - HTMLURL: String("h"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Slug: Ptr("s"), + Name: Ptr("n"), + Description: Ptr("d"), + ExternalURL: Ptr("e"), + HTMLURL: Ptr("h"), }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -18961,30 +18961,30 @@ func TestRepositoryVulnerabilityAlertEvent_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryVulnerabilityAlertEvent{}, "{}") u := &RepositoryVulnerabilityAlertEvent{ - Action: String("a"), + Action: Ptr("a"), Alert: &RepositoryVulnerabilityAlert{ - ID: Int64(1), - AffectedRange: String("ar"), - AffectedPackageName: String("apn"), - ExternalReference: String("er"), - ExternalIdentifier: String("ei"), - FixedIn: String("fi"), + ID: Ptr(int64(1)), + AffectedRange: Ptr("ar"), + AffectedPackageName: Ptr("apn"), + ExternalReference: Ptr("er"), + ExternalIdentifier: Ptr("ei"), + FixedIn: Ptr("fi"), Dismisser: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), - }, - DismissReason: String("dr"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), + }, + DismissReason: Ptr("dr"), DismissedAt: &Timestamp{referenceTime}, }, Repository: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, } @@ -19024,158 +19024,158 @@ func TestSecretScanningAlertEvent_Marshal(t *testing.T) { testJSONMarshal(t, &SecretScanningAlertEvent{}, "{}") u := &SecretScanningAlertEvent{ - Action: String("a"), + Action: Ptr("a"), Alert: &SecretScanningAlert{ - Number: Int(1), - SecretType: String("t"), - Resolution: String("r"), + Number: Ptr(1), + SecretType: Ptr("t"), + Resolution: Ptr("r"), ResolvedBy: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, ResolvedAt: &Timestamp{referenceTime}, }, Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -19354,44 +19354,44 @@ func TestSecretScanningAlertLocationEvent_Marshal(t *testing.T) { t.Parallel() testJSONMarshal(t, &SecretScanningAlertLocationEvent{}, "{}") u := &SecretScanningAlertLocationEvent{ - Action: String("created"), + Action: Ptr("created"), Alert: &SecretScanningAlert{ - Number: Int(10), + Number: Ptr(10), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("a"), - HTMLURL: String("a"), - SecretType: String("mailchimp_api_key"), + URL: Ptr("a"), + HTMLURL: Ptr("a"), + SecretType: Ptr("mailchimp_api_key"), }, Location: &SecretScanningAlertLocation{ - Type: String("blob"), + Type: Ptr("blob"), Details: &SecretScanningAlertLocationDetails{ - Path: String("path/to/file"), - Startline: Int(10), - EndLine: Int(20), - StartColumn: Int(1), - EndColumn: Int(2), - BlobSHA: String("d6e4c75c141dbacecc279b721b8bsomeSHA"), - BlobURL: String("a"), - CommitSHA: String("d6e4c75c141dbacecc279b721b8bsomeSHA"), - CommitURL: String("a"), + Path: Ptr("path/to/file"), + Startline: Ptr(10), + EndLine: Ptr(20), + StartColumn: Ptr(1), + EndColumn: Ptr(2), + BlobSHA: Ptr("d6e4c75c141dbacecc279b721b8bsomeSHA"), + BlobURL: Ptr("a"), + CommitSHA: Ptr("d6e4c75c141dbacecc279b721b8bsomeSHA"), + CommitURL: Ptr("a"), }, }, Repo: &Repository{ - ID: Int64(12345), - NodeID: String("MDEwOlJlcG9zaXRvcnkxMjM0NQ=="), - Name: String("example-repo"), + ID: Ptr(int64(12345)), + NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjM0NQ=="), + Name: Ptr("example-repo"), }, Organization: &Organization{ - Login: String("example-org"), - ID: Int64(67890), + Login: Ptr("example-org"), + ID: Ptr(int64(67890)), }, Sender: &User{ - Login: String("example-user"), - ID: Int64(1111), + Login: Ptr("example-user"), + ID: Ptr(int64(1111)), }, Installation: &Installation{ - ID: Int64(2222), + ID: Ptr(int64(2222)), }, } @@ -19446,31 +19446,31 @@ func TestSecurityAdvisoryEvent_Marshal(t *testing.T) { t.Parallel() testJSONMarshal(t, &SecurityAdvisoryEvent{}, "{}") u := &SecurityAdvisoryEvent{ - Action: String("published"), + Action: Ptr("published"), SecurityAdvisory: &SecurityAdvisory{ CVSS: &AdvisoryCVSS{ - Score: Float64(1.0), - VectorString: String("vs"), + Score: Ptr(1.0), + VectorString: Ptr("vs"), }, CWEs: []*AdvisoryCWEs{ { - CWEID: String("cweid"), - Name: String("n"), + CWEID: Ptr("cweid"), + Name: Ptr("n"), }, }, - GHSAID: String("GHSA-rf4j-j272-some"), - Summary: String("Siuuuuuuuuu"), - Description: String("desc"), - Severity: String("moderate"), + GHSAID: Ptr("GHSA-rf4j-j272-some"), + Summary: Ptr("Siuuuuuuuuu"), + Description: Ptr("desc"), + Severity: Ptr("moderate"), Identifiers: []*AdvisoryIdentifier{ { - Value: String("GHSA-rf4j-j272-some"), - Type: String("GHSA"), + Value: Ptr("GHSA-rf4j-j272-some"), + Type: Ptr("GHSA"), }, }, References: []*AdvisoryReference{ { - URL: String("https://some-url"), + URL: Ptr("https://some-url"), }, }, PublishedAt: &Timestamp{referenceTime}, @@ -19479,157 +19479,157 @@ func TestSecurityAdvisoryEvent_Marshal(t *testing.T) { Vulnerabilities: []*AdvisoryVulnerability{ { Package: &VulnerabilityPackage{ - Ecosystem: String("ucl"), - Name: String("penaldo"), + Ecosystem: Ptr("ucl"), + Name: Ptr("penaldo"), }, - Severity: String("moderate"), - VulnerableVersionRange: String(">= 2.0.0, < 2.0.2"), + Severity: Ptr("moderate"), + VulnerableVersionRange: Ptr(">= 2.0.0, < 2.0.2"), FirstPatchedVersion: &FirstPatchedVersion{ - Identifier: String("2.0.2"), + Identifier: Ptr("2.0.2"), }, }, }, }, Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Repository: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -19837,160 +19837,160 @@ func TestSecurityAndAnalysisEvent_Marshal(t *testing.T) { From: &SecurityAndAnalysisChangeFrom{ SecurityAndAnalysis: &SecurityAndAnalysis{ AdvancedSecurity: &AdvancedSecurity{ - Status: String("enabled"), + Status: Ptr("enabled"), }, SecretScanning: &SecretScanning{ - Status: String("enabled"), + Status: Ptr("enabled"), }, SecretScanningPushProtection: &SecretScanningPushProtection{ - Status: String("enabled"), + Status: Ptr("enabled"), }, DependabotSecurityUpdates: &DependabotSecurityUpdates{ - Status: String("enabled"), + Status: Ptr("enabled"), }, }, }, }, Enterprise: &Enterprise{ - ID: Int(1), - Slug: String("s"), - Name: String("n"), - NodeID: String("nid"), - AvatarURL: String("au"), - Description: String("d"), - WebsiteURL: String("wu"), - HTMLURL: String("hu"), + ID: Ptr(1), + Slug: Ptr("s"), + Name: Ptr("n"), + NodeID: Ptr("nid"), + AvatarURL: Ptr("au"), + Description: Ptr("d"), + WebsiteURL: Ptr("wu"), + HTMLURL: Ptr("hu"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, Installation: &Installation{ - ID: Int64(1), - NodeID: String("nid"), - AppID: Int64(1), - AppSlug: String("as"), - TargetID: Int64(1), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + AppID: Ptr(int64(1)), + AppSlug: Ptr("as"), + TargetID: Ptr(int64(1)), Account: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - AccessTokensURL: String("atu"), - RepositoriesURL: String("ru"), - HTMLURL: String("hu"), - TargetType: String("tt"), - SingleFileName: String("sfn"), - RepositorySelection: String("rs"), + AccessTokensURL: Ptr("atu"), + RepositoriesURL: Ptr("ru"), + HTMLURL: Ptr("hu"), + TargetType: Ptr("tt"), + SingleFileName: Ptr("sfn"), + RepositorySelection: Ptr("rs"), Events: []string{"e"}, SingleFilePaths: []string{"s"}, Permissions: &InstallationPermissions{ - Actions: String("a"), - Administration: String("ad"), - Checks: String("c"), - Contents: String("co"), - ContentReferences: String("cr"), - Deployments: String("d"), - Environments: String("e"), - Issues: String("i"), - Metadata: String("md"), - Members: String("m"), - OrganizationAdministration: String("oa"), - OrganizationHooks: String("oh"), - OrganizationPlan: String("op"), - OrganizationPreReceiveHooks: String("opr"), - OrganizationProjects: String("op"), - OrganizationSecrets: String("os"), - OrganizationSelfHostedRunners: String("osh"), - OrganizationUserBlocking: String("oub"), - Packages: String("pkg"), - Pages: String("pg"), - PullRequests: String("pr"), - RepositoryHooks: String("rh"), - RepositoryProjects: String("rp"), - RepositoryPreReceiveHooks: String("rprh"), - Secrets: String("s"), - SecretScanningAlerts: String("ssa"), - SecurityEvents: String("se"), - SingleFile: String("sf"), - Statuses: String("s"), - TeamDiscussions: String("td"), - VulnerabilityAlerts: String("va"), - Workflows: String("w"), + Actions: Ptr("a"), + Administration: Ptr("ad"), + Checks: Ptr("c"), + Contents: Ptr("co"), + ContentReferences: Ptr("cr"), + Deployments: Ptr("d"), + Environments: Ptr("e"), + Issues: Ptr("i"), + Metadata: Ptr("md"), + Members: Ptr("m"), + OrganizationAdministration: Ptr("oa"), + OrganizationHooks: Ptr("oh"), + OrganizationPlan: Ptr("op"), + OrganizationPreReceiveHooks: Ptr("opr"), + OrganizationProjects: Ptr("op"), + OrganizationSecrets: Ptr("os"), + OrganizationSelfHostedRunners: Ptr("osh"), + OrganizationUserBlocking: Ptr("oub"), + Packages: Ptr("pkg"), + Pages: Ptr("pg"), + PullRequests: Ptr("pr"), + RepositoryHooks: Ptr("rh"), + RepositoryProjects: Ptr("rp"), + RepositoryPreReceiveHooks: Ptr("rprh"), + Secrets: Ptr("s"), + SecretScanningAlerts: Ptr("ssa"), + SecurityEvents: Ptr("se"), + SingleFile: Ptr("sf"), + Statuses: Ptr("s"), + TeamDiscussions: Ptr("td"), + VulnerabilityAlerts: Ptr("va"), + Workflows: Ptr("w"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, SuspendedAt: &Timestamp{referenceTime}, }, Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, Repository: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("n"), }, Sender: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -20169,167 +20169,167 @@ func TestCodeScanningAlertEvent_Marshal(t *testing.T) { testJSONMarshal(t, &CodeScanningAlertEvent{}, "{}") u := &CodeScanningAlertEvent{ - Action: String("reopened"), + Action: Ptr("reopened"), Alert: &Alert{ - Number: Int(10), + Number: Ptr(10), Rule: &Rule{ - ID: String("Style/FrozenStringLiteralComment"), - Severity: String("note"), - Description: String("desc"), - FullDescription: String("full desc"), + ID: Ptr("Style/FrozenStringLiteralComment"), + Severity: Ptr("note"), + Description: Ptr("desc"), + FullDescription: Ptr("full desc"), Tags: []string{"style"}, - Help: String("help"), + Help: Ptr("help"), }, Tool: &Tool{ - Name: String("Rubocop"), + Name: Ptr("Rubocop"), Version: nil, }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, FixedAt: nil, - State: String("open"), - URL: String("a"), - HTMLURL: String("a"), + State: Ptr("open"), + URL: Ptr("a"), + HTMLURL: Ptr("a"), Instances: []*MostRecentInstance{ { - Ref: String("refs/heads/main"), - AnalysisKey: String(".github/workflows/workflow.yml:upload"), - Environment: String("{}"), - State: String("open"), + Ref: Ptr("refs/heads/main"), + AnalysisKey: Ptr(".github/workflows/workflow.yml:upload"), + Environment: Ptr("{}"), + State: Ptr("open"), }, }, DismissedBy: nil, DismissedAt: nil, DismissedReason: nil, }, - Ref: String("refs/heads/main"), - CommitOID: String("d6e4c75c141dbacecc279b721b8bsomeSHA"), + Ref: Ptr("refs/heads/main"), + CommitOID: Ptr("d6e4c75c141dbacecc279b721b8bsomeSHA"), Repo: &Repository{ - ID: Int64(1234234535), - NodeID: String("MDEwOlJlcG9zaXRvcnkxODY4NT=="), + ID: Ptr(int64(1234234535)), + NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxODY4NT=="), Owner: &User{ - Login: String("Codertocat"), - ID: Int64(21031067), - NodeID: String("MDQ6VXNlcjIxMDMxMDY3"), - AvatarURL: String("a"), - GravatarID: String(""), - URL: String("a"), - HTMLURL: String("a"), - Type: String("User"), - SiteAdmin: Bool(false), - FollowersURL: String("a"), - FollowingURL: String("a"), - EventsURL: String("a"), - GistsURL: String("a"), - OrganizationsURL: String("a"), - ReceivedEventsURL: String("a"), - ReposURL: String("a"), - StarredURL: String("a"), - SubscriptionsURL: String("a"), - }, - HTMLURL: String("a"), - Name: String("Hello-World"), - FullName: String("Codertocat/Hello-World"), + Login: Ptr("Codertocat"), + ID: Ptr(int64(21031067)), + NodeID: Ptr("MDQ6VXNlcjIxMDMxMDY3"), + AvatarURL: Ptr("a"), + GravatarID: Ptr(""), + URL: Ptr("a"), + HTMLURL: Ptr("a"), + Type: Ptr("User"), + SiteAdmin: Ptr(false), + FollowersURL: Ptr("a"), + FollowingURL: Ptr("a"), + EventsURL: Ptr("a"), + GistsURL: Ptr("a"), + OrganizationsURL: Ptr("a"), + ReceivedEventsURL: Ptr("a"), + ReposURL: Ptr("a"), + StarredURL: Ptr("a"), + SubscriptionsURL: Ptr("a"), + }, + HTMLURL: Ptr("a"), + Name: Ptr("Hello-World"), + FullName: Ptr("Codertocat/Hello-World"), Description: nil, - Fork: Bool(false), + Fork: Ptr(false), Homepage: nil, - DefaultBranch: String("main"), + DefaultBranch: Ptr("main"), CreatedAt: &Timestamp{referenceTime}, PushedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - CloneURL: String("a"), - GitURL: String("a"), + CloneURL: Ptr("a"), + GitURL: Ptr("a"), MirrorURL: nil, - SSHURL: String("a"), - SVNURL: String("a"), + SSHURL: Ptr("a"), + SVNURL: Ptr("a"), Language: nil, - ForksCount: Int(0), - OpenIssuesCount: Int(2), - OpenIssues: Int(2), - StargazersCount: Int(0), - WatchersCount: Int(0), - Watchers: Int(0), - Size: Int(0), - Archived: Bool(false), - Disabled: Bool(false), + ForksCount: Ptr(0), + OpenIssuesCount: Ptr(2), + OpenIssues: Ptr(2), + StargazersCount: Ptr(0), + WatchersCount: Ptr(0), + Watchers: Ptr(0), + Size: Ptr(0), + Archived: Ptr(false), + Disabled: Ptr(false), License: nil, - Private: Bool(false), - HasIssues: Bool(true), - HasWiki: Bool(true), - HasPages: Bool(true), - HasProjects: Bool(true), - HasDownloads: Bool(true), - URL: String("a"), - ArchiveURL: String("a"), - AssigneesURL: String("a"), - BlobsURL: String("a"), - BranchesURL: String("a"), - CollaboratorsURL: String("a"), - CommentsURL: String("a"), - CommitsURL: String("a"), - CompareURL: String("a"), - ContentsURL: String("a"), - ContributorsURL: String("a"), - DeploymentsURL: String("a"), - DownloadsURL: String("a"), - EventsURL: String("a"), - ForksURL: String("a"), - GitCommitsURL: String("a"), - GitRefsURL: String("a"), - GitTagsURL: String("a"), - HooksURL: String("a"), - IssueCommentURL: String("a"), - IssueEventsURL: String("a"), - IssuesURL: String("a"), - KeysURL: String("a"), - LabelsURL: String("a"), - LanguagesURL: String("a"), - MergesURL: String("a"), - MilestonesURL: String("a"), - NotificationsURL: String("a"), - PullsURL: String("a"), - ReleasesURL: String("a"), - StargazersURL: String("a"), - StatusesURL: String("a"), - SubscribersURL: String("a"), - SubscriptionURL: String("a"), - TagsURL: String("a"), - TreesURL: String("a"), - TeamsURL: String("a"), + Private: Ptr(false), + HasIssues: Ptr(true), + HasWiki: Ptr(true), + HasPages: Ptr(true), + HasProjects: Ptr(true), + HasDownloads: Ptr(true), + URL: Ptr("a"), + ArchiveURL: Ptr("a"), + AssigneesURL: Ptr("a"), + BlobsURL: Ptr("a"), + BranchesURL: Ptr("a"), + CollaboratorsURL: Ptr("a"), + CommentsURL: Ptr("a"), + CommitsURL: Ptr("a"), + CompareURL: Ptr("a"), + ContentsURL: Ptr("a"), + ContributorsURL: Ptr("a"), + DeploymentsURL: Ptr("a"), + DownloadsURL: Ptr("a"), + EventsURL: Ptr("a"), + ForksURL: Ptr("a"), + GitCommitsURL: Ptr("a"), + GitRefsURL: Ptr("a"), + GitTagsURL: Ptr("a"), + HooksURL: Ptr("a"), + IssueCommentURL: Ptr("a"), + IssueEventsURL: Ptr("a"), + IssuesURL: Ptr("a"), + KeysURL: Ptr("a"), + LabelsURL: Ptr("a"), + LanguagesURL: Ptr("a"), + MergesURL: Ptr("a"), + MilestonesURL: Ptr("a"), + NotificationsURL: Ptr("a"), + PullsURL: Ptr("a"), + ReleasesURL: Ptr("a"), + StargazersURL: Ptr("a"), + StatusesURL: Ptr("a"), + SubscribersURL: Ptr("a"), + SubscriptionURL: Ptr("a"), + TagsURL: Ptr("a"), + TreesURL: Ptr("a"), + TeamsURL: Ptr("a"), }, Org: &Organization{ - Login: String("Octocoders"), - ID: Int64(6), - NodeID: String("MDEyOk9yZ2FuaXphdGlvbjY="), - AvatarURL: String("a"), - Description: String(""), - URL: String("a"), - EventsURL: String("a"), - HooksURL: String("a"), - IssuesURL: String("a"), - MembersURL: String("a"), - PublicMembersURL: String("a"), - ReposURL: String("a"), + Login: Ptr("Octocoders"), + ID: Ptr(int64(6)), + NodeID: Ptr("MDEyOk9yZ2FuaXphdGlvbjY="), + AvatarURL: Ptr("a"), + Description: Ptr(""), + URL: Ptr("a"), + EventsURL: Ptr("a"), + HooksURL: Ptr("a"), + IssuesURL: Ptr("a"), + MembersURL: Ptr("a"), + PublicMembersURL: Ptr("a"), + ReposURL: Ptr("a"), }, Sender: &User{ - Login: String("github"), - ID: Int64(9919), - NodeID: String("MDEyOk9yZ2FuaXphdGlvbjk5MTk="), - AvatarURL: String("a"), - HTMLURL: String("a"), - GravatarID: String(""), - Type: String("Organization"), - SiteAdmin: Bool(false), - URL: String("a"), - EventsURL: String("a"), - FollowingURL: String("a"), - FollowersURL: String("a"), - GistsURL: String("a"), - OrganizationsURL: String("a"), - ReceivedEventsURL: String("a"), - ReposURL: String("a"), - StarredURL: String("a"), - SubscriptionsURL: String("a"), + Login: Ptr("github"), + ID: Ptr(int64(9919)), + NodeID: Ptr("MDEyOk9yZ2FuaXphdGlvbjk5MTk="), + AvatarURL: Ptr("a"), + HTMLURL: Ptr("a"), + GravatarID: Ptr(""), + Type: Ptr("Organization"), + SiteAdmin: Ptr(false), + URL: Ptr("a"), + EventsURL: Ptr("a"), + FollowingURL: Ptr("a"), + FollowersURL: Ptr("a"), + GistsURL: Ptr("a"), + OrganizationsURL: Ptr("a"), + ReceivedEventsURL: Ptr("a"), + ReposURL: Ptr("a"), + StarredURL: Ptr("a"), + SubscriptionsURL: Ptr("a"), }, } @@ -20509,29 +20509,29 @@ func TestSponsorshipEvent_Marshal(t *testing.T) { testJSONMarshal(t, &SponsorshipEvent{}, "{}") u := &SponsorshipEvent{ - Action: String("created"), - EffectiveDate: String("2023-01-01T00:00:00Z"), + Action: Ptr("created"), + EffectiveDate: Ptr("2023-01-01T00:00:00Z"), Changes: &SponsorshipChanges{ Tier: &SponsorshipTier{ - From: String("basic"), + From: Ptr("basic"), }, - PrivacyLevel: String("public"), + PrivacyLevel: Ptr("public"), }, Repository: &Repository{ - ID: Int64(12345), - NodeID: String("MDEwOlJlcG9zaXRvcnkxMjM0NQ=="), - Name: String("example-repo"), + ID: Ptr(int64(12345)), + NodeID: Ptr("MDEwOlJlcG9zaXRvcnkxMjM0NQ=="), + Name: Ptr("example-repo"), }, Organization: &Organization{ - Login: String("example-org"), - ID: Int64(67890), + Login: Ptr("example-org"), + ID: Ptr(int64(67890)), }, Sender: &User{ - Login: String("example-user"), - ID: Int64(1111), + Login: Ptr("example-user"), + ID: Ptr(int64(1111)), }, Installation: &Installation{ - ID: Int64(2222), + ID: Ptr(int64(2222)), }, } @@ -20571,9 +20571,9 @@ func TestSponsorshipChanges_Marshal(t *testing.T) { u := &SponsorshipChanges{ Tier: &SponsorshipTier{ - From: String("premium"), + From: Ptr("premium"), }, - PrivacyLevel: String("private"), + PrivacyLevel: Ptr("private"), } want := `{ @@ -20591,7 +20591,7 @@ func TestSponsorshipTier_Marshal(t *testing.T) { testJSONMarshal(t, &SponsorshipTier{}, "{}") u := &SponsorshipTier{ - From: String("gold"), + From: Ptr("gold"), } want := `{ diff --git a/github/examples_test.go b/github/examples_test.go index 51eae1e3b5d..fe7494dbef2 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -81,10 +81,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.String("This is my commit message"), + Message: github.Ptr("This is my commit message"), Content: fileContent, - Branch: github.String("master"), - Committer: &github.CommitAuthor{Name: github.String("FirstName LastName"), Email: github.String("user@example.com")}, + Branch: github.Ptr("master"), + Committer: &github.CommitAuthor{Name: github.Ptr("FirstName LastName"), Email: github.Ptr("user@example.com")}, } _, _, err := client.Repositories.CreateFile(ctx, "myOrganization", "myRepository", "myNewFile.md", opts) if err != nil { @@ -121,11 +121,11 @@ func ExamplePullRequestsService_Create() { client := github.NewClient(nil) newPR := &github.NewPullRequest{ - Title: github.String("My awesome pull request"), - Head: github.String("branch_to_merge"), - Base: github.String("master"), - Body: github.String("This is the description of the PR created with the package `github.com/google/go-github/github`"), - MaintainerCanModify: github.Bool(true), + Title: github.Ptr("My awesome pull request"), + Head: github.Ptr("branch_to_merge"), + Base: github.Ptr("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), } ctx := context.Background() diff --git a/github/gen-stringify-test.go b/github/gen-stringify-test.go index cbcea53233b..6c887a0ca2c 100644 --- a/github/gen-stringify-test.go +++ b/github/gen-stringify-test.go @@ -54,13 +54,13 @@ var ( }, "processZeroValue": func(v string) string { switch v { - case "Bool(false)": + case "Ptr(false)": return "false" - case "Float64(0.0)": + case "Ptr(0.0)": return "0" - case "0", "Int(0)", "Int64(0)": + case "0", "Ptr(0)", "Ptr(int64(0))": return "0" - case `""`, `String("")`: + case `""`, `Ptr("")`: return `""` case "Timestamp{}", "&Timestamp{}": return "github.Timestamp{0001-01-01 00:00:00 +0000 UTC}" @@ -276,15 +276,15 @@ func (t *templateData) addIdentPtr(x *ast.Ident, receiverType, fieldName string) var namedStruct = false switch x.String() { case "int": - zeroValue = "Int(0)" + zeroValue = "Ptr(0)" case "int64": - zeroValue = "Int64(0)" + zeroValue = "Ptr(int64(0))" case "float64": - zeroValue = "Float64(0.0)" + zeroValue = "Ptr(0.0)" case "string": - zeroValue = `String("")` + zeroValue = `Ptr("")` case "bool": - zeroValue = "Bool(false)" + zeroValue = "Ptr(false)" case "Timestamp": zeroValue = "&Timestamp{}" default: @@ -400,7 +400,6 @@ import ( {{end -}} ) {{end}} -func Float64(v float64) *float64 { return &v } {{range $key, $value := .StructFields}} func Test{{ $key }}_String(t *testing.T) { t.Parallel() diff --git a/github/gists_comments_test.go b/github/gists_comments_test.go index a6a0a5cd1fc..94c07a8c5fe 100644 --- a/github/gists_comments_test.go +++ b/github/gists_comments_test.go @@ -23,25 +23,25 @@ func TestGistComments_Marshal(t *testing.T) { createdAt := time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC) u := &GistComment{ - ID: Int64(1), - URL: String("u"), - Body: String("test gist comment"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + Body: Ptr("test gist comment"), User: &User{ - Login: String("ll"), - ID: Int64(123), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("ll"), + ID: Ptr(int64(123)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, CreatedAt: &Timestamp{createdAt}, } @@ -89,7 +89,7 @@ func TestGistsService_ListComments(t *testing.T) { t.Errorf("Gists.Comments returned error: %v", err) } - want := []*GistComment{{ID: Int64(1)}} + want := []*GistComment{{ID: Ptr(int64(1))}} if !cmp.Equal(comments, want) { t.Errorf("Gists.ListComments returned %+v, want %+v", comments, want) } @@ -133,7 +133,7 @@ func TestGistsService_GetComment(t *testing.T) { t.Errorf("Gists.GetComment returned error: %v", err) } - want := &GistComment{ID: Int64(1)} + want := &GistComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Gists.GetComment returned %+v, want %+v", comment, want) } @@ -166,7 +166,7 @@ func TestGistsService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &GistComment{ID: Int64(1), Body: String("b")} + input := &GistComment{ID: Ptr(int64(1)), Body: Ptr("b")} mux.HandleFunc("/gists/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(GistComment) @@ -186,7 +186,7 @@ func TestGistsService_CreateComment(t *testing.T) { t.Errorf("Gists.CreateComment returned error: %v", err) } - want := &GistComment{ID: Int64(1)} + want := &GistComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Gists.CreateComment returned %+v, want %+v", comment, want) } @@ -219,7 +219,7 @@ func TestGistsService_EditComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &GistComment{ID: Int64(1), Body: String("b")} + input := &GistComment{ID: Ptr(int64(1)), Body: Ptr("b")} mux.HandleFunc("/gists/1/comments/2", func(w http.ResponseWriter, r *http.Request) { v := new(GistComment) @@ -239,7 +239,7 @@ func TestGistsService_EditComment(t *testing.T) { t.Errorf("Gists.EditComment returned error: %v", err) } - want := &GistComment{ID: Int64(1)} + want := &GistComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Gists.EditComment returned %+v, want %+v", comment, want) } diff --git a/github/gists_test.go b/github/gists_test.go index 26c0a2bd8d1..c6ee6d0f661 100644 --- a/github/gists_test.go +++ b/github/gists_test.go @@ -24,43 +24,43 @@ func TestGist_Marshal(t *testing.T) { updatedAt := time.Date(2010, time.February, 10, 10, 10, 0, 0, time.UTC) u := &Gist{ - ID: String("i"), - Description: String("description"), - Public: Bool(true), + ID: Ptr("i"), + Description: Ptr("description"), + Public: Ptr(true), Owner: &User{ - Login: String("ll"), - ID: Int64(123), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("ll"), + ID: Ptr(int64(123)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, Files: map[GistFilename]GistFile{ "gistfile.py": { - Size: Int(167), - Filename: String("gistfile.py"), - Language: String("Python"), - Type: String("application/x-python"), - RawURL: String("raw-url"), - Content: String("c"), + Size: Ptr(167), + Filename: Ptr("gistfile.py"), + Language: Ptr("Python"), + Type: Ptr("application/x-python"), + RawURL: Ptr("raw-url"), + Content: Ptr("c"), }, }, - Comments: Int(1), - HTMLURL: String("html-url"), - GitPullURL: String("gitpull-url"), - GitPushURL: String("gitpush-url"), + Comments: Ptr(1), + HTMLURL: Ptr("html-url"), + GitPullURL: Ptr("gitpull-url"), + GitPushURL: Ptr("gitpush-url"), CreatedAt: &Timestamp{createdAt}, UpdatedAt: &Timestamp{updatedAt}, - NodeID: String("node"), + NodeID: Ptr("node"), } want := `{ @@ -111,32 +111,32 @@ func TestGistCommit_Marshal(t *testing.T) { testJSONMarshal(t, &GistCommit{}, "{}") u := &GistCommit{ - URL: String("u"), - Version: String("v"), + URL: Ptr("u"), + Version: Ptr("v"), User: &User{ - Login: String("ll"), - ID: Int64(123), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("ll"), + ID: Ptr(int64(123)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, ChangeStatus: &CommitStats{ - Additions: Int(1), - Deletions: Int(1), - Total: Int(2), + Additions: Ptr(1), + Deletions: Ptr(1), + Total: Ptr(2), }, CommittedAt: &Timestamp{referenceTime}, - NodeID: String("node"), + NodeID: Ptr("node"), } want := `{ @@ -176,28 +176,28 @@ func TestGistFork_Marshal(t *testing.T) { testJSONMarshal(t, &GistFork{}, "{}") u := &GistFork{ - URL: String("u"), + URL: Ptr("u"), User: &User{ - Login: String("ll"), - ID: Int64(123), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("ll"), + ID: Ptr(int64(123)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, - ID: String("id"), + ID: Ptr("id"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - NodeID: String("node"), + NodeID: Ptr("node"), } want := `{ @@ -249,7 +249,7 @@ func TestGistsService_List_specifiedUser(t *testing.T) { t.Errorf("Gists.List returned error: %v", err) } - want := []*Gist{{ID: String("1")}} + want := []*Gist{{ID: Ptr("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.List returned %+v, want %+v", gists, want) } @@ -284,7 +284,7 @@ func TestGistsService_List_authenticatedUser(t *testing.T) { t.Errorf("Gists.List returned error: %v", err) } - want := []*Gist{{ID: String("1")}} + want := []*Gist{{ID: Ptr("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.List returned %+v, want %+v", gists, want) } @@ -334,7 +334,7 @@ func TestGistsService_ListAll(t *testing.T) { t.Errorf("Gists.ListAll returned error: %v", err) } - want := []*Gist{{ID: String("1")}} + want := []*Gist{{ID: Ptr("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.ListAll returned %+v, want %+v", gists, want) } @@ -370,7 +370,7 @@ func TestGistsService_ListStarred(t *testing.T) { t.Errorf("Gists.ListStarred returned error: %v", err) } - want := []*Gist{{ID: String("1")}} + want := []*Gist{{ID: Ptr("1")}} if !cmp.Equal(gists, want) { t.Errorf("Gists.ListStarred returned %+v, want %+v", gists, want) } @@ -400,7 +400,7 @@ func TestGistsService_Get(t *testing.T) { t.Errorf("Gists.Get returned error: %v", err) } - want := &Gist{ID: String("1")} + want := &Gist{ID: Ptr("1")} if !cmp.Equal(gist, want) { t.Errorf("Gists.Get returned %+v, want %+v", gist, want) } @@ -444,7 +444,7 @@ func TestGistsService_GetRevision(t *testing.T) { t.Errorf("Gists.Get returned error: %v", err) } - want := &Gist{ID: String("1")} + want := &Gist{ID: Ptr("1")} if !cmp.Equal(gist, want) { t.Errorf("Gists.Get returned %+v, want %+v", gist, want) } @@ -478,10 +478,10 @@ func TestGistsService_Create(t *testing.T) { client, mux, _ := setup(t) input := &Gist{ - Description: String("Gist description"), - Public: Bool(false), + Description: Ptr("Gist description"), + Public: Ptr(false), Files: map[GistFilename]GistFile{ - "test.txt": {Content: String("Gist file content")}, + "test.txt": {Content: Ptr("Gist file content")}, }, } @@ -515,11 +515,11 @@ func TestGistsService_Create(t *testing.T) { } want := &Gist{ - ID: String("1"), - Description: String("Gist description"), - Public: Bool(false), + ID: Ptr("1"), + Description: Ptr("Gist description"), + Public: Ptr(false), Files: map[GistFilename]GistFile{ - "test.txt": {Filename: String("test.txt")}, + "test.txt": {Filename: Ptr("test.txt")}, }, } if !cmp.Equal(gist, want) { @@ -541,9 +541,9 @@ func TestGistsService_Edit(t *testing.T) { client, mux, _ := setup(t) input := &Gist{ - Description: String("New description"), + Description: Ptr("New description"), Files: map[GistFilename]GistFile{ - "new.txt": {Content: String("new file content")}, + "new.txt": {Content: Ptr("new file content")}, }, } @@ -580,12 +580,12 @@ func TestGistsService_Edit(t *testing.T) { } want := &Gist{ - ID: String("1"), - Description: String("new description"), - Public: Bool(false), + ID: Ptr("1"), + Description: Ptr("new description"), + Public: Ptr(false), Files: map[GistFilename]GistFile{ - "test.txt": {Filename: String("test.txt")}, - "new.txt": {Filename: String("new.txt")}, + "test.txt": {Filename: Ptr("test.txt")}, + "new.txt": {Filename: Ptr("new.txt")}, }, } if !cmp.Equal(gist, want) { @@ -649,14 +649,14 @@ func TestGistsService_ListCommits(t *testing.T) { } want := []*GistCommit{{ - URL: String("https://api.github.com/gists/1/1"), - Version: String("1"), - User: &User{ID: Int64(1)}, + URL: Ptr("https://api.github.com/gists/1/1"), + Version: Ptr("1"), + User: &User{ID: Ptr(int64(1))}, CommittedAt: &Timestamp{time.Date(2010, time.January, 1, 00, 00, 00, 0, time.UTC)}, ChangeStatus: &CommitStats{ - Additions: Int(180), - Deletions: Int(0), - Total: Int(180), + Additions: Ptr(180), + Deletions: Ptr(0), + Total: Ptr(180), }}} if !cmp.Equal(gistCommits, want) { @@ -912,7 +912,7 @@ func TestGistsService_Fork(t *testing.T) { t.Errorf("Gists.Fork returned error: %v", err) } - want := &Gist{ID: String("2")} + want := &Gist{ID: Ptr("2")} if !cmp.Equal(gist, want) { t.Errorf("Gists.Fork returned %+v, want %+v", gist, want) } @@ -958,9 +958,9 @@ func TestGistsService_ListForks(t *testing.T) { } want := []*GistFork{{ - URL: String("https://api.github.com/gists/1"), - ID: String("1"), - User: &User{ID: Int64(1)}, + URL: Ptr("https://api.github.com/gists/1"), + ID: Ptr("1"), + User: &User{ID: Ptr(int64(1))}, CreatedAt: &Timestamp{time.Date(2010, time.January, 1, 00, 00, 00, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2013, time.January, 1, 00, 00, 00, 0, time.UTC)}}} @@ -1026,12 +1026,12 @@ func TestGistFile_Marshal(t *testing.T) { testJSONMarshal(t, &GistFile{}, "{}") u := &GistFile{ - Size: Int(1), - Filename: String("fn"), - Language: String("lan"), - Type: String("type"), - RawURL: String("rurl"), - Content: String("con"), + Size: Ptr(1), + Filename: Ptr("fn"), + Language: Ptr("lan"), + Type: Ptr("type"), + RawURL: Ptr("rurl"), + Content: Ptr("con"), } want := `{ diff --git a/github/git_blobs_test.go b/github/git_blobs_test.go index 710171bc2ce..f8f35b2ceba 100644 --- a/github/git_blobs_test.go +++ b/github/git_blobs_test.go @@ -36,8 +36,8 @@ func TestGitService_GetBlob(t *testing.T) { } want := Blob{ - SHA: String("s"), - Content: String("blob content"), + SHA: Ptr("s"), + Content: Ptr("blob content"), } if !cmp.Equal(*blob, want) { @@ -110,10 +110,10 @@ func TestGitService_CreateBlob(t *testing.T) { client, mux, _ := setup(t) input := &Blob{ - SHA: String("s"), - Content: String("blob content"), - Encoding: String("utf-8"), - Size: Int(12), + SHA: Ptr("s"), + Content: Ptr("blob content"), + Encoding: Ptr("utf-8"), + Size: Ptr(12), } mux.HandleFunc("/repos/o/r/git/blobs", func(w http.ResponseWriter, r *http.Request) { @@ -176,12 +176,12 @@ func TestBlob_Marshal(t *testing.T) { testJSONMarshal(t, &Blob{}, "{}") u := &Blob{ - Content: String("content"), - Encoding: String("encoding"), - SHA: String("sha"), - Size: Int(1), - URL: String("url"), - NodeID: String("nid"), + Content: Ptr("content"), + Encoding: Ptr("encoding"), + SHA: Ptr("sha"), + Size: Ptr(1), + URL: Ptr("url"), + NodeID: Ptr("nid"), } want := `{ diff --git a/github/git_commits_test.go b/github/git_commits_test.go index 9ea876050e6..a58a4d98a1f 100644 --- a/github/git_commits_test.go +++ b/github/git_commits_test.go @@ -43,49 +43,49 @@ func TestCommit_Marshal(t *testing.T) { testJSONMarshal(t, &Commit{}, "{}") u := &Commit{ - SHA: String("s"), + SHA: Ptr("s"), Author: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), }, Committer: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), }, - Message: String("m"), + Message: Ptr("m"), Tree: &Tree{ - SHA: String("s"), + SHA: Ptr("s"), Entries: []*TreeEntry{{ - SHA: String("s"), - Path: String("p"), - Mode: String("m"), - Type: String("t"), - Size: Int(1), - Content: String("c"), - URL: String("u"), + SHA: Ptr("s"), + Path: Ptr("p"), + Mode: Ptr("m"), + Type: Ptr("t"), + Size: Ptr(1), + Content: Ptr("c"), + URL: Ptr("u"), }}, - Truncated: Bool(false), + Truncated: Ptr(false), }, Parents: nil, Stats: &CommitStats{ - Additions: Int(1), - Deletions: Int(1), - Total: Int(1), + Additions: Ptr(1), + Deletions: Ptr(1), + Total: Ptr(1), }, - HTMLURL: String("h"), - URL: String("u"), + HTMLURL: Ptr("h"), + URL: Ptr("u"), Verification: &SignatureVerification{ - Verified: Bool(false), - Reason: String("r"), - Signature: String("s"), - Payload: String("p"), + Verified: Ptr(false), + Reason: Ptr("r"), + Signature: Ptr("s"), + Payload: Ptr("p"), }, - NodeID: String("n"), - CommentCount: Int(1), + NodeID: Ptr("n"), + CommentCount: Ptr(1), } want := `{ @@ -153,7 +153,7 @@ func TestGitService_GetCommit(t *testing.T) { t.Errorf("Git.GetCommit returned error: %v", err) } - want := &Commit{SHA: String("s"), Message: String("Commit Message."), Author: &CommitAuthor{Name: String("n")}} + want := &Commit{SHA: Ptr("s"), Message: Ptr("Commit Message."), Author: &CommitAuthor{Name: Ptr("n")}} if !cmp.Equal(commit, want) { t.Errorf("Git.GetCommit returned %+v, want %+v", commit, want) } @@ -187,9 +187,9 @@ func TestGitService_CreateCommit(t *testing.T) { client, mux, _ := setup(t) input := &Commit{ - Message: String("Commit Message."), - Tree: &Tree{SHA: String("t")}, - Parents: []*Commit{{SHA: String("p")}}, + Message: Ptr("Commit Message."), + Tree: &Tree{SHA: Ptr("t")}, + Parents: []*Commit{{SHA: Ptr("p")}}, } mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) { @@ -200,7 +200,7 @@ func TestGitService_CreateCommit(t *testing.T) { want := &createCommit{ Message: input.Message, - Tree: String("t"), + Tree: Ptr("t"), Parents: []string{"p"}, } if !cmp.Equal(v, want) { @@ -215,7 +215,7 @@ func TestGitService_CreateCommit(t *testing.T) { t.Errorf("Git.CreateCommit returned error: %v", err) } - want := &Commit{SHA: String("s")} + want := &Commit{SHA: Ptr("s")} if !cmp.Equal(commit, want) { t.Errorf("Git.CreateCommit returned %+v, want %+v", commit, want) } @@ -242,11 +242,11 @@ func TestGitService_CreateSignedCommit(t *testing.T) { signature := "----- BEGIN PGP SIGNATURE -----\n\naaaa\naaaa\n----- END PGP SIGNATURE -----" input := &Commit{ - Message: String("Commit Message."), - Tree: &Tree{SHA: String("t")}, - Parents: []*Commit{{SHA: String("p")}}, + Message: Ptr("Commit Message."), + Tree: &Tree{SHA: Ptr("t")}, + Parents: []*Commit{{SHA: Ptr("p")}}, Verification: &SignatureVerification{ - Signature: String(signature), + Signature: Ptr(signature), }, } @@ -258,9 +258,9 @@ func TestGitService_CreateSignedCommit(t *testing.T) { want := &createCommit{ Message: input.Message, - Tree: String("t"), + Tree: Ptr("t"), Parents: []string{"p"}, - Signature: String(signature), + Signature: Ptr(signature), } if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -274,7 +274,7 @@ func TestGitService_CreateSignedCommit(t *testing.T) { t.Errorf("Git.CreateCommit returned error: %v", err) } - want := &Commit{SHA: String("commitSha")} + want := &Commit{SHA: Ptr("commitSha")} if !cmp.Equal(commit, want) { t.Errorf("Git.CreateCommit returned %+v, want %+v", commit, want) } @@ -326,8 +326,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: String("go-github"), - Email: String("go-github@github.com"), + Name: Ptr("go-github"), + Email: Ptr("go-github@github.com"), Date: &Timestamp{date}, } wantMessage := `tree t @@ -339,14 +339,14 @@ Commit Message.` sha := "commitSha" input := &Commit{ SHA: &sha, - Message: String("Commit Message."), - Tree: &Tree{SHA: String("t")}, - Parents: []*Commit{{SHA: String("p")}}, + Message: Ptr("Commit Message."), + Tree: &Tree{SHA: Ptr("t")}, + Parents: []*Commit{{SHA: Ptr("p")}}, Author: &author, } wantBody := createCommit{ Message: input.Message, - Tree: String("t"), + Tree: Ptr("t"), Parents: []string{"p"}, Author: &author, Signature: &signature, @@ -358,7 +358,7 @@ Commit Message.` fmt.Fprintf(w, `{"sha":"%s"}`, sha) }) ctx := context.Background() - wantCommit := &Commit{SHA: String(sha)} + wantCommit := &Commit{SHA: Ptr(sha)} opts := CreateCommitOptions{Signer: mockSigner(t, signature, nil, wantMessage)} commit, _, err := client.Git.CreateCommit(ctx, "o", "r", input, &opts) assertNilError(t, err) @@ -373,8 +373,8 @@ Commit Message.` func TestGitService_createSignature_nilSigner(t *testing.T) { t.Parallel() a := &createCommit{ - Message: String("Commit Message."), - Tree: String("t"), + Message: Ptr("Commit Message."), + Tree: Ptr("t"), Parents: []string{"p"}, } @@ -397,10 +397,10 @@ func TestGitService_createSignature_nilCommit(t *testing.T) { func TestGitService_createSignature_signerError(t *testing.T) { t.Parallel() a := &createCommit{ - Message: String("Commit Message."), - Tree: String("t"), + Message: Ptr("Commit Message."), + Tree: Ptr("t"), Parents: []string{"p"}, - Author: &CommitAuthor{Name: String("go-github")}, + Author: &CommitAuthor{Name: Ptr("go-github")}, } signer := mockSigner(t, "", errors.New("signer error"), "") @@ -427,8 +427,8 @@ func TestGitService_createSignatureMessage_nilMessage(t *testing.T) { Message: nil, Parents: []string{"p"}, Author: &CommitAuthor{ - Name: String("go-github"), - Email: String("go-github@github.com"), + Name: Ptr("go-github"), + Email: Ptr("go-github@github.com"), Date: &Timestamp{date}, }, }) @@ -445,8 +445,8 @@ func TestGitService_createSignatureMessage_emptyMessage(t *testing.T) { Message: &emptyString, Parents: []string{"p"}, Author: &CommitAuthor{ - Name: String("go-github"), - Email: String("go-github@github.com"), + Name: Ptr("go-github"), + Email: Ptr("go-github@github.com"), Date: &Timestamp{date}, }, }) @@ -458,7 +458,7 @@ func TestGitService_createSignatureMessage_emptyMessage(t *testing.T) { func TestGitService_createSignatureMessage_nilAuthor(t *testing.T) { t.Parallel() _, err := createSignatureMessage(&createCommit{ - Message: String("Commit Message."), + Message: Ptr("Commit Message."), Parents: []string{"p"}, Author: nil, }) @@ -472,11 +472,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: String("Commit Message."), + Message: Ptr("Commit Message."), Parents: []string{"p"}, Author: &CommitAuthor{ - Name: String("go-github"), - Email: String("go-github@github.com"), + Name: Ptr("go-github"), + Email: Ptr("go-github@github.com"), Date: &Timestamp{date}, }, }) @@ -495,16 +495,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: String("Commit Message."), + Message: Ptr("Commit Message."), Parents: []string{"p"}, Author: &CommitAuthor{ - Name: String("go-github"), - Email: String("go-github@github.com"), + Name: Ptr("go-github"), + Email: Ptr("go-github@github.com"), Date: &Timestamp{date}, }, Committer: &CommitAuthor{ - Name: String("foo"), - Email: String("foo@bar.com"), + Name: Ptr("foo"), + Email: Ptr("foo@bar.com"), Date: &Timestamp{date}, }, }) @@ -532,10 +532,10 @@ func TestSignatureVerification_Marshal(t *testing.T) { testJSONMarshal(t, &SignatureVerification{}, "{}") u := &SignatureVerification{ - Verified: Bool(true), - Reason: String("reason"), - Signature: String("sign"), - Payload: String("payload"), + Verified: Ptr(true), + Reason: Ptr("reason"), + Signature: Ptr("sign"), + Payload: Ptr("payload"), } want := `{ @@ -554,9 +554,9 @@ func TestCommitAuthor_Marshal(t *testing.T) { u := &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("name"), - Email: String("email"), - Login: String("login"), + Name: Ptr("name"), + Email: Ptr("email"), + Login: Ptr("login"), } want := `{ @@ -576,20 +576,20 @@ func TestCreateCommit_Marshal(t *testing.T) { u := &createCommit{ Author: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("name"), - Email: String("email"), - Login: String("login"), + Name: Ptr("name"), + Email: Ptr("email"), + Login: Ptr("login"), }, Committer: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("name"), - Email: String("email"), - Login: String("login"), + Name: Ptr("name"), + Email: Ptr("email"), + Login: Ptr("login"), }, - Message: String("message"), - Tree: String("tree"), + Message: Ptr("message"), + Tree: Ptr("tree"), Parents: []string{"p"}, - Signature: String("sign"), + Signature: Ptr("sign"), } want := `{ diff --git a/github/git_refs.go b/github/git_refs.go index ad7b10d7d3f..91eb6dd43fa 100644 --- a/github/git_refs.go +++ b/github/git_refs.go @@ -127,7 +127,7 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) req, err := s.client.NewRequest("POST", u, &createRefRequest{ // back-compat with previous behavior that didn't require 'refs/' prefix - Ref: String("refs/" + strings.TrimPrefix(*ref.Ref, "refs/")), + Ref: Ptr("refs/" + strings.TrimPrefix(*ref.Ref, "refs/")), SHA: ref.Object.SHA, }) if err != nil { diff --git a/github/git_refs_test.go b/github/git_refs_test.go index 0c552f434f3..389b23c0c29 100644 --- a/github/git_refs_test.go +++ b/github/git_refs_test.go @@ -41,12 +41,12 @@ func TestGitService_GetRef_singleRef(t *testing.T) { } want := &Reference{ - Ref: String("refs/heads/b"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: Ptr("refs/heads/b"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -138,12 +138,12 @@ func TestGitService_ListMatchingRefs_singleRef(t *testing.T) { ref := refs[0] want := &Reference{ - Ref: String("refs/heads/b"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: Ptr("refs/heads/b"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -209,12 +209,12 @@ func TestGitService_ListMatchingRefs_multipleRefs(t *testing.T) { } want := &Reference{ - Ref: String("refs/heads/booger"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/booger"), + Ref: Ptr("refs/heads/booger"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/booger"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(refs[0], want) { @@ -308,21 +308,21 @@ func TestGitService_ListMatchingRefs_allRefs(t *testing.T) { want := []*Reference{ { - Ref: String("refs/heads/branchA"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/branchA"), + Ref: Ptr("refs/heads/branchA"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/branchA"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }, { - Ref: String("refs/heads/branchB"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/branchB"), + Ref: Ptr("refs/heads/branchB"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/branchB"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }, } @@ -362,7 +362,7 @@ func TestGitService_ListMatchingRefs_options(t *testing.T) { t.Errorf("Git.ListMatchingRefs returned error: %v", err) } - want := []*Reference{{Ref: String("r")}} + want := []*Reference{{Ref: Ptr("r")}} if !cmp.Equal(refs, want) { t.Errorf("Git.ListMatchingRefs returned %+v, want %+v", refs, want) } @@ -387,8 +387,8 @@ func TestGitService_CreateRef(t *testing.T) { client, mux, _ := setup(t) args := &createRefRequest{ - Ref: String("refs/heads/b"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), + Ref: Ptr("refs/heads/b"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), } mux.HandleFunc("/repos/o/r/git/refs", func(w http.ResponseWriter, r *http.Request) { @@ -413,9 +413,9 @@ func TestGitService_CreateRef(t *testing.T) { ctx := context.Background() ref, _, err := client.Git.CreateRef(ctx, "o", "r", &Reference{ - Ref: String("refs/heads/b"), + Ref: Ptr("refs/heads/b"), Object: &GitObject{ - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }) if err != nil { @@ -423,12 +423,12 @@ func TestGitService_CreateRef(t *testing.T) { } want := &Reference{ - Ref: String("refs/heads/b"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: Ptr("refs/heads/b"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -437,9 +437,9 @@ func TestGitService_CreateRef(t *testing.T) { // without 'refs/' prefix _, _, err = client.Git.CreateRef(ctx, "o", "r", &Reference{ - Ref: String("heads/b"), + Ref: Ptr("heads/b"), Object: &GitObject{ - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }) if err != nil { @@ -449,9 +449,9 @@ func TestGitService_CreateRef(t *testing.T) { const methodName = "CreateRef" testBadOptions(t, methodName, func() (err error) { _, _, err = client.Git.CreateRef(ctx, "\n", "\n", &Reference{ - Ref: String("refs/heads/b"), + Ref: Ptr("refs/heads/b"), Object: &GitObject{ - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }) return err @@ -459,9 +459,9 @@ func TestGitService_CreateRef(t *testing.T) { testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { got, resp, err := client.Git.CreateRef(ctx, "o", "r", &Reference{ - Ref: String("refs/heads/b"), + Ref: Ptr("refs/heads/b"), Object: &GitObject{ - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), }, }) if got != nil { @@ -476,8 +476,8 @@ func TestGitService_UpdateRef(t *testing.T) { client, mux, _ := setup(t) args := &updateRefRequest{ - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - Force: Bool(true), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + Force: Ptr(true), } mux.HandleFunc("/repos/o/r/git/refs/heads/b", func(w http.ResponseWriter, r *http.Request) { @@ -502,20 +502,20 @@ func TestGitService_UpdateRef(t *testing.T) { ctx := context.Background() ref, _, err := client.Git.UpdateRef(ctx, "o", "r", &Reference{ - Ref: String("refs/heads/b"), - Object: &GitObject{SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd")}, + Ref: Ptr("refs/heads/b"), + Object: &GitObject{SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd")}, }, true) if err != nil { t.Errorf("Git.UpdateRef returned error: %v", err) } want := &Reference{ - Ref: String("refs/heads/b"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/b"), + Ref: Ptr("refs/heads/b"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -524,8 +524,8 @@ func TestGitService_UpdateRef(t *testing.T) { // without 'refs/' prefix _, _, err = client.Git.UpdateRef(ctx, "o", "r", &Reference{ - Ref: String("heads/b"), - Object: &GitObject{SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd")}, + Ref: Ptr("heads/b"), + Object: &GitObject{SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd")}, }, true) if err != nil { t.Errorf("Git.UpdateRef returned error: %v", err) @@ -534,16 +534,16 @@ func TestGitService_UpdateRef(t *testing.T) { const methodName = "UpdateRef" testBadOptions(t, methodName, func() (err error) { _, _, err = client.Git.UpdateRef(ctx, "\n", "\n", &Reference{ - Ref: String("refs/heads/b"), - Object: &GitObject{SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd")}, + Ref: Ptr("refs/heads/b"), + Object: &GitObject{SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd")}, }, true) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { got, resp, err := client.Git.UpdateRef(ctx, "o", "r", &Reference{ - Ref: String("refs/heads/b"), - Object: &GitObject{SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd")}, + Ref: Ptr("refs/heads/b"), + Object: &GitObject{SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd")}, }, true) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) @@ -629,8 +629,8 @@ func TestGitService_UpdateRef_pathEscape(t *testing.T) { client, mux, _ := setup(t) args := &updateRefRequest{ - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - Force: Bool(true), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + Force: Ptr(true), } mux.HandleFunc("/repos/o/r/git/refs/heads/b#1", func(w http.ResponseWriter, r *http.Request) { @@ -655,20 +655,20 @@ func TestGitService_UpdateRef_pathEscape(t *testing.T) { ctx := context.Background() ref, _, err := client.Git.UpdateRef(ctx, "o", "r", &Reference{ - Ref: String("refs/heads/b#1"), - Object: &GitObject{SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd")}, + Ref: Ptr("refs/heads/b#1"), + Object: &GitObject{SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd")}, }, true) if err != nil { t.Errorf("Git.UpdateRef returned error: %v", err) } want := &Reference{ - Ref: String("refs/heads/b#1"), - URL: String("https://api.github.com/repos/o/r/git/refs/heads/b%231"), + Ref: Ptr("refs/heads/b#1"), + URL: Ptr("https://api.github.com/repos/o/r/git/refs/heads/b%231"), Object: &GitObject{ - Type: String("commit"), - SHA: String("aa218f56b14c9653891f9e74264a383fa43fefbd"), - URL: String("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), + Type: Ptr("commit"), + SHA: Ptr("aa218f56b14c9653891f9e74264a383fa43fefbd"), + URL: Ptr("https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"), }, } if !cmp.Equal(ref, want) { @@ -681,14 +681,14 @@ func TestReference_Marshal(t *testing.T) { testJSONMarshal(t, &Reference{}, "{}") u := &Reference{ - Ref: String("ref"), - URL: String("url"), + Ref: Ptr("ref"), + URL: Ptr("url"), Object: &GitObject{ - Type: String("type"), - SHA: String("sha"), - URL: String("url"), + Type: Ptr("type"), + SHA: Ptr("sha"), + URL: Ptr("url"), }, - NodeID: String("nid"), + NodeID: Ptr("nid"), } want := `{ @@ -710,9 +710,9 @@ func TestGitObject_Marshal(t *testing.T) { testJSONMarshal(t, &GitObject{}, "{}") u := &GitObject{ - Type: String("type"), - SHA: String("sha"), - URL: String("url"), + Type: Ptr("type"), + SHA: Ptr("sha"), + URL: Ptr("url"), } want := `{ @@ -729,8 +729,8 @@ func TestCreateRefRequest_Marshal(t *testing.T) { testJSONMarshal(t, &createRefRequest{}, "{}") u := &createRefRequest{ - Ref: String("ref"), - SHA: String("sha"), + Ref: Ptr("ref"), + SHA: Ptr("sha"), } want := `{ @@ -746,8 +746,8 @@ func TestUpdateRefRequest_Marshal(t *testing.T) { testJSONMarshal(t, &updateRefRequest{}, "{}") u := &updateRefRequest{ - SHA: String("sha"), - Force: Bool(true), + SHA: Ptr("sha"), + Force: Ptr(true), } want := `{ diff --git a/github/git_tags_test.go b/github/git_tags_test.go index d1495c8b549..0d878dc3ee5 100644 --- a/github/git_tags_test.go +++ b/github/git_tags_test.go @@ -30,7 +30,7 @@ func TestGitService_GetTag(t *testing.T) { t.Errorf("Git.GetTag returned error: %v", err) } - want := &Tag{Tag: String("t")} + want := &Tag{Tag: Ptr("t")} if !cmp.Equal(tag, want) { t.Errorf("Git.GetTag returned %+v, want %+v", tag, want) } @@ -54,7 +54,7 @@ func TestGitService_CreateTag(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &createTagRequest{Tag: String("t"), Object: String("s")} + input := &createTagRequest{Tag: Ptr("t"), Object: Ptr("s")} mux.HandleFunc("/repos/o/r/git/tags", func(w http.ResponseWriter, r *http.Request) { v := new(createTagRequest) @@ -78,7 +78,7 @@ func TestGitService_CreateTag(t *testing.T) { t.Errorf("Git.CreateTag returned error: %v", err) } - want := &Tag{Tag: String("t")} + want := &Tag{Tag: Ptr("t")} if !cmp.Equal(tag, want) { t.Errorf("Git.GetTag returned %+v, want %+v", tag, want) } @@ -103,28 +103,28 @@ func TestTag_Marshal(t *testing.T) { testJSONMarshal(t, &Tag{}, "{}") u := &Tag{ - Tag: String("tag"), - SHA: String("sha"), - URL: String("url"), - Message: String("msg"), + Tag: Ptr("tag"), + SHA: Ptr("sha"), + URL: Ptr("url"), + Message: Ptr("msg"), Tagger: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("name"), - Email: String("email"), - Login: String("login"), + Name: Ptr("name"), + Email: Ptr("email"), + Login: Ptr("login"), }, Object: &GitObject{ - Type: String("type"), - SHA: String("sha"), - URL: String("url"), + Type: Ptr("type"), + SHA: Ptr("sha"), + URL: Ptr("url"), }, Verification: &SignatureVerification{ - Verified: Bool(true), - Reason: String("reason"), - Signature: String("sign"), - Payload: String("payload"), + Verified: Ptr(true), + Reason: Ptr("reason"), + Signature: Ptr("sign"), + Payload: Ptr("payload"), }, - NodeID: String("nid"), + NodeID: Ptr("nid"), } want := `{ @@ -160,15 +160,15 @@ func TestCreateTagRequest_Marshal(t *testing.T) { testJSONMarshal(t, &createTagRequest{}, "{}") u := &createTagRequest{ - Tag: String("tag"), - Message: String("msg"), - Object: String("obj"), - Type: String("type"), + Tag: Ptr("tag"), + Message: Ptr("msg"), + Object: Ptr("obj"), + Type: Ptr("type"), Tagger: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("name"), - Email: String("email"), - Login: String("login"), + Name: Ptr("name"), + Email: Ptr("email"), + Login: Ptr("login"), }, } diff --git a/github/git_trees_test.go b/github/git_trees_test.go index 591ff0c1c0f..0c264470ce2 100644 --- a/github/git_trees_test.go +++ b/github/git_trees_test.go @@ -19,11 +19,11 @@ import ( func TestMarshalJSON_withNilContentAndSHA(t *testing.T) { t.Parallel() te := &TreeEntry{ - Path: String("path"), - Mode: String("mode"), - Type: String("type"), - Size: Int(1), - URL: String("url"), + Path: Ptr("path"), + Mode: Ptr("mode"), + Type: Ptr("type"), + Size: Ptr(1), + URL: Ptr("url"), } got, err := te.MarshalJSON() @@ -57,13 +57,13 @@ func TestGitService_GetTree(t *testing.T) { } want := Tree{ - SHA: String("s"), + SHA: Ptr("s"), Entries: []*TreeEntry{ { - Type: String("blob"), + Type: Ptr("blob"), }, }, - Truncated: Bool(true), + Truncated: Ptr(true), } if !cmp.Equal(*tree, want) { t.Errorf("Tree.Get returned %+v, want %+v", *tree, want) @@ -99,10 +99,10 @@ func TestGitService_CreateTree(t *testing.T) { input := []*TreeEntry{ { - Path: String("file.rb"), - Mode: String("100644"), - Type: String("blob"), - SHA: String("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), + Path: Ptr("file.rb"), + Mode: Ptr("100644"), + Type: Ptr("blob"), + SHA: Ptr("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), }, } @@ -140,14 +140,14 @@ func TestGitService_CreateTree(t *testing.T) { } want := Tree{ - String("cd8274d15fa3ae2ab983129fb037999f264ba9a7"), + Ptr("cd8274d15fa3ae2ab983129fb037999f264ba9a7"), []*TreeEntry{ { - Path: String("file.rb"), - Mode: String("100644"), - Type: String("blob"), - Size: Int(132), - SHA: String("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), + Path: Ptr("file.rb"), + Mode: Ptr("100644"), + Type: Ptr("blob"), + Size: Ptr(132), + SHA: Ptr("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"), }, }, nil, @@ -178,9 +178,9 @@ func TestGitService_CreateTree_Content(t *testing.T) { input := []*TreeEntry{ { - Path: String("content.md"), - Mode: String("100644"), - Content: String("file content"), + Path: Ptr("content.md"), + Mode: Ptr("100644"), + Content: Ptr("file content"), }, } @@ -220,15 +220,15 @@ func TestGitService_CreateTree_Content(t *testing.T) { } want := Tree{ - String("5c6780ad2c68743383b740fd1dab6f6a33202b11"), + Ptr("5c6780ad2c68743383b740fd1dab6f6a33202b11"), []*TreeEntry{ { - Path: String("content.md"), - Mode: String("100644"), - Type: String("blob"), - Size: Int(12), - SHA: String("aad8feacf6f8063150476a7b2bd9770f2794c08b"), - URL: String("https://api.github.com/repos/o/r/git/blobs/aad8feacf6f8063150476a7b2bd9770f2794c08b"), + 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"), }, }, nil, @@ -259,8 +259,8 @@ func TestGitService_CreateTree_Delete(t *testing.T) { input := []*TreeEntry{ { - Path: String("content.md"), - Mode: String("100644"), + Path: Ptr("content.md"), + Mode: Ptr("100644"), }, } @@ -300,15 +300,15 @@ func TestGitService_CreateTree_Delete(t *testing.T) { } want := Tree{ - String("5c6780ad2c68743383b740fd1dab6f6a33202b11"), + Ptr("5c6780ad2c68743383b740fd1dab6f6a33202b11"), []*TreeEntry{ { - Path: String("content.md"), - Mode: String("100644"), - Type: String("blob"), - Size: Int(12), + Path: Ptr("content.md"), + Mode: Ptr("100644"), + Type: Ptr("blob"), + Size: Ptr(12), SHA: nil, - URL: String("https://api.github.com/repos/o/r/git/blobs/aad8feacf6f8063150476a7b2bd9770f2794c08b"), + URL: Ptr("https://api.github.com/repos/o/r/git/blobs/aad8feacf6f8063150476a7b2bd9770f2794c08b"), }, }, nil, @@ -347,19 +347,19 @@ func TestTree_Marshal(t *testing.T) { testJSONMarshal(t, &Tree{}, "{}") u := &Tree{ - SHA: String("sha"), + SHA: Ptr("sha"), Entries: []*TreeEntry{ { - SHA: String("sha"), - Path: String("path"), - Mode: String("mode"), - Type: String("type"), - Size: Int(1), - Content: String("content"), - URL: String("url"), + SHA: Ptr("sha"), + Path: Ptr("path"), + Mode: Ptr("mode"), + Type: Ptr("type"), + Size: Ptr(1), + Content: Ptr("content"), + URL: Ptr("url"), }, }, - Truncated: Bool(false), + Truncated: Ptr(false), } want := `{ @@ -386,13 +386,13 @@ func TestTreeEntry_Marshal(t *testing.T) { testJSONMarshal(t, &TreeEntry{}, "{}") u := &TreeEntry{ - SHA: String("sha"), - Path: String("path"), - Mode: String("mode"), - Type: String("type"), - Size: Int(1), - Content: String("content"), - URL: String("url"), + SHA: Ptr("sha"), + Path: Ptr("path"), + Mode: Ptr("mode"), + Type: Ptr("type"), + Size: Ptr(1), + Content: Ptr("content"), + URL: Ptr("url"), } want := `{ @@ -413,13 +413,13 @@ func TestTreeEntryWithFileDelete_Marshal(t *testing.T) { testJSONMarshal(t, &treeEntryWithFileDelete{}, "{}") u := &treeEntryWithFileDelete{ - SHA: String("sha"), - Path: String("path"), - Mode: String("mode"), - Type: String("type"), - Size: Int(1), - Content: String("content"), - URL: String("url"), + SHA: Ptr("sha"), + Path: Ptr("path"), + Mode: Ptr("mode"), + Type: Ptr("type"), + Size: Ptr(1), + Content: Ptr("content"), + URL: Ptr("url"), } want := `{ diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index d311b87f337..463f9df7509 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -13,13 +13,11 @@ import ( "testing" ) -func Float64(v float64) *float64 { return &v } - func TestActionsAllowed_String(t *testing.T) { t.Parallel() v := ActionsAllowed{ - GithubOwnedAllowed: Bool(false), - VerifiedAllowed: Bool(false), + GithubOwnedAllowed: Ptr(false), + VerifiedAllowed: Ptr(false), PatternsAllowed: []string{""}, } want := `github.ActionsAllowed{GithubOwnedAllowed:false, VerifiedAllowed:false, PatternsAllowed:[""]}` @@ -31,9 +29,9 @@ func TestActionsAllowed_String(t *testing.T) { func TestActionsPermissions_String(t *testing.T) { t.Parallel() v := ActionsPermissions{ - EnabledRepositories: String(""), - AllowedActions: String(""), - SelectedActionsURL: String(""), + EnabledRepositories: Ptr(""), + AllowedActions: Ptr(""), + SelectedActionsURL: Ptr(""), } want := `github.ActionsPermissions{EnabledRepositories:"", AllowedActions:"", SelectedActionsURL:""}` if got := v.String(); got != want { @@ -44,9 +42,9 @@ func TestActionsPermissions_String(t *testing.T) { func TestActionsPermissionsEnterprise_String(t *testing.T) { t.Parallel() v := ActionsPermissionsEnterprise{ - EnabledOrganizations: String(""), - AllowedActions: String(""), - SelectedActionsURL: String(""), + EnabledOrganizations: Ptr(""), + AllowedActions: Ptr(""), + SelectedActionsURL: Ptr(""), } want := `github.ActionsPermissionsEnterprise{EnabledOrganizations:"", AllowedActions:"", SelectedActionsURL:""}` if got := v.String(); got != want { @@ -57,9 +55,9 @@ func TestActionsPermissionsEnterprise_String(t *testing.T) { func TestActionsPermissionsRepository_String(t *testing.T) { t.Parallel() v := ActionsPermissionsRepository{ - Enabled: Bool(false), - AllowedActions: String(""), - SelectedActionsURL: String(""), + Enabled: Ptr(false), + AllowedActions: Ptr(""), + SelectedActionsURL: Ptr(""), } want := `github.ActionsPermissionsRepository{Enabled:false, AllowedActions:"", SelectedActionsURL:""}` if got := v.String(); got != want { @@ -90,7 +88,7 @@ func TestAdminStats_String(t *testing.T) { func TestAdvancedSecurity_String(t *testing.T) { t.Parallel() v := AdvancedSecurity{ - Status: String(""), + Status: Ptr(""), } want := `github.AdvancedSecurity{Status:""}` if got := v.String(); got != want { @@ -101,18 +99,18 @@ func TestAdvancedSecurity_String(t *testing.T) { func TestAuthorization_String(t *testing.T) { t.Parallel() v := Authorization{ - ID: Int64(0), - URL: String(""), + ID: Ptr(int64(0)), + URL: Ptr(""), Scopes: []Scope{ScopeNone}, - Token: String(""), - TokenLastEight: String(""), - HashedToken: String(""), + Token: Ptr(""), + TokenLastEight: Ptr(""), + HashedToken: Ptr(""), App: &AuthorizationApp{}, - Note: String(""), - NoteURL: String(""), + Note: Ptr(""), + NoteURL: Ptr(""), UpdatedAt: &Timestamp{}, CreatedAt: &Timestamp{}, - Fingerprint: String(""), + Fingerprint: Ptr(""), 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{}}` @@ -124,9 +122,9 @@ func TestAuthorization_String(t *testing.T) { func TestAuthorizationApp_String(t *testing.T) { t.Parallel() v := AuthorizationApp{ - URL: String(""), - Name: String(""), - ClientID: String(""), + URL: Ptr(""), + Name: Ptr(""), + ClientID: Ptr(""), } want := `github.AuthorizationApp{URL:"", Name:"", ClientID:""}` if got := v.String(); got != want { @@ -138,11 +136,11 @@ func TestAuthorizationRequest_String(t *testing.T) { t.Parallel() v := AuthorizationRequest{ Scopes: []Scope{ScopeNone}, - Note: String(""), - NoteURL: String(""), - ClientID: String(""), - ClientSecret: String(""), - Fingerprint: String(""), + Note: Ptr(""), + NoteURL: Ptr(""), + ClientID: Ptr(""), + ClientSecret: Ptr(""), + Fingerprint: Ptr(""), } want := `github.AuthorizationRequest{Scopes:["(no scope)"], Note:"", NoteURL:"", ClientID:"", ClientSecret:"", Fingerprint:""}` if got := v.String(); got != want { @@ -156,9 +154,9 @@ func TestAuthorizationUpdateRequest_String(t *testing.T) { Scopes: []string{""}, AddScopes: []string{""}, RemoveScopes: []string{""}, - Note: String(""), - NoteURL: String(""), - Fingerprint: String(""), + Note: Ptr(""), + NoteURL: Ptr(""), + Fingerprint: Ptr(""), } want := `github.AuthorizationUpdateRequest{Scopes:[""], AddScopes:[""], RemoveScopes:[""], Note:"", NoteURL:"", Fingerprint:""}` if got := v.String(); got != want { @@ -169,19 +167,19 @@ func TestAuthorizationUpdateRequest_String(t *testing.T) { func TestCheckRun_String(t *testing.T) { t.Parallel() v := CheckRun{ - ID: Int64(0), - NodeID: String(""), - HeadSHA: String(""), - ExternalID: String(""), - URL: String(""), - HTMLURL: String(""), - DetailsURL: String(""), - Status: String(""), - Conclusion: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + HeadSHA: Ptr(""), + ExternalID: Ptr(""), + URL: Ptr(""), + HTMLURL: Ptr(""), + DetailsURL: Ptr(""), + Status: Ptr(""), + Conclusion: Ptr(""), StartedAt: &Timestamp{}, CompletedAt: &Timestamp{}, Output: &CheckRunOutput{}, - Name: String(""), + Name: Ptr(""), CheckSuite: &CheckSuite{}, App: &App{}, } @@ -194,23 +192,23 @@ func TestCheckRun_String(t *testing.T) { func TestCheckSuite_String(t *testing.T) { t.Parallel() v := CheckSuite{ - ID: Int64(0), - NodeID: String(""), - HeadBranch: String(""), - HeadSHA: String(""), - URL: String(""), - BeforeSHA: String(""), - AfterSHA: String(""), - Status: String(""), - Conclusion: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + HeadBranch: Ptr(""), + HeadSHA: Ptr(""), + URL: Ptr(""), + BeforeSHA: Ptr(""), + AfterSHA: Ptr(""), + Status: Ptr(""), + Conclusion: Ptr(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, App: &App{}, Repository: &Repository{}, HeadCommit: &Commit{}, - LatestCheckRunsCount: Int64(0), - Rerequstable: Bool(false), - RunsRerequstable: Bool(false), + LatestCheckRunsCount: Ptr(int64(0)), + Rerequstable: Ptr(false), + RunsRerequstable: Ptr(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, Rerequstable:false, RunsRerequstable:false}` if got := v.String(); got != want { @@ -221,10 +219,10 @@ func TestCheckSuite_String(t *testing.T) { func TestCodeOfConduct_String(t *testing.T) { t.Parallel() v := CodeOfConduct{ - Name: String(""), - Key: String(""), - URL: String(""), - Body: String(""), + Name: Ptr(""), + Key: Ptr(""), + URL: Ptr(""), + Body: Ptr(""), } want := `github.CodeOfConduct{Name:"", Key:"", URL:"", Body:""}` if got := v.String(); got != want { @@ -235,10 +233,10 @@ func TestCodeOfConduct_String(t *testing.T) { func TestCodeResult_String(t *testing.T) { t.Parallel() v := CodeResult{ - Name: String(""), - Path: String(""), - SHA: String(""), - HTMLURL: String(""), + Name: Ptr(""), + Path: Ptr(""), + SHA: Ptr(""), + HTMLURL: Ptr(""), Repository: &Repository{}, } want := `github.CodeResult{Name:"", Path:"", SHA:"", HTMLURL:"", Repository:github.Repository{}}` @@ -250,12 +248,12 @@ func TestCodeResult_String(t *testing.T) { func TestCombinedStatus_String(t *testing.T) { t.Parallel() v := CombinedStatus{ - State: String(""), - Name: String(""), - SHA: String(""), - TotalCount: Int(0), - CommitURL: String(""), - RepositoryURL: String(""), + State: Ptr(""), + Name: Ptr(""), + SHA: Ptr(""), + TotalCount: Ptr(0), + CommitURL: Ptr(""), + RepositoryURL: Ptr(""), } want := `github.CombinedStatus{State:"", Name:"", SHA:"", TotalCount:0, CommitURL:"", RepositoryURL:""}` if got := v.String(); got != want { @@ -266,10 +264,10 @@ func TestCombinedStatus_String(t *testing.T) { func TestCommentStats_String(t *testing.T) { t.Parallel() v := CommentStats{ - TotalCommitComments: Int(0), - TotalGistComments: Int(0), - TotalIssueComments: Int(0), - TotalPullRequestComments: Int(0), + TotalCommitComments: Ptr(0), + TotalGistComments: Ptr(0), + TotalIssueComments: Ptr(0), + TotalPullRequestComments: Ptr(0), } want := `github.CommentStats{TotalCommitComments:0, TotalGistComments:0, TotalIssueComments:0, TotalPullRequestComments:0}` if got := v.String(); got != want { @@ -280,17 +278,17 @@ func TestCommentStats_String(t *testing.T) { func TestCommit_String(t *testing.T) { t.Parallel() v := Commit{ - SHA: String(""), + SHA: Ptr(""), Author: &CommitAuthor{}, Committer: &CommitAuthor{}, - Message: String(""), + Message: Ptr(""), Tree: &Tree{}, Stats: &CommitStats{}, - HTMLURL: String(""), - URL: String(""), + HTMLURL: Ptr(""), + URL: Ptr(""), Verification: &SignatureVerification{}, - NodeID: String(""), - CommentCount: Int(0), + NodeID: Ptr(""), + CommentCount: Ptr(0), } want := `github.Commit{SHA:"", Author:github.CommitAuthor{}, Committer:github.CommitAuthor{}, Message:"", Tree:github.Tree{}, Stats:github.CommitStats{}, HTMLURL:"", URL:"", Verification:github.SignatureVerification{}, NodeID:"", CommentCount:0}` if got := v.String(); got != want { @@ -302,9 +300,9 @@ func TestCommitAuthor_String(t *testing.T) { t.Parallel() v := CommitAuthor{ Date: &Timestamp{}, - Name: String(""), - Email: String(""), - Login: String(""), + Name: Ptr(""), + Email: Ptr(""), + Login: Ptr(""), } want := `github.CommitAuthor{Date:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Name:"", Email:"", Login:""}` if got := v.String(); got != want { @@ -315,17 +313,17 @@ func TestCommitAuthor_String(t *testing.T) { func TestCommitFile_String(t *testing.T) { t.Parallel() v := CommitFile{ - SHA: String(""), - Filename: String(""), - Additions: Int(0), - Deletions: Int(0), - Changes: Int(0), - Status: String(""), - Patch: String(""), - BlobURL: String(""), - RawURL: String(""), - ContentsURL: String(""), - PreviousFilename: String(""), + 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(""), } want := `github.CommitFile{SHA:"", Filename:"", Additions:0, Deletions:0, Changes:0, Status:"", Patch:"", BlobURL:"", RawURL:"", ContentsURL:"", PreviousFilename:""}` if got := v.String(); got != want { @@ -336,9 +334,9 @@ func TestCommitFile_String(t *testing.T) { func TestCommitStats_String(t *testing.T) { t.Parallel() v := CommitStats{ - Additions: Int(0), - Deletions: Int(0), - Total: Int(0), + Additions: Ptr(0), + Deletions: Ptr(0), + Total: Ptr(0), } want := `github.CommitStats{Additions:0, Deletions:0, Total:0}` if got := v.String(); got != want { @@ -351,15 +349,15 @@ func TestCommitsComparison_String(t *testing.T) { v := CommitsComparison{ BaseCommit: &RepositoryCommit{}, MergeBaseCommit: &RepositoryCommit{}, - Status: String(""), - AheadBy: Int(0), - BehindBy: Int(0), - TotalCommits: Int(0), - HTMLURL: String(""), - PermalinkURL: String(""), - DiffURL: String(""), - PatchURL: String(""), - URL: String(""), + Status: Ptr(""), + AheadBy: Ptr(0), + BehindBy: Ptr(0), + TotalCommits: Ptr(0), + HTMLURL: Ptr(""), + PermalinkURL: Ptr(""), + DiffURL: Ptr(""), + PatchURL: Ptr(""), + URL: Ptr(""), } 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 { @@ -371,7 +369,7 @@ func TestContributorStats_String(t *testing.T) { t.Parallel() v := ContributorStats{ Author: &Contributor{}, - Total: Int(0), + Total: Ptr(0), } want := `github.ContributorStats{Author:github.Contributor{}, Total:0}` if got := v.String(); got != want { @@ -382,7 +380,7 @@ func TestContributorStats_String(t *testing.T) { func TestDependabotSecurityUpdates_String(t *testing.T) { t.Parallel() v := DependabotSecurityUpdates{ - Status: String(""), + Status: Ptr(""), } want := `github.DependabotSecurityUpdates{Status:""}` if got := v.String(); got != want { @@ -394,17 +392,17 @@ func TestDiscussionComment_String(t *testing.T) { t.Parallel() v := DiscussionComment{ Author: &User{}, - Body: String(""), - BodyHTML: String(""), - BodyVersion: String(""), + Body: Ptr(""), + BodyHTML: Ptr(""), + BodyVersion: Ptr(""), CreatedAt: &Timestamp{}, LastEditedAt: &Timestamp{}, - DiscussionURL: String(""), - HTMLURL: String(""), - NodeID: String(""), - Number: Int(0), + DiscussionURL: Ptr(""), + HTMLURL: Ptr(""), + NodeID: Ptr(""), + Number: Ptr(0), UpdatedAt: &Timestamp{}, - URL: String(""), + URL: Ptr(""), 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{}}` @@ -416,13 +414,13 @@ func TestDiscussionComment_String(t *testing.T) { func TestDraftReviewComment_String(t *testing.T) { t.Parallel() v := DraftReviewComment{ - Path: String(""), - Position: Int(0), - Body: String(""), - StartSide: String(""), - Side: String(""), - StartLine: Int(0), - Line: Int(0), + Path: Ptr(""), + Position: Ptr(0), + Body: Ptr(""), + StartSide: Ptr(""), + Side: Ptr(""), + StartLine: Ptr(0), + Line: Ptr(0), } want := `github.DraftReviewComment{Path:"", Position:0, Body:"", StartSide:"", Side:"", StartLine:0, Line:0}` if got := v.String(); got != want { @@ -433,14 +431,14 @@ func TestDraftReviewComment_String(t *testing.T) { func TestEnterprise_String(t *testing.T) { t.Parallel() v := Enterprise{ - ID: Int(0), - Slug: String(""), - Name: String(""), - NodeID: String(""), - AvatarURL: String(""), - Description: String(""), - WebsiteURL: String(""), - HTMLURL: String(""), + ID: Ptr(0), + Slug: Ptr(""), + Name: Ptr(""), + NodeID: Ptr(""), + AvatarURL: Ptr(""), + Description: Ptr(""), + WebsiteURL: Ptr(""), + HTMLURL: Ptr(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, } @@ -453,13 +451,13 @@ func TestEnterprise_String(t *testing.T) { func TestEvent_String(t *testing.T) { t.Parallel() v := Event{ - Type: String(""), - Public: Bool(false), + Type: Ptr(""), + Public: Ptr(false), Repo: &Repository{}, Actor: &User{}, Org: &Organization{}, CreatedAt: &Timestamp{}, - ID: String(""), + ID: Ptr(""), } 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 { @@ -470,15 +468,15 @@ func TestEvent_String(t *testing.T) { func TestGPGKey_String(t *testing.T) { t.Parallel() v := GPGKey{ - ID: Int64(0), - PrimaryKeyID: Int64(0), - KeyID: String(""), - RawKey: String(""), - PublicKey: String(""), - CanSign: Bool(false), - CanEncryptComms: Bool(false), - CanEncryptStorage: Bool(false), - CanCertify: Bool(false), + 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), CreatedAt: &Timestamp{}, ExpiresAt: &Timestamp{}, } @@ -491,17 +489,17 @@ func TestGPGKey_String(t *testing.T) { func TestGist_String(t *testing.T) { t.Parallel() v := Gist{ - ID: String(""), - Description: String(""), - Public: Bool(false), + ID: Ptr(""), + Description: Ptr(""), + Public: Ptr(false), Owner: &User{}, - Comments: Int(0), - HTMLURL: String(""), - GitPullURL: String(""), - GitPushURL: String(""), + Comments: Ptr(0), + HTMLURL: Ptr(""), + GitPullURL: Ptr(""), + GitPushURL: Ptr(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - NodeID: String(""), + NodeID: Ptr(""), } 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 { @@ -512,9 +510,9 @@ func TestGist_String(t *testing.T) { func TestGistComment_String(t *testing.T) { t.Parallel() v := GistComment{ - ID: Int64(0), - URL: String(""), - Body: String(""), + ID: Ptr(int64(0)), + URL: Ptr(""), + Body: Ptr(""), User: &User{}, CreatedAt: &Timestamp{}, } @@ -527,12 +525,12 @@ func TestGistComment_String(t *testing.T) { func TestGistCommit_String(t *testing.T) { t.Parallel() v := GistCommit{ - URL: String(""), - Version: String(""), + URL: Ptr(""), + Version: Ptr(""), User: &User{}, ChangeStatus: &CommitStats{}, CommittedAt: &Timestamp{}, - NodeID: String(""), + NodeID: Ptr(""), } 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 { @@ -543,12 +541,12 @@ func TestGistCommit_String(t *testing.T) { func TestGistFile_String(t *testing.T) { t.Parallel() v := GistFile{ - Size: Int(0), - Filename: String(""), - Language: String(""), - Type: String(""), - RawURL: String(""), - Content: String(""), + Size: Ptr(0), + Filename: Ptr(""), + Language: Ptr(""), + Type: Ptr(""), + RawURL: Ptr(""), + Content: Ptr(""), } want := `github.GistFile{Size:0, Filename:"", Language:"", Type:"", RawURL:"", Content:""}` if got := v.String(); got != want { @@ -559,12 +557,12 @@ func TestGistFile_String(t *testing.T) { func TestGistFork_String(t *testing.T) { t.Parallel() v := GistFork{ - URL: String(""), + URL: Ptr(""), User: &User{}, - ID: String(""), + ID: Ptr(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - NodeID: String(""), + NodeID: Ptr(""), } 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 { @@ -575,9 +573,9 @@ func TestGistFork_String(t *testing.T) { func TestGistStats_String(t *testing.T) { t.Parallel() v := GistStats{ - TotalGists: Int(0), - PrivateGists: Int(0), - PublicGists: Int(0), + TotalGists: Ptr(0), + PrivateGists: Ptr(0), + PublicGists: Ptr(0), } want := `github.GistStats{TotalGists:0, PrivateGists:0, PublicGists:0}` if got := v.String(); got != want { @@ -588,9 +586,9 @@ func TestGistStats_String(t *testing.T) { func TestGitObject_String(t *testing.T) { t.Parallel() v := GitObject{ - Type: String(""), - SHA: String(""), - URL: String(""), + Type: Ptr(""), + SHA: Ptr(""), + URL: Ptr(""), } want := `github.GitObject{Type:"", SHA:"", URL:""}` if got := v.String(); got != want { @@ -601,8 +599,8 @@ func TestGitObject_String(t *testing.T) { func TestGitignore_String(t *testing.T) { t.Parallel() v := Gitignore{ - Name: String(""), - Source: String(""), + Name: Ptr(""), + Source: Ptr(""), } want := `github.Gitignore{Name:"", Source:""}` if got := v.String(); got != want { @@ -613,8 +611,8 @@ func TestGitignore_String(t *testing.T) { func TestGrant_String(t *testing.T) { t.Parallel() v := Grant{ - ID: Int64(0), - URL: String(""), + ID: Ptr(int64(0)), + URL: Ptr(""), App: &AuthorizationApp{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, @@ -629,13 +627,13 @@ func TestGrant_String(t *testing.T) { func TestHeadCommit_String(t *testing.T) { t.Parallel() v := HeadCommit{ - Message: String(""), + Message: Ptr(""), Author: &CommitAuthor{}, - URL: String(""), - Distinct: Bool(false), - SHA: String(""), - ID: String(""), - TreeID: String(""), + URL: Ptr(""), + Distinct: Ptr(false), + SHA: Ptr(""), + ID: Ptr(""), + TreeID: Ptr(""), Timestamp: &Timestamp{}, Committer: &CommitAuthor{}, Added: []string{""}, @@ -653,15 +651,15 @@ func TestHook_String(t *testing.T) { v := Hook{ CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - URL: String(""), - ID: Int64(0), - Type: String(""), - Name: String(""), - TestURL: String(""), - PingURL: String(""), + URL: Ptr(""), + ID: Ptr(int64(0)), + Type: Ptr(""), + Name: Ptr(""), + TestURL: Ptr(""), + PingURL: Ptr(""), Config: &HookConfig{}, Events: []string{""}, - Active: Bool(false), + Active: Ptr(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 { @@ -672,17 +670,17 @@ func TestHook_String(t *testing.T) { func TestHookDelivery_String(t *testing.T) { t.Parallel() v := HookDelivery{ - ID: Int64(0), - GUID: String(""), + ID: Ptr(int64(0)), + GUID: Ptr(""), DeliveredAt: &Timestamp{}, - Redelivery: Bool(false), - Duration: Float64(0.0), - Status: String(""), - StatusCode: Int(0), - Event: String(""), - Action: String(""), - InstallationID: Int64(0), - RepositoryID: Int64(0), + Redelivery: Ptr(false), + Duration: Ptr(0.0), + Status: Ptr(""), + StatusCode: Ptr(0), + Event: Ptr(""), + Action: Ptr(""), + InstallationID: Ptr(int64(0)), + RepositoryID: Ptr(int64(0)), Request: &HookRequest{}, Response: &HookResponse{}, } @@ -695,9 +693,9 @@ func TestHookDelivery_String(t *testing.T) { func TestHookStats_String(t *testing.T) { t.Parallel() v := HookStats{ - TotalHooks: Int(0), - ActiveHooks: Int(0), - InactiveHooks: Int(0), + TotalHooks: Ptr(0), + ActiveHooks: Ptr(0), + InactiveHooks: Ptr(0), } want := `github.HookStats{TotalHooks:0, ActiveHooks:0, InactiveHooks:0}` if got := v.String(); got != want { @@ -708,28 +706,28 @@ func TestHookStats_String(t *testing.T) { func TestImport_String(t *testing.T) { t.Parallel() v := Import{ - VCSURL: String(""), - VCS: String(""), - VCSUsername: String(""), - VCSPassword: String(""), - TFVCProject: String(""), - UseLFS: String(""), - HasLargeFiles: Bool(false), - LargeFilesSize: Int(0), - LargeFilesCount: Int(0), - Status: String(""), - CommitCount: Int(0), - StatusText: String(""), - AuthorsCount: Int(0), - Percent: Int(0), - PushPercent: Int(0), - URL: String(""), - HTMLURL: String(""), - AuthorsURL: String(""), - RepositoryURL: String(""), - Message: String(""), - FailedStep: String(""), - HumanName: String(""), + 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(""), } 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 { @@ -740,24 +738,24 @@ func TestImport_String(t *testing.T) { func TestInstallation_String(t *testing.T) { t.Parallel() v := Installation{ - ID: Int64(0), - NodeID: String(""), - AppID: Int64(0), - AppSlug: String(""), - TargetID: Int64(0), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + AppID: Ptr(int64(0)), + AppSlug: Ptr(""), + TargetID: Ptr(int64(0)), Account: &User{}, - AccessTokensURL: String(""), - RepositoriesURL: String(""), - HTMLURL: String(""), - TargetType: String(""), - SingleFileName: String(""), - RepositorySelection: String(""), + AccessTokensURL: Ptr(""), + RepositoriesURL: Ptr(""), + HTMLURL: Ptr(""), + TargetType: Ptr(""), + SingleFileName: Ptr(""), + RepositorySelection: Ptr(""), Events: []string{""}, SingleFilePaths: []string{""}, Permissions: &InstallationPermissions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - HasMultipleSingleFiles: Bool(false), + HasMultipleSingleFiles: Ptr(false), SuspendedBy: &User{}, SuspendedAt: &Timestamp{}, } @@ -770,17 +768,17 @@ func TestInstallation_String(t *testing.T) { func TestInvitation_String(t *testing.T) { t.Parallel() v := Invitation{ - ID: Int64(0), - NodeID: String(""), - Login: String(""), - Email: String(""), - Role: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + Login: Ptr(""), + Email: Ptr(""), + Role: Ptr(""), CreatedAt: &Timestamp{}, Inviter: &User{}, - TeamCount: Int(0), - InvitationTeamURL: String(""), + TeamCount: Ptr(0), + InvitationTeamURL: Ptr(""), FailedAt: &Timestamp{}, - FailedReason: String(""), + FailedReason: Ptr(""), } 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 { @@ -791,34 +789,34 @@ func TestInvitation_String(t *testing.T) { func TestIssue_String(t *testing.T) { t.Parallel() v := Issue{ - ID: Int64(0), - Number: Int(0), - State: String(""), - StateReason: String(""), - Locked: Bool(false), - Title: String(""), - Body: String(""), - AuthorAssociation: String(""), + ID: Ptr(int64(0)), + Number: Ptr(0), + State: Ptr(""), + StateReason: Ptr(""), + Locked: Ptr(false), + Title: Ptr(""), + Body: Ptr(""), + AuthorAssociation: Ptr(""), User: &User{}, Assignee: &User{}, - Comments: Int(0), + Comments: Ptr(0), ClosedAt: &Timestamp{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, ClosedBy: &User{}, - URL: String(""), - HTMLURL: String(""), - CommentsURL: String(""), - EventsURL: String(""), - LabelsURL: String(""), - RepositoryURL: String(""), + URL: Ptr(""), + HTMLURL: Ptr(""), + CommentsURL: Ptr(""), + EventsURL: Ptr(""), + LabelsURL: Ptr(""), + RepositoryURL: Ptr(""), Milestone: &Milestone{}, PullRequestLinks: &PullRequestLinks{}, Repository: &Repository{}, Reactions: &Reactions{}, - NodeID: String(""), - Draft: Bool(false), - ActiveLockReason: String(""), + NodeID: Ptr(""), + Draft: Ptr(false), + ActiveLockReason: Ptr(""), } 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:"", Milestone:github.Milestone{}, PullRequestLinks:github.PullRequestLinks{}, Repository:github.Repository{}, Reactions:github.Reactions{}, NodeID:"", Draft:false, ActiveLockReason:""}` if got := v.String(); got != want { @@ -829,17 +827,17 @@ func TestIssue_String(t *testing.T) { func TestIssueComment_String(t *testing.T) { t.Parallel() v := IssueComment{ - ID: Int64(0), - NodeID: String(""), - Body: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + Body: Ptr(""), User: &User{}, Reactions: &Reactions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - AuthorAssociation: String(""), - URL: String(""), - HTMLURL: String(""), - IssueURL: String(""), + AuthorAssociation: Ptr(""), + URL: Ptr(""), + HTMLURL: Ptr(""), + IssueURL: Ptr(""), } 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:"", URL:"", HTMLURL:"", IssueURL:""}` if got := v.String(); got != want { @@ -850,9 +848,9 @@ func TestIssueComment_String(t *testing.T) { func TestIssueStats_String(t *testing.T) { t.Parallel() v := IssueStats{ - TotalIssues: Int(0), - OpenIssues: Int(0), - ClosedIssues: Int(0), + TotalIssues: Ptr(0), + OpenIssues: Ptr(0), + ClosedIssues: Ptr(0), } want := `github.IssueStats{TotalIssues:0, OpenIssues:0, ClosedIssues:0}` if got := v.String(); got != want { @@ -863,14 +861,14 @@ func TestIssueStats_String(t *testing.T) { func TestKey_String(t *testing.T) { t.Parallel() v := Key{ - ID: Int64(0), - Key: String(""), - URL: String(""), - Title: String(""), - ReadOnly: Bool(false), - Verified: Bool(false), + ID: Ptr(int64(0)), + Key: Ptr(""), + URL: Ptr(""), + Title: Ptr(""), + ReadOnly: Ptr(false), + Verified: Ptr(false), CreatedAt: &Timestamp{}, - AddedBy: String(""), + AddedBy: Ptr(""), 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}}` @@ -882,13 +880,13 @@ func TestKey_String(t *testing.T) { func TestLabel_String(t *testing.T) { t.Parallel() v := Label{ - ID: Int64(0), - URL: String(""), - Name: String(""), - Color: String(""), - Description: String(""), - Default: Bool(false), - NodeID: String(""), + ID: Ptr(int64(0)), + URL: Ptr(""), + Name: Ptr(""), + Color: Ptr(""), + Description: Ptr(""), + Default: Ptr(false), + NodeID: Ptr(""), } want := `github.Label{ID:0, URL:"", Name:"", Color:"", Description:"", Default:false, NodeID:""}` if got := v.String(); got != want { @@ -899,13 +897,13 @@ func TestLabel_String(t *testing.T) { func TestLabelResult_String(t *testing.T) { t.Parallel() v := LabelResult{ - ID: Int64(0), - URL: String(""), - Name: String(""), - Color: String(""), - Default: Bool(false), - Description: String(""), - Score: Float64(0.0), + ID: Ptr(int64(0)), + URL: Ptr(""), + Name: Ptr(""), + Color: Ptr(""), + Default: Ptr(false), + Description: Ptr(""), + Score: Ptr(0.0), } want := `github.LabelResult{ID:0, URL:"", Name:"", Color:"", Default:false, Description:"", Score:0}` if got := v.String(); got != want { @@ -916,10 +914,10 @@ func TestLabelResult_String(t *testing.T) { func TestLargeFile_String(t *testing.T) { t.Parallel() v := LargeFile{ - RefName: String(""), - Path: String(""), - OID: String(""), - Size: Int(0), + RefName: Ptr(""), + Path: Ptr(""), + OID: Ptr(""), + Size: Ptr(0), } want := `github.LargeFile{RefName:"", Path:"", OID:"", Size:0}` if got := v.String(); got != want { @@ -930,15 +928,15 @@ func TestLargeFile_String(t *testing.T) { func TestLicense_String(t *testing.T) { t.Parallel() v := License{ - Key: String(""), - Name: String(""), - URL: String(""), - SPDXID: String(""), - HTMLURL: String(""), - Featured: Bool(false), - Description: String(""), - Implementation: String(""), - Body: String(""), + Key: Ptr(""), + Name: Ptr(""), + URL: Ptr(""), + SPDXID: Ptr(""), + HTMLURL: Ptr(""), + Featured: Ptr(false), + Description: Ptr(""), + Implementation: Ptr(""), + Body: Ptr(""), } want := `github.License{Key:"", Name:"", URL:"", SPDXID:"", HTMLURL:"", Featured:false, Description:"", Implementation:"", Body:""}` if got := v.String(); got != want { @@ -949,10 +947,10 @@ func TestLicense_String(t *testing.T) { func TestMembership_String(t *testing.T) { t.Parallel() v := Membership{ - URL: String(""), - State: String(""), - Role: String(""), - OrganizationURL: String(""), + URL: Ptr(""), + State: Ptr(""), + Role: Ptr(""), + OrganizationURL: Ptr(""), Organization: &Organization{}, User: &User{}, } @@ -965,14 +963,14 @@ func TestMembership_String(t *testing.T) { func TestMigration_String(t *testing.T) { t.Parallel() v := Migration{ - ID: Int64(0), - GUID: String(""), - State: String(""), - LockRepositories: Bool(false), - ExcludeAttachments: Bool(false), - URL: String(""), - CreatedAt: String(""), - UpdatedAt: String(""), + ID: Ptr(int64(0)), + GUID: Ptr(""), + State: Ptr(""), + LockRepositories: Ptr(false), + ExcludeAttachments: Ptr(false), + URL: Ptr(""), + CreatedAt: Ptr(""), + UpdatedAt: Ptr(""), } want := `github.Migration{ID:0, GUID:"", State:"", LockRepositories:false, ExcludeAttachments:false, URL:"", CreatedAt:"", UpdatedAt:""}` if got := v.String(); got != want { @@ -983,22 +981,22 @@ func TestMigration_String(t *testing.T) { func TestMilestone_String(t *testing.T) { t.Parallel() v := Milestone{ - URL: String(""), - HTMLURL: String(""), - LabelsURL: String(""), - ID: Int64(0), - Number: Int(0), - State: String(""), - Title: String(""), - Description: String(""), + URL: Ptr(""), + HTMLURL: Ptr(""), + LabelsURL: Ptr(""), + ID: Ptr(int64(0)), + Number: Ptr(0), + State: Ptr(""), + Title: Ptr(""), + Description: Ptr(""), Creator: &User{}, - OpenIssues: Int(0), - ClosedIssues: Int(0), + OpenIssues: Ptr(0), + ClosedIssues: Ptr(0), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, ClosedAt: &Timestamp{}, DueOn: &Timestamp{}, - NodeID: String(""), + NodeID: Ptr(""), } 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 { @@ -1009,9 +1007,9 @@ func TestMilestone_String(t *testing.T) { func TestMilestoneStats_String(t *testing.T) { t.Parallel() v := MilestoneStats{ - TotalMilestones: Int(0), - OpenMilestones: Int(0), - ClosedMilestones: Int(0), + TotalMilestones: Ptr(0), + OpenMilestones: Ptr(0), + ClosedMilestones: Ptr(0), } want := `github.MilestoneStats{TotalMilestones:0, OpenMilestones:0, ClosedMilestones:0}` if got := v.String(); got != want { @@ -1023,14 +1021,14 @@ func TestNewTeam_String(t *testing.T) { t.Parallel() v := NewTeam{ Name: "", - Description: String(""), + Description: Ptr(""), Maintainers: []string{""}, RepoNames: []string{""}, - ParentTeamID: Int64(0), - NotificationSetting: String(""), - Permission: String(""), - Privacy: String(""), - LDAPDN: String(""), + ParentTeamID: Ptr(int64(0)), + NotificationSetting: Ptr(""), + Permission: Ptr(""), + Privacy: Ptr(""), + LDAPDN: Ptr(""), } want := `github.NewTeam{Name:"", Description:"", Maintainers:[""], RepoNames:[""], ParentTeamID:0, NotificationSetting:"", Permission:"", Privacy:"", LDAPDN:""}` if got := v.String(); got != want { @@ -1041,9 +1039,9 @@ func TestNewTeam_String(t *testing.T) { func TestOAuthAPP_String(t *testing.T) { t.Parallel() v := OAuthAPP{ - URL: String(""), - Name: String(""), - ClientID: String(""), + URL: Ptr(""), + Name: Ptr(""), + ClientID: Ptr(""), } want := `github.OAuthAPP{URL:"", Name:"", ClientID:""}` if got := v.String(); got != want { @@ -1054,10 +1052,10 @@ func TestOAuthAPP_String(t *testing.T) { func TestOrgStats_String(t *testing.T) { t.Parallel() v := OrgStats{ - TotalOrgs: Int(0), - DisabledOrgs: Int(0), - TotalTeams: Int(0), - TotalTeamMembers: Int(0), + TotalOrgs: Ptr(0), + DisabledOrgs: Ptr(0), + TotalTeams: Ptr(0), + TotalTeamMembers: Ptr(0), } want := `github.OrgStats{TotalOrgs:0, DisabledOrgs:0, TotalTeams:0, TotalTeamMembers:0}` if got := v.String(); got != want { @@ -1068,62 +1066,62 @@ func TestOrgStats_String(t *testing.T) { func TestOrganization_String(t *testing.T) { t.Parallel() v := Organization{ - Login: String(""), - ID: Int64(0), - NodeID: String(""), - AvatarURL: String(""), - HTMLURL: String(""), - Name: String(""), - Company: String(""), - Blog: String(""), - Location: String(""), - Email: String(""), - TwitterUsername: String(""), - Description: String(""), - PublicRepos: Int(0), - PublicGists: Int(0), - Followers: Int(0), - Following: Int(0), + 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), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - TotalPrivateRepos: Int64(0), - OwnedPrivateRepos: Int64(0), - PrivateGists: Int(0), - DiskUsage: Int(0), - Collaborators: Int(0), - BillingEmail: String(""), - Type: String(""), + TotalPrivateRepos: Ptr(int64(0)), + OwnedPrivateRepos: Ptr(int64(0)), + PrivateGists: Ptr(0), + DiskUsage: Ptr(0), + Collaborators: Ptr(0), + BillingEmail: Ptr(""), + Type: Ptr(""), Plan: &Plan{}, - TwoFactorRequirementEnabled: Bool(false), - IsVerified: Bool(false), - HasOrganizationProjects: Bool(false), - HasRepositoryProjects: Bool(false), - DefaultRepoPermission: String(""), - DefaultRepoSettings: String(""), - MembersCanCreateRepos: Bool(false), - MembersCanCreatePublicRepos: Bool(false), - MembersCanCreatePrivateRepos: Bool(false), - MembersCanCreateInternalRepos: Bool(false), - MembersCanForkPrivateRepos: Bool(false), - MembersAllowedRepositoryCreationType: String(""), - MembersCanCreatePages: Bool(false), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(false), - WebCommitSignoffRequired: Bool(false), - AdvancedSecurityEnabledForNewRepos: Bool(false), - DependabotAlertsEnabledForNewRepos: Bool(false), - DependabotSecurityUpdatesEnabledForNewRepos: Bool(false), - DependencyGraphEnabledForNewRepos: Bool(false), - SecretScanningEnabledForNewRepos: Bool(false), - SecretScanningPushProtectionEnabledForNewRepos: Bool(false), - SecretScanningValidityChecksEnabled: Bool(false), - URL: String(""), - EventsURL: String(""), - HooksURL: String(""), - IssuesURL: String(""), - MembersURL: String(""), - PublicMembersURL: String(""), - ReposURL: String(""), + 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), + 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), + URL: Ptr(""), + EventsURL: Ptr(""), + HooksURL: Ptr(""), + IssuesURL: Ptr(""), + MembersURL: Ptr(""), + PublicMembersURL: Ptr(""), + ReposURL: Ptr(""), } 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}, 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, MembersAllowedRepositoryCreationType:"", MembersCanCreatePages:false, MembersCanCreatePublicPages:false, MembersCanCreatePrivatePages:false, WebCommitSignoffRequired:false, AdvancedSecurityEnabledForNewRepos:false, DependabotAlertsEnabledForNewRepos:false, DependabotSecurityUpdatesEnabledForNewRepos:false, DependencyGraphEnabledForNewRepos:false, SecretScanningEnabledForNewRepos:false, SecretScanningPushProtectionEnabledForNewRepos:false, SecretScanningValidityChecksEnabled:false, URL:"", EventsURL:"", HooksURL:"", IssuesURL:"", MembersURL:"", PublicMembersURL:"", ReposURL:""}` if got := v.String(); got != want { @@ -1134,18 +1132,18 @@ func TestOrganization_String(t *testing.T) { func TestPackage_String(t *testing.T) { t.Parallel() v := Package{ - ID: Int64(0), - Name: String(""), - PackageType: String(""), - HTMLURL: String(""), + ID: Ptr(int64(0)), + Name: Ptr(""), + PackageType: Ptr(""), + HTMLURL: Ptr(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, Owner: &User{}, PackageVersion: &PackageVersion{}, Registry: &PackageRegistry{}, - URL: String(""), - VersionCount: Int64(0), - Visibility: String(""), + URL: Ptr(""), + VersionCount: Ptr(int64(0)), + Visibility: Ptr(""), Repository: &Repository{}, } want := `github.Package{ID:0, Name:"", PackageType:"", HTMLURL:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Owner:github.User{}, PackageVersion:github.PackageVersion{}, Registry:github.PackageRegistry{}, URL:"", VersionCount:0, Visibility:"", Repository:github.Repository{}}` @@ -1168,16 +1166,16 @@ func TestPackageContainerMetadata_String(t *testing.T) { func TestPackageFile_String(t *testing.T) { t.Parallel() v := PackageFile{ - DownloadURL: String(""), - ID: Int64(0), - Name: String(""), - SHA256: String(""), - SHA1: String(""), - MD5: String(""), - ContentType: String(""), - State: String(""), + DownloadURL: Ptr(""), + ID: Ptr(int64(0)), + Name: Ptr(""), + SHA256: Ptr(""), + SHA1: Ptr(""), + MD5: Ptr(""), + ContentType: Ptr(""), + State: Ptr(""), Author: &User{}, - Size: Int64(0), + Size: Ptr(int64(0)), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, } @@ -1190,7 +1188,7 @@ func TestPackageFile_String(t *testing.T) { func TestPackageMetadata_String(t *testing.T) { t.Parallel() v := PackageMetadata{ - PackageType: String(""), + PackageType: Ptr(""), Container: &PackageContainerMetadata{}, } want := `github.PackageMetadata{PackageType:"", Container:github.PackageContainerMetadata{}}` @@ -1202,11 +1200,11 @@ func TestPackageMetadata_String(t *testing.T) { func TestPackageRegistry_String(t *testing.T) { t.Parallel() v := PackageRegistry{ - AboutURL: String(""), - Name: String(""), - Type: String(""), - URL: String(""), - Vendor: String(""), + AboutURL: Ptr(""), + Name: Ptr(""), + Type: Ptr(""), + URL: Ptr(""), + Vendor: Ptr(""), } want := `github.PackageRegistry{AboutURL:"", Name:"", Type:"", URL:"", Vendor:""}` if got := v.String(); got != want { @@ -1217,15 +1215,15 @@ func TestPackageRegistry_String(t *testing.T) { func TestPackageRelease_String(t *testing.T) { t.Parallel() v := PackageRelease{ - URL: String(""), - HTMLURL: String(""), - ID: Int64(0), - TagName: String(""), - TargetCommitish: String(""), - Name: String(""), - Draft: Bool(false), + URL: Ptr(""), + HTMLURL: Ptr(""), + ID: Ptr(int64(0)), + TagName: Ptr(""), + TargetCommitish: Ptr(""), + Name: Ptr(""), + Draft: Ptr(false), Author: &User{}, - Prerelease: Bool(false), + Prerelease: Ptr(false), CreatedAt: &Timestamp{}, PublishedAt: &Timestamp{}, } @@ -1238,27 +1236,27 @@ func TestPackageRelease_String(t *testing.T) { func TestPackageVersion_String(t *testing.T) { t.Parallel() v := PackageVersion{ - ID: Int64(0), - Version: String(""), - Summary: String(""), - Body: String(""), - BodyHTML: String(""), + ID: Ptr(int64(0)), + Version: Ptr(""), + Summary: Ptr(""), + Body: Ptr(""), + BodyHTML: Ptr(""), Release: &PackageRelease{}, - Manifest: String(""), - HTMLURL: String(""), - TagName: String(""), - TargetCommitish: String(""), - TargetOID: String(""), - Draft: Bool(false), - Prerelease: Bool(false), + Manifest: Ptr(""), + HTMLURL: Ptr(""), + TagName: Ptr(""), + TargetCommitish: Ptr(""), + TargetOID: Ptr(""), + Draft: Ptr(false), + Prerelease: Ptr(false), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, Author: &User{}, - InstallationCommand: String(""), + InstallationCommand: Ptr(""), Metadata: &PackageMetadata{}, - PackageHTMLURL: String(""), - Name: String(""), - URL: String(""), + PackageHTMLURL: Ptr(""), + Name: Ptr(""), + URL: Ptr(""), } want := `github.PackageVersion{ID:0, Version:"", Summary:"", Body:"", BodyHTML:"", Release:github.PackageRelease{}, Manifest:"", HTMLURL:"", TagName:"", TargetCommitish:"", TargetOID:"", Draft:false, Prerelease:false, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Author:github.User{}, InstallationCommand:"", Metadata:github.PackageMetadata{}, PackageHTMLURL:"", Name:"", URL:""}` if got := v.String(); got != want { @@ -1269,7 +1267,7 @@ func TestPackageVersion_String(t *testing.T) { func TestPageStats_String(t *testing.T) { t.Parallel() v := PageStats{ - TotalPages: Int(0), + TotalPages: Ptr(0), } want := `github.PageStats{TotalPages:0}` if got := v.String(); got != want { @@ -1280,12 +1278,12 @@ func TestPageStats_String(t *testing.T) { func TestPlan_String(t *testing.T) { t.Parallel() v := Plan{ - Name: String(""), - Space: Int(0), - Collaborators: Int(0), - PrivateRepos: Int64(0), - FilledSeats: Int(0), - Seats: Int(0), + Name: Ptr(""), + Space: Ptr(0), + Collaborators: Ptr(0), + PrivateRepos: Ptr(int64(0)), + FilledSeats: Ptr(0), + Seats: Ptr(0), } want := `github.Plan{Name:"", Space:0, Collaborators:0, PrivateRepos:0, FilledSeats:0, Seats:0}` if got := v.String(); got != want { @@ -1296,10 +1294,10 @@ func TestPlan_String(t *testing.T) { func TestPreReceiveHook_String(t *testing.T) { t.Parallel() v := PreReceiveHook{ - ID: Int64(0), - Name: String(""), - Enforcement: String(""), - ConfigURL: String(""), + ID: Ptr(int64(0)), + Name: Ptr(""), + Enforcement: Ptr(""), + ConfigURL: Ptr(""), } want := `github.PreReceiveHook{ID:0, Name:"", Enforcement:"", ConfigURL:""}` if got := v.String(); got != want { @@ -1310,20 +1308,20 @@ func TestPreReceiveHook_String(t *testing.T) { func TestProject_String(t *testing.T) { t.Parallel() v := Project{ - ID: Int64(0), - URL: String(""), - HTMLURL: String(""), - ColumnsURL: String(""), - OwnerURL: String(""), - Name: String(""), - Body: String(""), - Number: Int(0), - State: String(""), + ID: Ptr(int64(0)), + URL: Ptr(""), + HTMLURL: Ptr(""), + ColumnsURL: Ptr(""), + OwnerURL: Ptr(""), + Name: Ptr(""), + Body: Ptr(""), + Number: Ptr(0), + State: Ptr(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - NodeID: String(""), - OrganizationPermission: String(""), - Private: Bool(false), + NodeID: Ptr(""), + OrganizationPermission: Ptr(""), + Private: Ptr(false), Creator: &User{}, } want := `github.Project{ID:0, URL:"", HTMLURL:"", ColumnsURL:"", OwnerURL:"", Name:"", Body:"", Number:0, State:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, NodeID:"", OrganizationPermission:"", Private:false, Creator:github.User{}}` @@ -1335,50 +1333,50 @@ func TestProject_String(t *testing.T) { func TestPullRequest_String(t *testing.T) { t.Parallel() v := PullRequest{ - ID: Int64(0), - Number: Int(0), - State: String(""), - Locked: Bool(false), - Title: String(""), - Body: String(""), + ID: Ptr(int64(0)), + Number: Ptr(0), + State: Ptr(""), + Locked: Ptr(false), + Title: Ptr(""), + Body: Ptr(""), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, ClosedAt: &Timestamp{}, MergedAt: &Timestamp{}, User: &User{}, - Draft: Bool(false), - Merged: Bool(false), - Mergeable: Bool(false), - MergeableState: String(""), + Draft: Ptr(false), + Merged: Ptr(false), + Mergeable: Ptr(false), + MergeableState: Ptr(""), MergedBy: &User{}, - MergeCommitSHA: String(""), - Rebaseable: Bool(false), - Comments: Int(0), - Commits: Int(0), - Additions: Int(0), - Deletions: Int(0), - ChangedFiles: Int(0), - URL: String(""), - HTMLURL: String(""), - IssueURL: String(""), - StatusesURL: String(""), - DiffURL: String(""), - PatchURL: String(""), - CommitsURL: String(""), - CommentsURL: String(""), - ReviewCommentsURL: String(""), - ReviewCommentURL: String(""), - ReviewComments: Int(0), + MergeCommitSHA: Ptr(""), + Rebaseable: Ptr(false), + Comments: Ptr(0), + Commits: Ptr(0), + Additions: Ptr(0), + Deletions: Ptr(0), + ChangedFiles: Ptr(0), + URL: Ptr(""), + HTMLURL: Ptr(""), + IssueURL: Ptr(""), + StatusesURL: Ptr(""), + DiffURL: Ptr(""), + PatchURL: Ptr(""), + CommitsURL: Ptr(""), + CommentsURL: Ptr(""), + ReviewCommentsURL: Ptr(""), + ReviewCommentURL: Ptr(""), + ReviewComments: Ptr(0), Assignee: &User{}, Milestone: &Milestone{}, - MaintainerCanModify: Bool(false), - AuthorAssociation: String(""), - NodeID: String(""), + MaintainerCanModify: Ptr(false), + AuthorAssociation: Ptr(""), + NodeID: Ptr(""), AutoMerge: &PullRequestAutoMerge{}, Links: &PRLinks{}, Head: &PullRequestBranch{}, Base: &PullRequestBranch{}, - ActiveLockReason: String(""), + ActiveLockReason: Ptr(""), } 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, Merged:false, Mergeable:false, MergeableState:"", MergedBy:github.User{}, MergeCommitSHA:"", Rebaseable:false, Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", ReviewComments:0, Assignee:github.User{}, Milestone:github.Milestone{}, MaintainerCanModify:false, AuthorAssociation:"", NodeID:"", AutoMerge:github.PullRequestAutoMerge{}, Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, ActiveLockReason:""}` if got := v.String(); got != want { @@ -1389,32 +1387,32 @@ func TestPullRequest_String(t *testing.T) { func TestPullRequestComment_String(t *testing.T) { t.Parallel() v := PullRequestComment{ - ID: Int64(0), - NodeID: String(""), - InReplyTo: Int64(0), - Body: String(""), - Path: String(""), - DiffHunk: String(""), - PullRequestReviewID: Int64(0), - Position: Int(0), - OriginalPosition: Int(0), - StartLine: Int(0), - Line: Int(0), - OriginalLine: Int(0), - OriginalStartLine: Int(0), - Side: String(""), - StartSide: String(""), - CommitID: String(""), - OriginalCommitID: String(""), + 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(""), User: &User{}, Reactions: &Reactions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - AuthorAssociation: String(""), - URL: String(""), - HTMLURL: String(""), - PullRequestURL: String(""), - SubjectType: String(""), + AuthorAssociation: Ptr(""), + URL: Ptr(""), + HTMLURL: Ptr(""), + PullRequestURL: Ptr(""), + SubjectType: Ptr(""), } 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 { @@ -1425,16 +1423,16 @@ func TestPullRequestComment_String(t *testing.T) { func TestPullRequestReview_String(t *testing.T) { t.Parallel() v := PullRequestReview{ - ID: Int64(0), - NodeID: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), User: &User{}, - Body: String(""), + Body: Ptr(""), SubmittedAt: &Timestamp{}, - CommitID: String(""), - HTMLURL: String(""), - PullRequestURL: String(""), - State: String(""), - AuthorAssociation: String(""), + CommitID: Ptr(""), + HTMLURL: Ptr(""), + PullRequestURL: Ptr(""), + State: Ptr(""), + AuthorAssociation: Ptr(""), } 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 { @@ -1445,7 +1443,7 @@ func TestPullRequestReview_String(t *testing.T) { func TestPullRequestReviewDismissalRequest_String(t *testing.T) { t.Parallel() v := PullRequestReviewDismissalRequest{ - Message: String(""), + Message: Ptr(""), } want := `github.PullRequestReviewDismissalRequest{Message:""}` if got := v.String(); got != want { @@ -1456,10 +1454,10 @@ func TestPullRequestReviewDismissalRequest_String(t *testing.T) { func TestPullRequestReviewRequest_String(t *testing.T) { t.Parallel() v := PullRequestReviewRequest{ - NodeID: String(""), - CommitID: String(""), - Body: String(""), - Event: String(""), + NodeID: Ptr(""), + CommitID: Ptr(""), + Body: Ptr(""), + Event: Ptr(""), } want := `github.PullRequestReviewRequest{NodeID:"", CommitID:"", Body:"", Event:""}` if got := v.String(); got != want { @@ -1470,8 +1468,8 @@ func TestPullRequestReviewRequest_String(t *testing.T) { func TestPullRequestThread_String(t *testing.T) { t.Parallel() v := PullRequestThread{ - ID: Int64(0), - NodeID: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), } want := `github.PullRequestThread{ID:0, NodeID:""}` if got := v.String(); got != want { @@ -1482,10 +1480,10 @@ func TestPullRequestThread_String(t *testing.T) { func TestPullStats_String(t *testing.T) { t.Parallel() v := PullStats{ - TotalPulls: Int(0), - MergedPulls: Int(0), - MergablePulls: Int(0), - UnmergablePulls: Int(0), + TotalPulls: Ptr(0), + MergedPulls: Ptr(0), + MergablePulls: Ptr(0), + UnmergablePulls: Ptr(0), } want := `github.PullStats{TotalPulls:0, MergedPulls:0, MergablePulls:0, UnmergablePulls:0}` if got := v.String(); got != want { @@ -1496,19 +1494,19 @@ func TestPullStats_String(t *testing.T) { func TestPushEvent_String(t *testing.T) { t.Parallel() v := PushEvent{ - PushID: Int64(0), - Head: String(""), - Ref: String(""), - Size: Int(0), - Before: String(""), - DistinctSize: Int(0), - Action: String(""), - After: String(""), - Created: Bool(false), - Deleted: Bool(false), - Forced: Bool(false), - BaseRef: String(""), - Compare: String(""), + 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(""), Repo: &PushEventRepository{}, HeadCommit: &HeadCommit{}, Pusher: &CommitAuthor{}, @@ -1538,10 +1536,10 @@ func TestRate_String(t *testing.T) { func TestReaction_String(t *testing.T) { t.Parallel() v := Reaction{ - ID: Int64(0), + ID: Ptr(int64(0)), User: &User{}, - NodeID: String(""), - Content: String(""), + NodeID: Ptr(""), + Content: Ptr(""), } want := `github.Reaction{ID:0, User:github.User{}, NodeID:"", Content:""}` if got := v.String(); got != want { @@ -1552,10 +1550,10 @@ func TestReaction_String(t *testing.T) { func TestReference_String(t *testing.T) { t.Parallel() v := Reference{ - Ref: String(""), - URL: String(""), + Ref: Ptr(""), + URL: Ptr(""), Object: &GitObject{}, - NodeID: String(""), + NodeID: Ptr(""), } want := `github.Reference{Ref:"", URL:"", Object:github.GitObject{}, NodeID:""}` if got := v.String(); got != want { @@ -1566,19 +1564,19 @@ func TestReference_String(t *testing.T) { func TestReleaseAsset_String(t *testing.T) { t.Parallel() v := ReleaseAsset{ - ID: Int64(0), - URL: String(""), - Name: String(""), - Label: String(""), - State: String(""), - ContentType: String(""), - Size: Int(0), - DownloadCount: Int(0), + ID: Ptr(int64(0)), + URL: Ptr(""), + Name: Ptr(""), + Label: Ptr(""), + State: Ptr(""), + ContentType: Ptr(""), + Size: Ptr(0), + DownloadCount: Ptr(0), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - BrowserDownloadURL: String(""), + BrowserDownloadURL: Ptr(""), Uploader: &User{}, - NodeID: String(""), + NodeID: Ptr(""), } 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:""}` if got := v.String(); got != want { @@ -1589,8 +1587,8 @@ func TestReleaseAsset_String(t *testing.T) { func TestRename_String(t *testing.T) { t.Parallel() v := Rename{ - From: String(""), - To: String(""), + From: Ptr(""), + To: Ptr(""), } want := `github.Rename{From:"", To:""}` if got := v.String(); got != want { @@ -1601,12 +1599,12 @@ func TestRename_String(t *testing.T) { func TestRepoStats_String(t *testing.T) { t.Parallel() v := RepoStats{ - TotalRepos: Int(0), - RootRepos: Int(0), - ForkRepos: Int(0), - OrgRepos: Int(0), - TotalPushes: Int(0), - TotalWikis: Int(0), + TotalRepos: Ptr(0), + RootRepos: Ptr(0), + ForkRepos: Ptr(0), + OrgRepos: Ptr(0), + TotalPushes: Ptr(0), + TotalWikis: Ptr(0), } want := `github.RepoStats{TotalRepos:0, RootRepos:0, ForkRepos:0, OrgRepos:0, TotalPushes:0, TotalWikis:0}` if got := v.String(); got != want { @@ -1617,14 +1615,14 @@ func TestRepoStats_String(t *testing.T) { func TestRepoStatus_String(t *testing.T) { t.Parallel() v := RepoStatus{ - ID: Int64(0), - NodeID: String(""), - URL: String(""), - State: String(""), - TargetURL: String(""), - Description: String(""), - Context: String(""), - AvatarURL: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + URL: Ptr(""), + State: Ptr(""), + TargetURL: Ptr(""), + Description: Ptr(""), + Context: Ptr(""), + AvatarURL: Ptr(""), Creator: &User{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, @@ -1638,109 +1636,109 @@ func TestRepoStatus_String(t *testing.T) { func TestRepository_String(t *testing.T) { t.Parallel() v := Repository{ - ID: Int64(0), - NodeID: String(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), Owner: &User{}, - Name: String(""), - FullName: String(""), - Description: String(""), - Homepage: String(""), + Name: Ptr(""), + FullName: Ptr(""), + Description: Ptr(""), + Homepage: Ptr(""), CodeOfConduct: &CodeOfConduct{}, - DefaultBranch: String(""), - MasterBranch: String(""), + DefaultBranch: Ptr(""), + MasterBranch: Ptr(""), CreatedAt: &Timestamp{}, PushedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - HTMLURL: String(""), - CloneURL: String(""), - GitURL: String(""), - MirrorURL: String(""), - SSHURL: String(""), - SVNURL: String(""), - Language: String(""), - Fork: Bool(false), - ForksCount: Int(0), - NetworkCount: Int(0), - OpenIssuesCount: Int(0), - OpenIssues: Int(0), - StargazersCount: Int(0), - SubscribersCount: Int(0), - WatchersCount: Int(0), - Watchers: Int(0), - Size: Int(0), - AutoInit: Bool(false), + 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), Parent: &Repository{}, Source: &Repository{}, TemplateRepository: &Repository{}, Organization: &Organization{}, - AllowRebaseMerge: Bool(false), - AllowUpdateBranch: Bool(false), - AllowSquashMerge: Bool(false), - AllowMergeCommit: Bool(false), - AllowAutoMerge: Bool(false), - AllowForking: Bool(false), - WebCommitSignoffRequired: Bool(false), - DeleteBranchOnMerge: Bool(false), - UseSquashPRTitleAsDefault: Bool(false), - SquashMergeCommitTitle: String(""), - SquashMergeCommitMessage: String(""), - MergeCommitTitle: String(""), - MergeCommitMessage: String(""), + 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(""), Topics: []string{""}, - Archived: Bool(false), - Disabled: Bool(false), + Archived: Ptr(false), + Disabled: Ptr(false), License: &License{}, - Private: Bool(false), - HasIssues: Bool(false), - HasWiki: Bool(false), - HasPages: Bool(false), - HasProjects: Bool(false), - HasDownloads: Bool(false), - HasDiscussions: Bool(false), - IsTemplate: Bool(false), - LicenseTemplate: String(""), - GitignoreTemplate: String(""), + Private: Ptr(false), + HasIssues: Ptr(false), + HasWiki: Ptr(false), + HasPages: Ptr(false), + HasProjects: Ptr(false), + HasDownloads: Ptr(false), + HasDiscussions: Ptr(false), + IsTemplate: Ptr(false), + LicenseTemplate: Ptr(""), + GitignoreTemplate: Ptr(""), SecurityAndAnalysis: &SecurityAndAnalysis{}, - TeamID: Int64(0), - URL: String(""), - ArchiveURL: String(""), - AssigneesURL: String(""), - BlobsURL: String(""), - BranchesURL: String(""), - CollaboratorsURL: String(""), - CommentsURL: String(""), - CommitsURL: String(""), - CompareURL: String(""), - ContentsURL: String(""), - ContributorsURL: String(""), - DeploymentsURL: String(""), - DownloadsURL: String(""), - EventsURL: String(""), - ForksURL: String(""), - GitCommitsURL: String(""), - GitRefsURL: String(""), - GitTagsURL: String(""), - HooksURL: String(""), - IssueCommentURL: String(""), - IssueEventsURL: String(""), - IssuesURL: String(""), - KeysURL: String(""), - LabelsURL: String(""), - LanguagesURL: String(""), - MergesURL: String(""), - MilestonesURL: String(""), - NotificationsURL: String(""), - PullsURL: String(""), - ReleasesURL: String(""), - StargazersURL: String(""), - StatusesURL: String(""), - SubscribersURL: String(""), - SubscriptionURL: String(""), - TagsURL: String(""), - TreesURL: String(""), - TeamsURL: String(""), - Visibility: String(""), - RoleName: String(""), + 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(""), } 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{}, 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, 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 { @@ -1751,18 +1749,18 @@ func TestRepository_String(t *testing.T) { func TestRepositoryComment_String(t *testing.T) { t.Parallel() v := RepositoryComment{ - HTMLURL: String(""), - URL: String(""), - ID: Int64(0), - NodeID: String(""), - CommitID: String(""), + HTMLURL: Ptr(""), + URL: Ptr(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + CommitID: Ptr(""), User: &User{}, Reactions: &Reactions{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, - Body: String(""), - Path: String(""), - Position: Int(0), + Body: Ptr(""), + Path: Ptr(""), + Position: Ptr(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 { @@ -1773,14 +1771,14 @@ func TestRepositoryComment_String(t *testing.T) { func TestRepositoryCommit_String(t *testing.T) { t.Parallel() v := RepositoryCommit{ - NodeID: String(""), - SHA: String(""), + NodeID: Ptr(""), + SHA: Ptr(""), Commit: &Commit{}, Author: &User{}, Committer: &User{}, - HTMLURL: String(""), - URL: String(""), - CommentsURL: String(""), + HTMLURL: Ptr(""), + URL: Ptr(""), + CommentsURL: Ptr(""), Stats: &CommitStats{}, } want := `github.RepositoryCommit{NodeID:"", SHA:"", Commit:github.Commit{}, Author:github.User{}, Committer:github.User{}, HTMLURL:"", URL:"", CommentsURL:"", Stats:github.CommitStats{}}` @@ -1792,19 +1790,19 @@ func TestRepositoryCommit_String(t *testing.T) { func TestRepositoryContent_String(t *testing.T) { t.Parallel() v := RepositoryContent{ - Type: String(""), - Target: String(""), - Encoding: String(""), - Size: Int(0), - Name: String(""), - Path: String(""), - Content: String(""), - SHA: String(""), - URL: String(""), - GitURL: String(""), - HTMLURL: String(""), - DownloadURL: String(""), - SubmoduleGitURL: String(""), + 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(""), } want := `github.RepositoryContent{Type:"", Target:"", Encoding:"", Size:0, Name:"", Path:"", Content:"", SHA:"", URL:"", GitURL:"", HTMLURL:"", DownloadURL:"", SubmoduleGitURL:""}` if got := v.String(); got != want { @@ -1815,17 +1813,17 @@ func TestRepositoryContent_String(t *testing.T) { func TestRepositoryLicense_String(t *testing.T) { t.Parallel() v := RepositoryLicense{ - Name: String(""), - Path: String(""), - SHA: String(""), - Size: Int(0), - URL: String(""), - HTMLURL: String(""), - GitURL: String(""), - DownloadURL: String(""), - Type: String(""), - Content: String(""), - Encoding: String(""), + Name: Ptr(""), + Path: Ptr(""), + SHA: Ptr(""), + Size: Ptr(0), + URL: Ptr(""), + HTMLURL: Ptr(""), + GitURL: Ptr(""), + DownloadURL: Ptr(""), + Type: Ptr(""), + Content: Ptr(""), + Encoding: Ptr(""), License: &License{}, } want := `github.RepositoryLicense{Name:"", Path:"", SHA:"", Size:0, URL:"", HTMLURL:"", GitURL:"", DownloadURL:"", Type:"", Content:"", Encoding:"", License:github.License{}}` @@ -1849,26 +1847,26 @@ func TestRepositoryParticipation_String(t *testing.T) { func TestRepositoryRelease_String(t *testing.T) { t.Parallel() v := RepositoryRelease{ - TagName: String(""), - TargetCommitish: String(""), - Name: String(""), - Body: String(""), - Draft: Bool(false), - Prerelease: Bool(false), - MakeLatest: String(""), - DiscussionCategoryName: String(""), - GenerateReleaseNotes: Bool(false), - ID: Int64(0), + TagName: Ptr(""), + TargetCommitish: Ptr(""), + Name: Ptr(""), + Body: Ptr(""), + Draft: Ptr(false), + Prerelease: Ptr(false), + MakeLatest: Ptr(""), + DiscussionCategoryName: Ptr(""), + GenerateReleaseNotes: Ptr(false), + ID: Ptr(int64(0)), CreatedAt: &Timestamp{}, PublishedAt: &Timestamp{}, - URL: String(""), - HTMLURL: String(""), - AssetsURL: String(""), - UploadURL: String(""), - ZipballURL: String(""), - TarballURL: String(""), + URL: Ptr(""), + HTMLURL: Ptr(""), + AssetsURL: Ptr(""), + UploadURL: Ptr(""), + ZipballURL: Ptr(""), + TarballURL: Ptr(""), Author: &User{}, - NodeID: String(""), + NodeID: Ptr(""), } want := `github.RepositoryRelease{TagName:"", TargetCommitish:"", Name:"", Body:"", Draft:false, Prerelease:false, MakeLatest:"", DiscussionCategoryName:"", GenerateReleaseNotes: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}, URL:"", HTMLURL:"", AssetsURL:"", UploadURL:"", ZipballURL:"", TarballURL:"", Author:github.User{}, NodeID:""}` if got := v.String(); got != want { @@ -1890,9 +1888,9 @@ func TestSBOM_String(t *testing.T) { func TestSSHSigningKey_String(t *testing.T) { t.Parallel() v := SSHSigningKey{ - ID: Int64(0), - Key: String(""), - Title: String(""), + ID: Ptr(int64(0)), + Key: Ptr(""), + Title: Ptr(""), CreatedAt: &Timestamp{}, } want := `github.SSHSigningKey{ID:0, Key:"", Title:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` @@ -1904,7 +1902,7 @@ func TestSSHSigningKey_String(t *testing.T) { func TestSecretScanning_String(t *testing.T) { t.Parallel() v := SecretScanning{ - Status: String(""), + Status: Ptr(""), } want := `github.SecretScanning{Status:""}` if got := v.String(); got != want { @@ -1915,7 +1913,7 @@ func TestSecretScanning_String(t *testing.T) { func TestSecretScanningPushProtection_String(t *testing.T) { t.Parallel() v := SecretScanningPushProtection{ - Status: String(""), + Status: Ptr(""), } want := `github.SecretScanningPushProtection{Status:""}` if got := v.String(); got != want { @@ -1941,13 +1939,13 @@ func TestSecurityAndAnalysis_String(t *testing.T) { func TestSourceImportAuthor_String(t *testing.T) { t.Parallel() v := SourceImportAuthor{ - ID: Int64(0), - RemoteID: String(""), - RemoteName: String(""), - Email: String(""), - Name: String(""), - URL: String(""), - ImportURL: String(""), + ID: Ptr(int64(0)), + RemoteID: Ptr(""), + RemoteName: Ptr(""), + Email: Ptr(""), + Name: Ptr(""), + URL: Ptr(""), + ImportURL: Ptr(""), } want := `github.SourceImportAuthor{ID:0, RemoteID:"", RemoteName:"", Email:"", Name:"", URL:"", ImportURL:""}` if got := v.String(); got != want { @@ -1958,22 +1956,22 @@ func TestSourceImportAuthor_String(t *testing.T) { func TestTeam_String(t *testing.T) { t.Parallel() v := Team{ - ID: Int64(0), - NodeID: String(""), - Name: String(""), - Description: String(""), - URL: String(""), - Slug: String(""), - Permission: String(""), - Privacy: String(""), - MembersCount: Int(0), - ReposCount: Int(0), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + Name: Ptr(""), + Description: Ptr(""), + URL: Ptr(""), + Slug: Ptr(""), + Permission: Ptr(""), + Privacy: Ptr(""), + MembersCount: Ptr(0), + ReposCount: Ptr(0), Organization: &Organization{}, - HTMLURL: String(""), - MembersURL: String(""), - RepositoriesURL: String(""), + HTMLURL: Ptr(""), + MembersURL: Ptr(""), + RepositoriesURL: Ptr(""), Parent: &Team{}, - LDAPDN: String(""), + LDAPDN: Ptr(""), } want := `github.Team{ID:0, NodeID:"", Name:"", Description:"", URL:"", Slug:"", Permission:"", Privacy:"", MembersCount:0, ReposCount:0, Organization:github.Organization{}, HTMLURL:"", MembersURL:"", RepositoriesURL:"", Parent:github.Team{}, LDAPDN:""}` if got := v.String(); got != want { @@ -1985,22 +1983,22 @@ func TestTeamDiscussion_String(t *testing.T) { t.Parallel() v := TeamDiscussion{ Author: &User{}, - Body: String(""), - BodyHTML: String(""), - BodyVersion: String(""), - CommentsCount: Int(0), - CommentsURL: String(""), + Body: Ptr(""), + BodyHTML: Ptr(""), + BodyVersion: Ptr(""), + CommentsCount: Ptr(0), + CommentsURL: Ptr(""), CreatedAt: &Timestamp{}, LastEditedAt: &Timestamp{}, - HTMLURL: String(""), - NodeID: String(""), - Number: Int(0), - Pinned: Bool(false), - Private: Bool(false), - TeamURL: String(""), - Title: String(""), + HTMLURL: Ptr(""), + NodeID: Ptr(""), + Number: Ptr(0), + Pinned: Ptr(false), + Private: Ptr(false), + TeamURL: Ptr(""), + Title: Ptr(""), UpdatedAt: &Timestamp{}, - URL: String(""), + URL: Ptr(""), 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{}}` @@ -2012,16 +2010,16 @@ func TestTeamDiscussion_String(t *testing.T) { func TestTeamLDAPMapping_String(t *testing.T) { t.Parallel() v := TeamLDAPMapping{ - ID: Int64(0), - LDAPDN: String(""), - URL: String(""), - Name: String(""), - Slug: String(""), - Description: String(""), - Privacy: String(""), - Permission: String(""), - MembersURL: String(""), - RepositoriesURL: String(""), + ID: Ptr(int64(0)), + LDAPDN: Ptr(""), + URL: Ptr(""), + Name: Ptr(""), + Slug: Ptr(""), + Description: Ptr(""), + Privacy: Ptr(""), + Permission: Ptr(""), + MembersURL: Ptr(""), + RepositoriesURL: Ptr(""), } want := `github.TeamLDAPMapping{ID:0, LDAPDN:"", URL:"", Name:"", Slug:"", Description:"", Privacy:"", Permission:"", MembersURL:"", RepositoriesURL:""}` if got := v.String(); got != want { @@ -2032,10 +2030,10 @@ func TestTeamLDAPMapping_String(t *testing.T) { func TestTextMatch_String(t *testing.T) { t.Parallel() v := TextMatch{ - ObjectURL: String(""), - ObjectType: String(""), - Property: String(""), - Fragment: String(""), + ObjectURL: Ptr(""), + ObjectType: Ptr(""), + Property: Ptr(""), + Fragment: Ptr(""), } want := `github.TextMatch{ObjectURL:"", ObjectType:"", Property:"", Fragment:""}` if got := v.String(); got != want { @@ -2046,8 +2044,8 @@ func TestTextMatch_String(t *testing.T) { func TestTree_String(t *testing.T) { t.Parallel() v := Tree{ - SHA: String(""), - Truncated: Bool(false), + SHA: Ptr(""), + Truncated: Ptr(false), } want := `github.Tree{SHA:"", Truncated:false}` if got := v.String(); got != want { @@ -2058,13 +2056,13 @@ func TestTree_String(t *testing.T) { func TestTreeEntry_String(t *testing.T) { t.Parallel() v := TreeEntry{ - SHA: String(""), - Path: String(""), - Mode: String(""), - Type: String(""), - Size: Int(0), - Content: String(""), - URL: String(""), + SHA: Ptr(""), + Path: Ptr(""), + Mode: Ptr(""), + Type: Ptr(""), + Size: Ptr(0), + Content: Ptr(""), + URL: Ptr(""), } want := `github.TreeEntry{SHA:"", Path:"", Mode:"", Type:"", Size:0, Content:"", URL:""}` if got := v.String(); got != want { @@ -2075,48 +2073,48 @@ func TestTreeEntry_String(t *testing.T) { func TestUser_String(t *testing.T) { t.Parallel() v := User{ - Login: String(""), - ID: Int64(0), - NodeID: String(""), - AvatarURL: String(""), - HTMLURL: String(""), - GravatarID: String(""), - Name: String(""), - Company: String(""), - Blog: String(""), - Location: String(""), - Email: String(""), - Hireable: Bool(false), - Bio: String(""), - TwitterUsername: String(""), - PublicRepos: Int(0), - PublicGists: Int(0), - Followers: Int(0), - Following: Int(0), + Login: Ptr(""), + ID: Ptr(int64(0)), + NodeID: Ptr(""), + AvatarURL: Ptr(""), + HTMLURL: Ptr(""), + GravatarID: Ptr(""), + Name: Ptr(""), + Company: Ptr(""), + Blog: Ptr(""), + Location: Ptr(""), + Email: Ptr(""), + Hireable: Ptr(false), + Bio: Ptr(""), + TwitterUsername: Ptr(""), + PublicRepos: Ptr(0), + PublicGists: Ptr(0), + Followers: Ptr(0), + Following: Ptr(0), CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, SuspendedAt: &Timestamp{}, - Type: String(""), - SiteAdmin: Bool(false), - TotalPrivateRepos: Int64(0), - OwnedPrivateRepos: Int64(0), - PrivateGists: Int(0), - DiskUsage: Int(0), - Collaborators: Int(0), - TwoFactorAuthentication: Bool(false), + 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), Plan: &Plan{}, - LdapDn: String(""), - URL: String(""), - EventsURL: String(""), - FollowingURL: String(""), - FollowersURL: String(""), - GistsURL: String(""), - OrganizationsURL: String(""), - ReceivedEventsURL: String(""), - ReposURL: String(""), - StarredURL: String(""), - SubscriptionsURL: String(""), - RoleName: String(""), + LdapDn: Ptr(""), + URL: Ptr(""), + EventsURL: Ptr(""), + FollowingURL: Ptr(""), + FollowersURL: Ptr(""), + GistsURL: Ptr(""), + OrganizationsURL: Ptr(""), + ReceivedEventsURL: Ptr(""), + ReposURL: Ptr(""), + StarredURL: Ptr(""), + SubscriptionsURL: Ptr(""), + RoleName: Ptr(""), } want := `github.User{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", 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{}, LdapDn:"", URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:"", RoleName:""}` if got := v.String(); got != want { @@ -2127,23 +2125,23 @@ func TestUser_String(t *testing.T) { func TestUserLDAPMapping_String(t *testing.T) { t.Parallel() v := UserLDAPMapping{ - ID: Int64(0), - LDAPDN: String(""), - Login: String(""), - AvatarURL: String(""), - GravatarID: String(""), - Type: String(""), - SiteAdmin: Bool(false), - URL: String(""), - EventsURL: String(""), - FollowingURL: String(""), - FollowersURL: String(""), - GistsURL: String(""), - OrganizationsURL: String(""), - ReceivedEventsURL: String(""), - ReposURL: String(""), - StarredURL: String(""), - SubscriptionsURL: String(""), + 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(""), } 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 { @@ -2154,14 +2152,14 @@ func TestUserLDAPMapping_String(t *testing.T) { func TestUserMigration_String(t *testing.T) { t.Parallel() v := UserMigration{ - ID: Int64(0), - GUID: String(""), - State: String(""), - LockRepositories: Bool(false), - ExcludeAttachments: Bool(false), - URL: String(""), - CreatedAt: String(""), - UpdatedAt: String(""), + ID: Ptr(int64(0)), + GUID: Ptr(""), + State: Ptr(""), + LockRepositories: Ptr(false), + ExcludeAttachments: Ptr(false), + URL: Ptr(""), + CreatedAt: Ptr(""), + UpdatedAt: Ptr(""), } want := `github.UserMigration{ID:0, GUID:"", State:"", LockRepositories:false, ExcludeAttachments:false, URL:"", CreatedAt:"", UpdatedAt:""}` if got := v.String(); got != want { @@ -2172,9 +2170,9 @@ func TestUserMigration_String(t *testing.T) { func TestUserStats_String(t *testing.T) { t.Parallel() v := UserStats{ - TotalUsers: Int(0), - AdminUsers: Int(0), - SuspendedUsers: Int(0), + TotalUsers: Ptr(0), + AdminUsers: Ptr(0), + SuspendedUsers: Ptr(0), } want := `github.UserStats{TotalUsers:0, AdminUsers:0, SuspendedUsers:0}` if got := v.String(); got != want { @@ -2186,7 +2184,7 @@ func TestWeeklyCommitActivity_String(t *testing.T) { t.Parallel() v := WeeklyCommitActivity{ Days: []int{0}, - Total: Int(0), + Total: Ptr(0), Week: &Timestamp{}, } want := `github.WeeklyCommitActivity{Days:[0], Total:0, Week:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` @@ -2199,9 +2197,9 @@ func TestWeeklyStats_String(t *testing.T) { t.Parallel() v := WeeklyStats{ Week: &Timestamp{}, - Additions: Int(0), - Deletions: Int(0), - Commits: Int(0), + Additions: Ptr(0), + Deletions: Ptr(0), + Commits: Ptr(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 { diff --git a/github/github.go b/github/github.go index ecbffe054ca..4afad046a23 100644 --- a/github/github.go +++ b/github/github.go @@ -1587,22 +1587,26 @@ func Ptr[T any](v T) *T { // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. -// Ptr can be used instead. +// +// Deprecated: use Ptr instead. func Bool(v bool) *bool { return &v } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. -// Ptr can be used instead. +// +// Deprecated: use Ptr instead. func Int(v int) *int { return &v } // Int64 is a helper routine that allocates a new int64 value // to store v and returns a pointer to it. -// Ptr can be used instead. +// +// Deprecated: use Ptr instead. func Int64(v int64) *int64 { return &v } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. -// Ptr can be used instead. +// +// Deprecated: use Ptr instead. func String(v string) *string { return &v } // roundTripperFunc creates a RoundTripper (transport). diff --git a/github/github_test.go b/github/github_test.go index 695d188ab7e..3e59d617ae5 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -506,7 +506,7 @@ func TestNewRequest(t *testing.T) { c := NewClient(nil) inURL, outURL := "/foo", defaultBaseURL+"foo" - inBody, outBody := &User{Login: String("l")}, `{"login":"l"}`+"\n" + inBody, outBody := &User{Login: Ptr("l")}, `{"login":"l"}`+"\n" req, _ := c.NewRequest("GET", inURL, inBody) // test that relative URL was expanded diff --git a/github/gitignore_test.go b/github/gitignore_test.go index 25e6f4ea9eb..43b9ea86531 100644 --- a/github/gitignore_test.go +++ b/github/gitignore_test.go @@ -59,7 +59,7 @@ func TestGitignoresService_Get(t *testing.T) { t.Errorf("Gitignores.List returned error: %v", err) } - want := &Gitignore{Name: String("Name"), Source: String("template source")} + want := &Gitignore{Name: Ptr("Name"), Source: Ptr("template source")} if !cmp.Equal(gitignore, want) { t.Errorf("Gitignores.Get returned %+v, want %+v", gitignore, want) } @@ -93,8 +93,8 @@ func TestGitignore_Marshal(t *testing.T) { testJSONMarshal(t, &Gitignore{}, "{}") u := &Gitignore{ - Name: String("name"), - Source: String("source"), + Name: Ptr("name"), + Source: Ptr("source"), } want := `{ diff --git a/github/interactions_orgs.go b/github/interactions_orgs.go index f0ba0b15f04..47998c4eefb 100644 --- a/github/interactions_orgs.go +++ b/github/interactions_orgs.go @@ -47,7 +47,7 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - interaction := &InteractionRestriction{Limit: String(limit)} + interaction := &InteractionRestriction{Limit: Ptr(limit)} req, err := s.client.NewRequest("PUT", u, interaction) if err != nil { diff --git a/github/interactions_orgs_test.go b/github/interactions_orgs_test.go index b0521dee6cc..d482cb6cea9 100644 --- a/github/interactions_orgs_test.go +++ b/github/interactions_orgs_test.go @@ -31,7 +31,7 @@ func TestInteractionsService_GetRestrictionsForOrgs(t *testing.T) { t.Errorf("Interactions.GetRestrictionsForOrg returned error: %v", err) } - want := &InteractionRestriction{Origin: String("organization")} + want := &InteractionRestriction{Origin: Ptr("organization")} if !cmp.Equal(organizationInteractions, want) { t.Errorf("Interactions.GetRestrictionsForOrg returned %+v, want %+v", organizationInteractions, want) } @@ -55,7 +55,7 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &InteractionRestriction{Limit: String("existing_users")} + input := &InteractionRestriction{Limit: Ptr("existing_users")} mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) { v := new(InteractionRestriction) @@ -75,7 +75,7 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) { t.Errorf("Interactions.UpdateRestrictionsForOrg returned error: %v", err) } - want := &InteractionRestriction{Origin: String("organization")} + want := &InteractionRestriction{Origin: Ptr("organization")} if !cmp.Equal(organizationInteractions, want) { t.Errorf("Interactions.UpdateRestrictionsForOrg returned %+v, want %+v", organizationInteractions, want) } diff --git a/github/interactions_repos.go b/github/interactions_repos.go index 9c044badd19..58fd4f04f30 100644 --- a/github/interactions_repos.go +++ b/github/interactions_repos.go @@ -47,7 +47,7 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - interaction := &InteractionRestriction{Limit: String(limit)} + interaction := &InteractionRestriction{Limit: Ptr(limit)} req, err := s.client.NewRequest("PUT", u, interaction) if err != nil { diff --git a/github/interactions_repos_test.go b/github/interactions_repos_test.go index 51093e57bcb..6107986b93a 100644 --- a/github/interactions_repos_test.go +++ b/github/interactions_repos_test.go @@ -31,7 +31,7 @@ func TestInteractionsService_GetRestrictionsForRepo(t *testing.T) { t.Errorf("Interactions.GetRestrictionsForRepo returned error: %v", err) } - want := &InteractionRestriction{Origin: String("repository")} + want := &InteractionRestriction{Origin: Ptr("repository")} if !cmp.Equal(repoInteractions, want) { t.Errorf("Interactions.GetRestrictionsForRepo returned %+v, want %+v", repoInteractions, want) } @@ -55,7 +55,7 @@ func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &InteractionRestriction{Limit: String("existing_users")} + input := &InteractionRestriction{Limit: Ptr("existing_users")} mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) { v := new(InteractionRestriction) @@ -75,7 +75,7 @@ func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) { t.Errorf("Interactions.UpdateRestrictionsForRepo returned error: %v", err) } - want := &InteractionRestriction{Origin: String("repository")} + want := &InteractionRestriction{Origin: Ptr("repository")} if !cmp.Equal(repoInteractions, want) { t.Errorf("Interactions.UpdateRestrictionsForRepo returned %+v, want %+v", repoInteractions, want) } diff --git a/github/interactions_test.go b/github/interactions_test.go index ac2d0e31649..c52f32c9e32 100644 --- a/github/interactions_test.go +++ b/github/interactions_test.go @@ -12,8 +12,8 @@ func TestInteractionRestriction_Marshal(t *testing.T) { testJSONMarshal(t, &InteractionRestriction{}, "{}") u := &InteractionRestriction{ - Limit: String("limit"), - Origin: String("origin"), + Limit: Ptr("limit"), + Origin: Ptr("origin"), ExpiresAt: &Timestamp{referenceTime}, } diff --git a/github/issue_import_test.go b/github/issue_import_test.go index cf925ac2b1c..fd081d0d233 100644 --- a/github/issue_import_test.go +++ b/github/issue_import_test.go @@ -23,11 +23,11 @@ func TestIssueImportService_Create(t *testing.T) { createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC) input := &IssueImportRequest{ IssueImport: IssueImport{ - Assignee: String("developer"), + Assignee: Ptr("developer"), Body: "Dummy description", CreatedAt: &Timestamp{createdAt}, Labels: []string{"l1", "l2"}, - Milestone: Int(1), + Milestone: Ptr(1), Title: "Dummy Issue", }, Comments: []*Comment{{ @@ -81,11 +81,11 @@ func TestIssueImportService_Create_deferred(t *testing.T) { createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC) input := &IssueImportRequest{ IssueImport: IssueImport{ - Assignee: String("developer"), + Assignee: Ptr("developer"), Body: "Dummy description", CreatedAt: &Timestamp{createdAt}, Labels: []string{"l1", "l2"}, - Milestone: Int(1), + Milestone: Ptr(1), Title: "Dummy Issue", }, Comments: []*Comment{{ @@ -127,11 +127,11 @@ func TestIssueImportService_Create_badResponse(t *testing.T) { createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC) input := &IssueImportRequest{ IssueImport: IssueImport{ - Assignee: String("developer"), + Assignee: Ptr("developer"), Body: "Dummy description", CreatedAt: &Timestamp{createdAt}, Labels: []string{"l1", "l2"}, - Milestone: Int(1), + Milestone: Ptr(1), Title: "Dummy Issue", }, Comments: []*Comment{{ @@ -288,11 +288,11 @@ var issueImportResponseJSON = []byte(`{ }`) var wantIssueImportResponse = &IssueImportResponse{ - ID: Int(3), - Status: String("pending"), - URL: String("https://api.github.com/repos/o/r/import/issues/3"), - ImportIssuesURL: String("https://api.github.com/repos/o/r/import/issues"), - RepositoryURL: String("https://api.github.com/repos/o/r"), + 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"), } func TestIssueImportError_Marshal(t *testing.T) { @@ -300,11 +300,11 @@ func TestIssueImportError_Marshal(t *testing.T) { testJSONMarshal(t, &IssueImportError{}, "{}") u := &IssueImportError{ - Location: String("loc"), - Resource: String("res"), - Field: String("field"), - Value: String("value"), - Code: String("code"), + Location: Ptr("loc"), + Resource: Ptr("res"), + Field: Ptr("field"), + Value: Ptr("value"), + Code: Ptr("code"), } want := `{ @@ -323,22 +323,22 @@ func TestIssueImportResponse_Marshal(t *testing.T) { testJSONMarshal(t, &IssueImportResponse{}, "{}") u := &IssueImportResponse{ - ID: Int(1), - Status: String("status"), - URL: String("url"), - ImportIssuesURL: String("iiu"), - RepositoryURL: String("ru"), + ID: Ptr(1), + Status: Ptr("status"), + URL: Ptr("url"), + ImportIssuesURL: Ptr("iiu"), + RepositoryURL: Ptr("ru"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Message: String("msg"), - DocumentationURL: String("durl"), + Message: Ptr("msg"), + DocumentationURL: Ptr("durl"), Errors: []*IssueImportError{ { - Location: String("loc"), - Resource: String("res"), - Field: String("field"), - Value: String("value"), - Code: String("code"), + Location: Ptr("loc"), + Resource: Ptr("res"), + Field: Ptr("field"), + Value: Ptr("value"), + Code: Ptr("code"), }, }, } @@ -394,9 +394,9 @@ func TestIssueImport_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, ClosedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Assignee: String("a"), - Milestone: Int(1), - Closed: Bool(false), + Assignee: Ptr("a"), + Milestone: Ptr(1), + Closed: Ptr(false), Labels: []string{"l"}, } @@ -428,9 +428,9 @@ func TestIssueImportRequest_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, ClosedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Assignee: String("a"), - Milestone: Int(1), - Closed: Bool(false), + Assignee: Ptr("a"), + Milestone: Ptr(1), + Closed: Ptr(false), Labels: []string{"l"}, }, Comments: []*Comment{ diff --git a/github/issues_assignees_test.go b/github/issues_assignees_test.go index 183624eabc6..88f0e0e42b3 100644 --- a/github/issues_assignees_test.go +++ b/github/issues_assignees_test.go @@ -32,7 +32,7 @@ func TestIssuesService_ListAssignees(t *testing.T) { t.Errorf("Issues.ListAssignees returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(assignees, want) { t.Errorf("Issues.ListAssignees returned %+v, want %+v", assignees, want) } @@ -192,7 +192,7 @@ func TestIssuesService_AddAssignees(t *testing.T) { t.Errorf("Issues.AddAssignees returned error: %v", err) } - want := &Issue{Number: Int(1), Assignees: []*User{{Login: String("user1")}, {Login: String("user2")}}} + want := &Issue{Number: Ptr(1), Assignees: []*User{{Login: Ptr("user1")}, {Login: Ptr("user2")}}} if !cmp.Equal(got, want) { t.Errorf("Issues.AddAssignees = %+v, want %+v", got, want) } @@ -236,7 +236,7 @@ func TestIssuesService_RemoveAssignees(t *testing.T) { t.Errorf("Issues.RemoveAssignees returned error: %v", err) } - want := &Issue{Number: Int(1), Assignees: []*User{}} + want := &Issue{Number: Ptr(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 03fe4c37e71..aa9ed2b1146 100644 --- a/github/issues_comments_test.go +++ b/github/issues_comments_test.go @@ -34,8 +34,8 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) { since := time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC) opt := &IssueListCommentsOptions{ - Sort: String("updated"), - Direction: String("desc"), + Sort: Ptr("updated"), + Direction: Ptr("desc"), Since: &since, ListOptions: ListOptions{Page: 2}, } @@ -45,7 +45,7 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) { t.Errorf("Issues.ListComments returned error: %v", err) } - want := []*IssueComment{{ID: Int64(1)}} + want := []*IssueComment{{ID: Ptr(int64(1))}} if !cmp.Equal(comments, want) { t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want) } @@ -81,7 +81,7 @@ func TestIssuesService_ListComments_specificIssue(t *testing.T) { t.Errorf("Issues.ListComments returned error: %v", err) } - want := []*IssueComment{{ID: Int64(1)}} + want := []*IssueComment{{ID: Ptr(int64(1))}} if !cmp.Equal(comments, want) { t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want) } @@ -126,7 +126,7 @@ func TestIssuesService_GetComment(t *testing.T) { t.Errorf("Issues.GetComment returned error: %v", err) } - want := &IssueComment{ID: Int64(1)} + want := &IssueComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Issues.GetComment returned %+v, want %+v", comment, want) } @@ -159,7 +159,7 @@ func TestIssuesService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &IssueComment{Body: String("b")} + input := &IssueComment{Body: Ptr("b")} mux.HandleFunc("/repos/o/r/issues/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(IssueComment) @@ -179,7 +179,7 @@ func TestIssuesService_CreateComment(t *testing.T) { t.Errorf("Issues.CreateComment returned error: %v", err) } - want := &IssueComment{ID: Int64(1)} + want := &IssueComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Issues.CreateComment returned %+v, want %+v", comment, want) } @@ -212,7 +212,7 @@ func TestIssuesService_EditComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &IssueComment{Body: String("b")} + input := &IssueComment{Body: Ptr("b")} mux.HandleFunc("/repos/o/r/issues/comments/1", func(w http.ResponseWriter, r *http.Request) { v := new(IssueComment) @@ -232,7 +232,7 @@ func TestIssuesService_EditComment(t *testing.T) { t.Errorf("Issues.EditComment returned error: %v", err) } - want := &IssueComment{ID: Int64(1)} + want := &IssueComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Issues.EditComment returned %+v, want %+v", comment, want) } @@ -300,36 +300,36 @@ func TestIssueComment_Marshal(t *testing.T) { testJSONMarshal(t, &IssueComment{}, "{}") u := &IssueComment{ - ID: Int64(1), - NodeID: String("nid"), - Body: String("body"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + Body: Ptr("body"), User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Reactions: &Reactions{TotalCount: Int(1)}, + Reactions: &Reactions{TotalCount: Ptr(1)}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - AuthorAssociation: String("aa"), - URL: String("url"), - HTMLURL: String("hurl"), - IssueURL: String("iurl"), + AuthorAssociation: Ptr("aa"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + IssueURL: Ptr("iurl"), } want := `{ diff --git a/github/issues_events_test.go b/github/issues_events_test.go index 89152d70faa..6e4a9685af2 100644 --- a/github/issues_events_test.go +++ b/github/issues_events_test.go @@ -35,7 +35,7 @@ func TestIssuesService_ListIssueEvents(t *testing.T) { t.Errorf("Issues.ListIssueEvents returned error: %v", err) } - want := []*IssueEvent{{ID: Int64(1)}} + want := []*IssueEvent{{ID: Ptr(int64(1))}} if !cmp.Equal(events, want) { t.Errorf("Issues.ListIssueEvents returned %+v, want %+v", events, want) } @@ -75,7 +75,7 @@ func TestIssuesService_ListRepositoryEvents(t *testing.T) { t.Errorf("Issues.ListRepositoryEvents returned error: %v", err) } - want := []*IssueEvent{{ID: Int64(1)}} + want := []*IssueEvent{{ID: Ptr(int64(1))}} if !cmp.Equal(events, want) { t.Errorf("Issues.ListRepositoryEvents returned %+v, want %+v", events, want) } @@ -110,7 +110,7 @@ func TestIssuesService_GetEvent(t *testing.T) { t.Errorf("Issues.GetEvent returned error: %v", err) } - want := &IssueEvent{ID: Int64(1)} + want := &IssueEvent{ID: Ptr(int64(1))} if !cmp.Equal(event, want) { t.Errorf("Issues.GetEvent returned %+v, want %+v", event, want) } @@ -135,8 +135,8 @@ func TestRename_Marshal(t *testing.T) { testJSONMarshal(t, &Rename{}, "{}") u := &Rename{ - From: String("from"), - To: String("to"), + From: Ptr("from"), + To: Ptr("to"), } want := `{ @@ -152,10 +152,10 @@ func TestDismissedReview_Marshal(t *testing.T) { testJSONMarshal(t, &DismissedReview{}, "{}") u := &DismissedReview{ - State: String("state"), - ReviewID: Int64(1), - DismissalMessage: String("dm"), - DismissalCommitID: String("dcid"), + State: Ptr("state"), + ReviewID: Ptr(int64(1)), + DismissalMessage: Ptr("dm"), + DismissalCommitID: Ptr("dcid"), } want := `{ @@ -173,179 +173,179 @@ func TestIssueEvent_Marshal(t *testing.T) { testJSONMarshal(t, &IssueEvent{}, "{}") u := &IssueEvent{ - ID: Int64(1), - URL: String("url"), + ID: Ptr(int64(1)), + URL: Ptr("url"), Actor: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Event: String("event"), + Event: Ptr("event"), CreatedAt: &Timestamp{referenceTime}, - Issue: &Issue{ID: Int64(1)}, + Issue: &Issue{ID: Ptr(int64(1))}, Assignee: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, Assigner: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - CommitID: String("cid"), - Milestone: &Milestone{ID: Int64(1)}, - Label: &Label{ID: Int64(1)}, + CommitID: Ptr("cid"), + Milestone: &Milestone{ID: Ptr(int64(1))}, + Label: &Label{ID: Ptr(int64(1))}, Rename: &Rename{ - From: String("from"), - To: String("to"), + From: Ptr("from"), + To: Ptr("to"), }, - LockReason: String("lr"), - ProjectCard: &ProjectCard{ID: Int64(1)}, + LockReason: Ptr("lr"), + ProjectCard: &ProjectCard{ID: Ptr(int64(1))}, DismissedReview: &DismissedReview{ - State: String("state"), - ReviewID: Int64(1), - DismissalMessage: String("dm"), - DismissalCommitID: String("dcid"), + State: Ptr("state"), + ReviewID: Ptr(int64(1)), + DismissalMessage: Ptr("dm"), + DismissalCommitID: Ptr("dcid"), }, RequestedReviewer: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, RequestedTeam: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - MembersURL: String("m"), - RepositoriesURL: String("r"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + MembersURL: Ptr("m"), + RepositoriesURL: Ptr("r"), Organization: &Organization{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - HTMLURL: String("h"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), + 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"), }, Parent: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), }, - LDAPDN: String("l"), + LDAPDN: Ptr("l"), }, PerformedViaGithubApp: &App{ - ID: Int64(1), - NodeID: String("n"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Name: String("n"), - Description: String("d"), - HTMLURL: String("h"), - ExternalURL: String("u"), + Name: Ptr("n"), + Description: Ptr("d"), + HTMLURL: Ptr("h"), + ExternalURL: Ptr("u"), }, ReviewRequester: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, diff --git a/github/issues_labels_test.go b/github/issues_labels_test.go index 81b483e2a92..fd14153b6ab 100644 --- a/github/issues_labels_test.go +++ b/github/issues_labels_test.go @@ -32,7 +32,7 @@ func TestIssuesService_ListLabels(t *testing.T) { t.Errorf("Issues.ListLabels returned error: %v", err) } - want := []*Label{{Name: String("a")}, {Name: String("b")}} + want := []*Label{{Name: Ptr("a")}, {Name: Ptr("b")}} if !cmp.Equal(labels, want) { t.Errorf("Issues.ListLabels returned %+v, want %+v", labels, want) } @@ -76,7 +76,7 @@ func TestIssuesService_GetLabel(t *testing.T) { t.Errorf("Issues.GetLabel returned error: %v", err) } - want := &Label{URL: String("u"), Name: String("n"), Color: String("c"), Description: String("d")} + want := &Label{URL: Ptr("u"), Name: Ptr("n"), Color: Ptr("c"), Description: Ptr("d")} if !cmp.Equal(label, want) { t.Errorf("Issues.GetLabel returned %+v, want %+v", label, want) } @@ -109,7 +109,7 @@ func TestIssuesService_CreateLabel(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Label{Name: String("n")} + input := &Label{Name: Ptr("n")} mux.HandleFunc("/repos/o/r/labels", func(w http.ResponseWriter, r *http.Request) { v := new(Label) @@ -129,7 +129,7 @@ func TestIssuesService_CreateLabel(t *testing.T) { t.Errorf("Issues.CreateLabel returned error: %v", err) } - want := &Label{URL: String("u")} + want := &Label{URL: Ptr("u")} if !cmp.Equal(label, want) { t.Errorf("Issues.CreateLabel returned %+v, want %+v", label, want) } @@ -162,7 +162,7 @@ func TestIssuesService_EditLabel(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Label{Name: String("z")} + input := &Label{Name: Ptr("z")} mux.HandleFunc("/repos/o/r/labels/n", func(w http.ResponseWriter, r *http.Request) { v := new(Label) @@ -182,7 +182,7 @@ func TestIssuesService_EditLabel(t *testing.T) { t.Errorf("Issues.EditLabel returned error: %v", err) } - want := &Label{URL: String("u")} + want := &Label{URL: Ptr("u")} if !cmp.Equal(label, want) { t.Errorf("Issues.EditLabel returned %+v, want %+v", label, want) } @@ -263,8 +263,8 @@ func TestIssuesService_ListLabelsByIssue(t *testing.T) { } want := []*Label{ - {Name: String("a"), ID: Int64(1)}, - {Name: String("b"), ID: Int64(2)}, + {Name: Ptr("a"), ID: Ptr(int64(1))}, + {Name: Ptr("b"), ID: Ptr(int64(2))}, } if !cmp.Equal(labels, want) { t.Errorf("Issues.ListLabelsByIssue returned %+v, want %+v", labels, want) @@ -318,7 +318,7 @@ func TestIssuesService_AddLabelsToIssue(t *testing.T) { t.Errorf("Issues.AddLabelsToIssue returned error: %v", err) } - want := []*Label{{URL: String("u")}} + want := []*Label{{URL: Ptr("u")}} if !cmp.Equal(labels, want) { t.Errorf("Issues.AddLabelsToIssue returned %+v, want %+v", labels, want) } @@ -405,7 +405,7 @@ func TestIssuesService_ReplaceLabelsForIssue(t *testing.T) { t.Errorf("Issues.ReplaceLabelsForIssue returned error: %v", err) } - want := []*Label{{URL: String("u")}} + want := []*Label{{URL: Ptr("u")}} if !cmp.Equal(labels, want) { t.Errorf("Issues.ReplaceLabelsForIssue returned %+v, want %+v", labels, want) } @@ -485,7 +485,7 @@ func TestIssuesService_ListLabelsForMilestone(t *testing.T) { t.Errorf("Issues.ListLabelsForMilestone returned error: %v", err) } - want := []*Label{{Name: String("a")}, {Name: String("b")}} + want := []*Label{{Name: Ptr("a")}, {Name: Ptr("b")}} if !cmp.Equal(labels, want) { t.Errorf("Issues.ListLabelsForMilestone returned %+v, want %+v", labels, want) } @@ -519,13 +519,13 @@ func TestLabel_Marshal(t *testing.T) { testJSONMarshal(t, &Label{}, "{}") u := &Label{ - ID: Int64(1), - URL: String("url"), - Name: String("name"), - Color: String("color"), - Description: String("desc"), - Default: Bool(false), - NodeID: String("nid"), + ID: Ptr(int64(1)), + URL: Ptr("url"), + Name: Ptr("name"), + Color: Ptr("color"), + Description: Ptr("desc"), + Default: Ptr(false), + NodeID: Ptr("nid"), } want := `{ diff --git a/github/issues_milestones_test.go b/github/issues_milestones_test.go index 4444dd63fa2..8b6e17e4ea7 100644 --- a/github/issues_milestones_test.go +++ b/github/issues_milestones_test.go @@ -37,7 +37,7 @@ func TestIssuesService_ListMilestones(t *testing.T) { t.Errorf("IssuesService.ListMilestones returned error: %v", err) } - want := []*Milestone{{Number: Int(1)}} + want := []*Milestone{{Number: Ptr(1)}} if !cmp.Equal(milestones, want) { t.Errorf("IssuesService.ListMilestones returned %+v, want %+v", milestones, want) } @@ -81,7 +81,7 @@ func TestIssuesService_GetMilestone(t *testing.T) { t.Errorf("IssuesService.GetMilestone returned error: %v", err) } - want := &Milestone{Number: Int(1)} + want := &Milestone{Number: Ptr(1)} if !cmp.Equal(milestone, want) { t.Errorf("IssuesService.GetMilestone returned %+v, want %+v", milestone, want) } @@ -114,7 +114,7 @@ func TestIssuesService_CreateMilestone(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Milestone{Title: String("t")} + input := &Milestone{Title: Ptr("t")} mux.HandleFunc("/repos/o/r/milestones", func(w http.ResponseWriter, r *http.Request) { v := new(Milestone) @@ -134,7 +134,7 @@ func TestIssuesService_CreateMilestone(t *testing.T) { t.Errorf("IssuesService.CreateMilestone returned error: %v", err) } - want := &Milestone{Number: Int(1)} + want := &Milestone{Number: Ptr(1)} if !cmp.Equal(milestone, want) { t.Errorf("IssuesService.CreateMilestone returned %+v, want %+v", milestone, want) } @@ -167,7 +167,7 @@ func TestIssuesService_EditMilestone(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Milestone{Title: String("t")} + input := &Milestone{Title: Ptr("t")} mux.HandleFunc("/repos/o/r/milestones/1", func(w http.ResponseWriter, r *http.Request) { v := new(Milestone) @@ -187,7 +187,7 @@ func TestIssuesService_EditMilestone(t *testing.T) { t.Errorf("IssuesService.EditMilestone returned error: %v", err) } - want := &Milestone{Number: Int(1)} + want := &Milestone{Number: Ptr(1)} if !cmp.Equal(milestone, want) { t.Errorf("IssuesService.EditMilestone returned %+v, want %+v", milestone, want) } @@ -255,41 +255,41 @@ func TestMilestone_Marshal(t *testing.T) { testJSONMarshal(t, &Milestone{}, "{}") u := &Milestone{ - URL: String("url"), - HTMLURL: String("hurl"), - LabelsURL: String("lurl"), - ID: Int64(1), - Number: Int(1), - State: String("state"), - Title: String("title"), - Description: String("desc"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + LabelsURL: Ptr("lurl"), + ID: Ptr(int64(1)), + Number: Ptr(1), + State: Ptr("state"), + Title: Ptr("title"), + Description: Ptr("desc"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("tu"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("tu"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - OpenIssues: Int(1), - ClosedIssues: Int(1), + OpenIssues: Ptr(1), + ClosedIssues: Ptr(1), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, ClosedAt: &Timestamp{referenceTime}, DueOn: &Timestamp{referenceTime}, - NodeID: String("nid"), + NodeID: Ptr("nid"), } want := `{ diff --git a/github/issues_test.go b/github/issues_test.go index e4f0cace74a..4ac67981d40 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -47,7 +47,7 @@ func TestIssuesService_List_all(t *testing.T) { t.Errorf("Issues.List returned error: %v", err) } - want := []*Issue{{Number: Int(1)}} + want := []*Issue{{Number: Ptr(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.List returned %+v, want %+v", issues, want) } @@ -78,7 +78,7 @@ func TestIssuesService_List_owned(t *testing.T) { t.Errorf("Issues.List returned error: %v", err) } - want := []*Issue{{Number: Int(1)}} + want := []*Issue{{Number: Ptr(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.List returned %+v, want %+v", issues, want) } @@ -100,7 +100,7 @@ func TestIssuesService_ListByOrg(t *testing.T) { t.Errorf("Issues.ListByOrg returned error: %v", err) } - want := []*Issue{{Number: Int(1)}} + want := []*Issue{{Number: Ptr(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.List returned %+v, want %+v", issues, want) } @@ -170,7 +170,7 @@ func TestIssuesService_ListByRepo(t *testing.T) { t.Errorf("Issues.ListByOrg returned error: %v", err) } - want := []*Issue{{Number: Int(1)}} + want := []*Issue{{Number: Ptr(1)}} if !cmp.Equal(issues, want) { t.Errorf("Issues.List returned %+v, want %+v", issues, want) } @@ -216,12 +216,12 @@ func TestIssuesService_Get(t *testing.T) { } want := &Issue{ - Number: Int(1), - AuthorAssociation: String("MEMBER"), + Number: Ptr(1), + AuthorAssociation: Ptr("MEMBER"), Labels: []*Label{{ - URL: String("u"), - Name: String("n"), - Color: String("c"), + URL: Ptr("u"), + Name: Ptr("n"), + Color: Ptr("c"), }}, } if !cmp.Equal(issue, want) { @@ -257,9 +257,9 @@ func TestIssuesService_Create(t *testing.T) { client, mux, _ := setup(t) input := &IssueRequest{ - Title: String("t"), - Body: String("b"), - Assignee: String("a"), + Title: Ptr("t"), + Body: Ptr("b"), + Assignee: Ptr("a"), Labels: &[]string{"l1", "l2"}, } @@ -281,7 +281,7 @@ func TestIssuesService_Create(t *testing.T) { t.Errorf("Issues.Create returned error: %v", err) } - want := &Issue{Number: Int(1)} + want := &Issue{Number: Ptr(1)} if !cmp.Equal(issue, want) { t.Errorf("Issues.Create returned %+v, want %+v", issue, want) } @@ -314,7 +314,7 @@ func TestIssuesService_Edit(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &IssueRequest{Title: String("t")} + input := &IssueRequest{Title: Ptr("t")} mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) { v := new(IssueRequest) @@ -334,7 +334,7 @@ func TestIssuesService_Edit(t *testing.T) { t.Errorf("Issues.Edit returned error: %v", err) } - want := &Issue{Number: Int(1)} + want := &Issue{Number: Ptr(1)} if !cmp.Equal(issue, want) { t.Errorf("Issues.Edit returned %+v, want %+v", issue, want) } @@ -369,7 +369,7 @@ func TestIssuesService_RemoveMilestone(t *testing.T) { t.Errorf("Issues.RemoveMilestone returned error: %v", err) } - want := &Issue{Number: Int(1)} + want := &Issue{Number: Ptr(1)} if !cmp.Equal(issue, want) { t.Errorf("Issues.RemoveMilestone returned %+v, want %+v", issue, want) } @@ -473,7 +473,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: String("http://example.com")} + i.PullRequestLinks = &PullRequestLinks{URL: Ptr("http://example.com")} if !i.IsPullRequest() { t.Errorf("expected i.IsPullRequest (%v) to return true, got false", i) } @@ -499,10 +499,10 @@ func TestPullRequestLinks_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestLinks{}, "{}") u := &PullRequestLinks{ - URL: String("url"), - HTMLURL: String("hurl"), - DiffURL: String("durl"), - PatchURL: String("purl"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + DiffURL: Ptr("durl"), + PatchURL: Ptr("purl"), MergedAt: &Timestamp{referenceTime}, } @@ -522,12 +522,12 @@ func TestIssueRequest_Marshal(t *testing.T) { testJSONMarshal(t, &IssueRequest{}, "{}") u := &IssueRequest{ - Title: String("url"), - Body: String("url"), + Title: Ptr("url"), + Body: Ptr("url"), Labels: &[]string{"l"}, - Assignee: String("url"), - State: String("url"), - Milestone: Int(1), + Assignee: Ptr("url"), + State: Ptr("url"), + Milestone: Ptr(1), Assignees: &[]string{"a"}, } @@ -553,35 +553,35 @@ func TestIssue_Marshal(t *testing.T) { testJSONMarshal(t, &Issue{}, "{}") u := &Issue{ - ID: Int64(1), - Number: Int(1), - State: String("s"), - Locked: Bool(false), - Title: String("title"), - Body: String("body"), - AuthorAssociation: String("aa"), - User: &User{ID: Int64(1)}, - Labels: []*Label{{ID: Int64(1)}}, - Assignee: &User{ID: Int64(1)}, - Comments: Int(1), + ID: Ptr(int64(1)), + Number: Ptr(1), + State: Ptr("s"), + Locked: Ptr(false), + Title: Ptr("title"), + Body: Ptr("body"), + AuthorAssociation: Ptr("aa"), + User: &User{ID: Ptr(int64(1))}, + Labels: []*Label{{ID: Ptr(int64(1))}}, + Assignee: &User{ID: Ptr(int64(1))}, + Comments: Ptr(1), ClosedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - ClosedBy: &User{ID: Int64(1)}, - URL: String("url"), - HTMLURL: String("hurl"), - CommentsURL: String("curl"), - EventsURL: String("eurl"), - LabelsURL: String("lurl"), - RepositoryURL: String("rurl"), - Milestone: &Milestone{ID: Int64(1)}, - PullRequestLinks: &PullRequestLinks{URL: String("url")}, - Repository: &Repository{ID: Int64(1)}, - Reactions: &Reactions{TotalCount: Int(1)}, - Assignees: []*User{{ID: Int64(1)}}, - NodeID: String("nid"), - TextMatches: []*TextMatch{{ObjectURL: String("ourl")}}, - ActiveLockReason: String("alr"), + ClosedBy: &User{ID: Ptr(int64(1))}, + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + CommentsURL: Ptr("curl"), + EventsURL: Ptr("eurl"), + LabelsURL: Ptr("lurl"), + RepositoryURL: Ptr("rurl"), + Milestone: &Milestone{ID: Ptr(int64(1))}, + PullRequestLinks: &PullRequestLinks{URL: Ptr("url")}, + Repository: &Repository{ID: Ptr(int64(1))}, + Reactions: &Reactions{TotalCount: Ptr(1)}, + Assignees: []*User{{ID: Ptr(int64(1))}}, + NodeID: Ptr("nid"), + TextMatches: []*TextMatch{{ObjectURL: Ptr("ourl")}}, + ActiveLockReason: Ptr("alr"), } want := `{ diff --git a/github/issues_timeline_test.go b/github/issues_timeline_test.go index d89043f589a..b5b33c4c5e8 100644 --- a/github/issues_timeline_test.go +++ b/github/issues_timeline_test.go @@ -37,7 +37,7 @@ func TestIssuesService_ListIssueTimeline(t *testing.T) { t.Errorf("Issues.ListIssueTimeline returned error: %v", err) } - want := []*Timeline{{ID: Int64(1)}} + want := []*Timeline{{ID: Ptr(int64(1))}} if !cmp.Equal(events, want) { t.Errorf("Issues.ListIssueTimeline = %+v, want %+v", events, want) } @@ -62,19 +62,19 @@ func TestSource_Marshal(t *testing.T) { testJSONMarshal(t, &Source{}, "{}") u := &Source{ - ID: Int64(1), - URL: String("url"), + ID: Ptr(int64(1)), + URL: Ptr("url"), Actor: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Type: String("type"), - Issue: &Issue{ID: Int64(1)}, + Type: Ptr("type"), + Issue: &Issue{ID: Ptr(int64(1))}, } want := `{ @@ -103,75 +103,75 @@ func TestTimeline_Marshal(t *testing.T) { testJSONMarshal(t, &Timeline{}, "{}") u := &Timeline{ - ID: Int64(1), - URL: String("url"), - CommitURL: String("curl"), + ID: Ptr(int64(1)), + URL: Ptr("url"), + CommitURL: Ptr("curl"), Actor: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Event: String("event"), - CommitID: String("cid"), + Event: Ptr("event"), + CommitID: Ptr("cid"), CreatedAt: &Timestamp{referenceTime}, - Label: &Label{ID: Int64(1)}, + Label: &Label{ID: Ptr(int64(1))}, Assignee: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Milestone: &Milestone{ID: Int64(1)}, + Milestone: &Milestone{ID: Ptr(int64(1))}, Source: &Source{ - ID: Int64(1), - URL: String("url"), + ID: Ptr(int64(1)), + URL: Ptr("url"), Actor: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, - Type: String("type"), - Issue: &Issue{ID: Int64(1)}, + Type: Ptr("type"), + Issue: &Issue{ID: Ptr(int64(1))}, }, Rename: &Rename{ - From: String("from"), - To: String("to"), + From: Ptr("from"), + To: Ptr("to"), }, - ProjectCard: &ProjectCard{ID: Int64(1)}, - State: String("state"), + ProjectCard: &ProjectCard{ID: Ptr(int64(1))}, + State: Ptr("state"), } want := `{ diff --git a/github/licenses_test.go b/github/licenses_test.go index 1a9b1f2e882..51b37c48e69 100644 --- a/github/licenses_test.go +++ b/github/licenses_test.go @@ -19,30 +19,30 @@ func TestRepositoryLicense_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryLicense{}, "{}") rl := &RepositoryLicense{ - Name: String("n"), - Path: String("p"), - SHA: String("s"), - Size: Int(1), - URL: String("u"), - HTMLURL: String("h"), - GitURL: String("g"), - DownloadURL: String("d"), - Type: String("t"), - Content: String("c"), - Encoding: String("e"), + Name: Ptr("n"), + Path: Ptr("p"), + SHA: Ptr("s"), + Size: Ptr(1), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + GitURL: Ptr("g"), + DownloadURL: Ptr("d"), + Type: Ptr("t"), + Content: Ptr("c"), + Encoding: Ptr("e"), License: &License{ - Key: String("k"), - Name: String("n"), - URL: String("u"), - SPDXID: String("s"), - HTMLURL: String("h"), - Featured: Bool(true), - Description: String("d"), - Implementation: String("i"), + Key: Ptr("k"), + Name: Ptr("n"), + URL: Ptr("u"), + SPDXID: Ptr("s"), + HTMLURL: Ptr("h"), + Featured: Ptr(true), + Description: Ptr("d"), + Implementation: Ptr("i"), Permissions: &[]string{"p"}, Conditions: &[]string{"c"}, Limitations: &[]string{"l"}, - Body: String("b"), + Body: Ptr("b"), }, } want := `{ @@ -80,18 +80,18 @@ func TestLicense_Marshal(t *testing.T) { testJSONMarshal(t, &License{}, "{}") l := &License{ - Key: String("k"), - Name: String("n"), - URL: String("u"), - SPDXID: String("s"), - HTMLURL: String("h"), - Featured: Bool(true), - Description: String("d"), - Implementation: String("i"), + Key: Ptr("k"), + Name: Ptr("n"), + URL: Ptr("u"), + SPDXID: Ptr("s"), + HTMLURL: Ptr("h"), + Featured: Ptr(true), + Description: Ptr("d"), + Implementation: Ptr("i"), Permissions: &[]string{"p"}, Conditions: &[]string{"c"}, Limitations: &[]string{"l"}, - Body: String("b"), + Body: Ptr("b"), } want := `{ "key": "k", @@ -126,11 +126,11 @@ func TestLicensesService_List(t *testing.T) { } want := []*License{{ - Key: String("mit"), - Name: String("MIT"), - SPDXID: String("MIT"), - URL: String("https://api.github.com/licenses/mit"), - Featured: Bool(true), + Key: Ptr("mit"), + Name: Ptr("MIT"), + SPDXID: Ptr("MIT"), + URL: Ptr("https://api.github.com/licenses/mit"), + Featured: Ptr(true), }} if !cmp.Equal(licenses, want) { t.Errorf("Licenses.List returned %+v, want %+v", licenses, want) @@ -161,7 +161,7 @@ func TestLicensesService_Get(t *testing.T) { t.Errorf("Licenses.Get returned error: %v", err) } - want := &License{Key: String("mit"), Name: String("MIT")} + want := &License{Key: Ptr("mit"), Name: Ptr("MIT")} if !cmp.Equal(license, want) { t.Errorf("Licenses.Get returned %+v, want %+v", license, want) } diff --git a/github/markdown.go b/github/markdown.go index fe3b31128d5..0fd896c6c85 100644 --- a/github/markdown.go +++ b/github/markdown.go @@ -44,13 +44,13 @@ type markdownRenderRequest struct { // //meta:operation POST /markdown func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { - request := &markdownRenderRequest{Text: String(text)} + request := &markdownRenderRequest{Text: Ptr(text)} if opts != nil { if opts.Mode != "" { - request.Mode = String(opts.Mode) + request.Mode = Ptr(opts.Mode) } if opts.Context != "" { - request.Context = String(opts.Context) + request.Context = Ptr(opts.Context) } } diff --git a/github/markdown_test.go b/github/markdown_test.go index 3b8d842365f..d09fdd4aff9 100644 --- a/github/markdown_test.go +++ b/github/markdown_test.go @@ -20,9 +20,9 @@ func TestMarkdownService_Markdown(t *testing.T) { client, mux, _ := setup(t) input := &markdownRenderRequest{ - Text: String("# text #"), - Mode: String("gfm"), - Context: String("google/go-github"), + Text: Ptr("# text #"), + Mode: Ptr("gfm"), + Context: Ptr("google/go-github"), } mux.HandleFunc("/markdown", func(w http.ResponseWriter, r *http.Request) { v := new(markdownRenderRequest) @@ -66,9 +66,9 @@ func TestMarkdownRenderRequest_Marshal(t *testing.T) { testJSONMarshal(t, &markdownRenderRequest{}, "{}") a := &markdownRenderRequest{ - Text: String("txt"), - Mode: String("mode"), - Context: String("ctx"), + Text: Ptr("txt"), + Mode: Ptr("mode"), + Context: Ptr("ctx"), } want := `{ diff --git a/github/meta_test.go b/github/meta_test.go index bce606f2cf1..71eb2149328 100644 --- a/github/meta_test.go +++ b/github/meta_test.go @@ -21,7 +21,7 @@ func TestAPIMeta_Marshal(t *testing.T) { a := &APIMeta{ Hooks: []string{"h"}, Git: []string{"g"}, - VerifiablePasswordAuthentication: Bool(true), + VerifiablePasswordAuthentication: Ptr(true), Pages: []string{"p"}, Importer: []string{"i"}, GithubEnterpriseImporter: []string{"gei"}, @@ -113,7 +113,7 @@ func TestMetaService_Get(t *testing.T) { }, }, - VerifiablePasswordAuthentication: Bool(true), + VerifiablePasswordAuthentication: Ptr(true), } if !cmp.Equal(want, meta) { t.Errorf("Get returned %+v, want %+v", meta, want) diff --git a/github/migrations.go b/github/migrations.go index 5af8817050f..766c4c38e1c 100644 --- a/github/migrations.go +++ b/github/migrations.go @@ -82,8 +82,8 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos body := &startMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Bool(opts.LockRepositories) - body.ExcludeAttachments = Bool(opts.ExcludeAttachments) + body.LockRepositories = Ptr(opts.LockRepositories) + body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) } req, err := s.client.NewRequest("POST", u, body) diff --git a/github/migrations_source_import_test.go b/github/migrations_source_import_test.go index 98e68396da1..a79d1781053 100644 --- a/github/migrations_source_import_test.go +++ b/github/migrations_source_import_test.go @@ -20,10 +20,10 @@ func TestMigrationService_StartImport(t *testing.T) { client, mux, _ := setup(t) input := &Import{ - VCS: String("git"), - VCSURL: String("url"), - VCSUsername: String("u"), - VCSPassword: String("p"), + VCS: Ptr("git"), + VCSURL: Ptr("url"), + VCSUsername: Ptr("u"), + VCSPassword: Ptr("p"), } mux.HandleFunc("/repos/o/r/import", func(w http.ResponseWriter, r *http.Request) { @@ -44,7 +44,7 @@ func TestMigrationService_StartImport(t *testing.T) { if err != nil { t.Errorf("StartImport returned error: %v", err) } - want := &Import{Status: String("importing")} + want := &Import{Status: Ptr("importing")} if !cmp.Equal(got, want) { t.Errorf("StartImport = %+v, want %+v", got, want) } @@ -78,7 +78,7 @@ func TestMigrationService_ImportProgress(t *testing.T) { if err != nil { t.Errorf("ImportProgress returned error: %v", err) } - want := &Import{Status: String("complete")} + want := &Import{Status: Ptr("complete")} if !cmp.Equal(got, want) { t.Errorf("ImportProgress = %+v, want %+v", got, want) } @@ -103,10 +103,10 @@ func TestMigrationService_UpdateImport(t *testing.T) { client, mux, _ := setup(t) input := &Import{ - VCS: String("git"), - VCSURL: String("url"), - VCSUsername: String("u"), - VCSPassword: String("p"), + VCS: Ptr("git"), + VCSURL: Ptr("url"), + VCSUsername: Ptr("u"), + VCSPassword: Ptr("p"), } mux.HandleFunc("/repos/o/r/import", func(w http.ResponseWriter, r *http.Request) { @@ -127,7 +127,7 @@ func TestMigrationService_UpdateImport(t *testing.T) { if err != nil { t.Errorf("UpdateImport returned error: %v", err) } - want := &Import{Status: String("importing")} + want := &Import{Status: Ptr("importing")} if !cmp.Equal(got, want) { t.Errorf("UpdateImport = %+v, want %+v", got, want) } @@ -162,8 +162,8 @@ func TestMigrationService_CommitAuthors(t *testing.T) { t.Errorf("CommitAuthors returned error: %v", err) } want := []*SourceImportAuthor{ - {ID: Int64(1), Name: String("a")}, - {ID: Int64(2), Name: String("b")}, + {ID: Ptr(int64(1)), Name: Ptr("a")}, + {ID: Ptr(int64(2)), Name: Ptr("b")}, } if !cmp.Equal(got, want) { t.Errorf("CommitAuthors = %+v, want %+v", got, want) @@ -188,7 +188,7 @@ func TestMigrationService_MapCommitAuthor(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &SourceImportAuthor{Name: String("n"), Email: String("e")} + input := &SourceImportAuthor{Name: Ptr("n"), Email: Ptr("e")} mux.HandleFunc("/repos/o/r/import/authors/1", func(w http.ResponseWriter, r *http.Request) { v := new(SourceImportAuthor) @@ -207,7 +207,7 @@ func TestMigrationService_MapCommitAuthor(t *testing.T) { if err != nil { t.Errorf("MapCommitAuthor returned error: %v", err) } - want := &SourceImportAuthor{ID: Int64(1)} + want := &SourceImportAuthor{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("MapCommitAuthor = %+v, want %+v", got, want) } @@ -231,7 +231,7 @@ func TestMigrationService_SetLFSPreference(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Import{UseLFS: String("opt_in")} + input := &Import{UseLFS: Ptr("opt_in")} mux.HandleFunc("/repos/o/r/import/lfs", func(w http.ResponseWriter, r *http.Request) { v := new(Import) @@ -251,7 +251,7 @@ func TestMigrationService_SetLFSPreference(t *testing.T) { if err != nil { t.Errorf("SetLFSPreference returned error: %v", err) } - want := &Import{Status: String("importing")} + want := &Import{Status: Ptr("importing")} if !cmp.Equal(got, want) { t.Errorf("SetLFSPreference = %+v, want %+v", got, want) } @@ -286,8 +286,8 @@ func TestMigrationService_LargeFiles(t *testing.T) { t.Errorf("LargeFiles returned error: %v", err) } want := []*LargeFile{ - {OID: String("a")}, - {OID: String("b")}, + {OID: Ptr("a")}, + {OID: Ptr("b")}, } if !cmp.Equal(got, want) { t.Errorf("LargeFiles = %+v, want %+v", got, want) @@ -339,10 +339,10 @@ func TestLargeFile_Marshal(t *testing.T) { testJSONMarshal(t, &LargeFile{}, "{}") u := &LargeFile{ - RefName: String("rn"), - Path: String("p"), - OID: String("oid"), - Size: Int(1), + RefName: Ptr("rn"), + Path: Ptr("p"), + OID: Ptr("oid"), + Size: Ptr(1), } want := `{ @@ -360,13 +360,13 @@ func TestSourceImportAuthor_Marshal(t *testing.T) { testJSONMarshal(t, &SourceImportAuthor{}, "{}") u := &SourceImportAuthor{ - ID: Int64(1), - RemoteID: String("rid"), - RemoteName: String("rn"), - Email: String("e"), - Name: String("n"), - URL: String("url"), - ImportURL: String("iurl"), + ID: Ptr(int64(1)), + RemoteID: Ptr("rid"), + RemoteName: Ptr("rn"), + Email: Ptr("e"), + Name: Ptr("n"), + URL: Ptr("url"), + ImportURL: Ptr("iurl"), } want := `{ @@ -387,29 +387,29 @@ func TestImport_Marshal(t *testing.T) { testJSONMarshal(t, &Import{}, "{}") u := &Import{ - VCSURL: String("vcsurl"), - VCS: String("vcs"), - VCSUsername: String("vcsusr"), - VCSPassword: String("vcspass"), - TFVCProject: String("tfvcp"), - UseLFS: String("uselfs"), - HasLargeFiles: Bool(false), - LargeFilesSize: Int(1), - LargeFilesCount: Int(1), - Status: String("status"), - CommitCount: Int(1), - StatusText: String("statustxt"), - AuthorsCount: Int(1), - Percent: Int(1), - PushPercent: Int(1), - URL: String("url"), - HTMLURL: String("hurl"), - AuthorsURL: String("aurl"), - RepositoryURL: String("rurl"), - Message: String("msg"), - FailedStep: String("fs"), - HumanName: String("hn"), - ProjectChoices: []*Import{{VCSURL: String("vcsurl")}}, + VCSURL: Ptr("vcsurl"), + VCS: Ptr("vcs"), + VCSUsername: Ptr("vcsusr"), + VCSPassword: Ptr("vcspass"), + TFVCProject: Ptr("tfvcp"), + UseLFS: Ptr("uselfs"), + HasLargeFiles: Ptr(false), + LargeFilesSize: Ptr(1), + LargeFilesCount: Ptr(1), + Status: Ptr("status"), + CommitCount: Ptr(1), + StatusText: Ptr("statustxt"), + AuthorsCount: Ptr(1), + Percent: Ptr(1), + PushPercent: Ptr(1), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + AuthorsURL: Ptr("aurl"), + RepositoryURL: Ptr("rurl"), + Message: Ptr("msg"), + FailedStep: Ptr("fs"), + HumanName: Ptr("hn"), + ProjectChoices: []*Import{{VCSURL: Ptr("vcsurl")}}, } want := `{ diff --git a/github/migrations_test.go b/github/migrations_test.go index 2e4cbdd77f0..99604f62d7c 100644 --- a/github/migrations_test.go +++ b/github/migrations_test.go @@ -234,20 +234,20 @@ var migrationJSON = []byte(`{ }`) var wantMigration = &Migration{ - ID: Int64(79), - GUID: String("0b989ba4-242f-11e5-81e1-c7b6966d2516"), - State: String("pending"), - LockRepositories: Bool(true), - ExcludeAttachments: Bool(false), - URL: String("https://api.github.com/orgs/octo-org/migrations/79"), - CreatedAt: String("2015-07-06T15:33:38-07:00"), - UpdatedAt: String("2015-07-06T15:33:38-07:00"), + 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"), Repositories: []*Repository{ { - ID: Int64(1296269), - Name: String("Hello-World"), - FullName: String("octocat/Hello-World"), - Description: String("This your first repo!"), + ID: Ptr(int64(1296269)), + Name: Ptr("Hello-World"), + FullName: Ptr("octocat/Hello-World"), + Description: Ptr("This your first repo!"), }, }, } @@ -257,15 +257,15 @@ func TestMigration_Marshal(t *testing.T) { testJSONMarshal(t, &Migration{}, "{}") u := &Migration{ - ID: Int64(1), - GUID: String("guid"), - State: String("state"), - LockRepositories: Bool(false), - ExcludeAttachments: Bool(false), - URL: String("url"), - CreatedAt: String("ca"), - UpdatedAt: String("ua"), - Repositories: []*Repository{{ID: Int64(1)}}, + ID: Ptr(int64(1)), + GUID: Ptr("guid"), + State: Ptr("state"), + LockRepositories: Ptr(false), + ExcludeAttachments: Ptr(false), + URL: Ptr("url"), + CreatedAt: Ptr("ca"), + UpdatedAt: Ptr("ua"), + Repositories: []*Repository{{ID: Ptr(int64(1))}}, } want := `{ @@ -293,8 +293,8 @@ func TestStartMigration_Marshal(t *testing.T) { u := &startMigration{ Repositories: []string{"r"}, - LockRepositories: Bool(false), - ExcludeAttachments: Bool(false), + LockRepositories: Ptr(false), + ExcludeAttachments: Ptr(false), } want := `{ diff --git a/github/migrations_user.go b/github/migrations_user.go index 1f907cd4ec2..a7bd79499a2 100644 --- a/github/migrations_user.go +++ b/github/migrations_user.go @@ -75,8 +75,8 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin body := &startUserMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Bool(opts.LockRepositories) - body.ExcludeAttachments = Bool(opts.ExcludeAttachments) + body.LockRepositories = Ptr(opts.LockRepositories) + body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) } req, err := s.client.NewRequest("POST", u, body) diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go index 6253a7b3934..aea2b1be712 100644 --- a/github/migrations_user_test.go +++ b/github/migrations_user_test.go @@ -232,20 +232,20 @@ var userMigrationJSON = []byte(`{ }`) var wantUserMigration = &UserMigration{ - ID: Int64(79), - GUID: String("0b989ba4-242f-11e5-81e1-c7b6966d2516"), - State: String("pending"), - LockRepositories: Bool(true), - ExcludeAttachments: Bool(false), - URL: String("https://api.github.com/orgs/octo-org/migrations/79"), - CreatedAt: String("2015-07-06T15:33:38-07:00"), - UpdatedAt: String("2015-07-06T15:33:38-07:00"), + 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"), Repositories: []*Repository{ { - ID: Int64(1296269), - Name: String("Hello-World"), - FullName: String("octocat/Hello-World"), - Description: String("This your first repo!"), + ID: Ptr(int64(1296269)), + Name: Ptr("Hello-World"), + FullName: Ptr("octocat/Hello-World"), + Description: Ptr("This your first repo!"), }, }, } @@ -255,15 +255,15 @@ func TestUserMigration_Marshal(t *testing.T) { testJSONMarshal(t, &UserMigration{}, "{}") u := &UserMigration{ - ID: Int64(1), - GUID: String("guid"), - State: String("state"), - LockRepositories: Bool(false), - ExcludeAttachments: Bool(false), - URL: String("url"), - CreatedAt: String("ca"), - UpdatedAt: String("ua"), - Repositories: []*Repository{{ID: Int64(1)}}, + ID: Ptr(int64(1)), + GUID: Ptr("guid"), + State: Ptr("state"), + LockRepositories: Ptr(false), + ExcludeAttachments: Ptr(false), + URL: Ptr("url"), + CreatedAt: Ptr("ca"), + UpdatedAt: Ptr("ua"), + Repositories: []*Repository{{ID: Ptr(int64(1))}}, } want := `{ @@ -291,8 +291,8 @@ func TestStartUserMigration_Marshal(t *testing.T) { u := &startUserMigration{ Repositories: []string{"r"}, - LockRepositories: Bool(false), - ExcludeAttachments: Bool(false), + LockRepositories: Ptr(false), + ExcludeAttachments: Ptr(false), } want := `{ diff --git a/github/orgs_actions_allowed_test.go b/github/orgs_actions_allowed_test.go index 70cc0ea1fc6..d95558ed93f 100644 --- a/github/orgs_actions_allowed_test.go +++ b/github/orgs_actions_allowed_test.go @@ -29,7 +29,7 @@ func TestOrganizationsService_GetActionsAllowed(t *testing.T) { if err != nil { t.Errorf("Organizations.GetActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Organizations.GetActionsAllowed returned %+v, want %+v", org, want) } @@ -53,7 +53,7 @@ func TestOrganizationsService_EditActionsAllowed(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsAllowed) @@ -73,7 +73,7 @@ func TestOrganizationsService_EditActionsAllowed(t *testing.T) { t.Errorf("Organizations.EditActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Organizations.EditActionsAllowed returned %+v, want %+v", org, want) } diff --git a/github/orgs_actions_permissions_test.go b/github/orgs_actions_permissions_test.go index 0f773435690..3bdbe34c743 100644 --- a/github/orgs_actions_permissions_test.go +++ b/github/orgs_actions_permissions_test.go @@ -29,7 +29,7 @@ func TestOrganizationsService_GetActionsPermissions(t *testing.T) { if err != nil { t.Errorf("Organizations.GetActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("all")} + want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("all")} if !cmp.Equal(org, want) { t.Errorf("Organizations.GetActionsPermissions returned %+v, want %+v", org, want) } @@ -53,7 +53,7 @@ func TestOrganizationsService_EditActionsPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("selected")} + input := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected")} mux.HandleFunc("/orgs/o/actions/permissions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsPermissions) @@ -73,7 +73,7 @@ func TestOrganizationsService_EditActionsPermissions(t *testing.T) { t.Errorf("Organizations.EditActionsPermissions returned error: %v", err) } - want := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("selected")} + want := &ActionsPermissions{EnabledRepositories: Ptr("all"), AllowedActions: Ptr("selected")} if !cmp.Equal(org, want) { t.Errorf("Organizations.EditActionsPermissions returned %+v, want %+v", org, want) } diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index b13338ba3aa..3a6cacef45b 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 := context.Background() getOpts := GetAuditLogOptions{ - Include: String("all"), - Phrase: String("action:workflows"), - Order: String("asc"), + Include: Ptr("all"), + Phrase: Ptr("action:workflows"), + Order: Ptr("asc"), } auditEntries, resp, err := client.Organizations.GetAuditLog(ctx, "o", &getOpts) @@ -96,18 +96,18 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { want := []*AuditEntry{ { Timestamp: &Timestamp{timestamp}, - DocumentID: String("beeZYapIUe-wKg5-beadb33"), - Action: String("workflows.completed_workflow_run"), - Actor: String("testactor"), + DocumentID: Ptr("beeZYapIUe-wKg5-beadb33"), + Action: Ptr("workflows.completed_workflow_run"), + Actor: Ptr("testactor"), ActorLocation: &ActorLocation{ - CountryCode: String("US"), + CountryCode: Ptr("US"), }, CreatedAt: &Timestamp{timestamp}, - HashedToken: String("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="), - Org: String("o"), - OrgID: Int64(1), - TokenID: Int64(1), - TokenScopes: String("gist,repo:read"), + HashedToken: Ptr("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="), + Org: Ptr("o"), + OrgID: Ptr(int64(1)), + TokenID: Ptr(int64(1)), + TokenScopes: Ptr("gist,repo:read"), AdditionalFields: map[string]interface{}{ "actor_ip": "10.0.0.1", "active": true, @@ -178,9 +178,9 @@ func TestGetAuditLogOptions_Marshal(t *testing.T) { testJSONMarshal(t, &GetAuditLogOptions{}, "{}") u := &GetAuditLogOptions{ - Phrase: String("p"), - Include: String("i"), - Order: String("o"), + Phrase: Ptr("p"), + Include: Ptr("i"), + Order: Ptr("o"), ListCursorOptions: ListCursorOptions{ Page: "p", PerPage: 1, @@ -207,9 +207,9 @@ func TestHookConfig_Marshal(t *testing.T) { testJSONMarshal(t, &HookConfig{}, "{}") u := &HookConfig{ - ContentType: String("ct"), - InsecureSSL: String("ct"), - URL: String("url"), + ContentType: Ptr("ct"), + InsecureSSL: Ptr("ct"), + URL: Ptr("url"), } want := `{ @@ -226,21 +226,21 @@ func TestAuditEntry_Marshal(t *testing.T) { testJSONMarshal(t, &AuditEntry{}, "{}") u := &AuditEntry{ - Action: String("a"), - Actor: String("ac"), - ActorLocation: &ActorLocation{CountryCode: String("alcc")}, - Business: String("b"), + Action: Ptr("a"), + Actor: Ptr("ac"), + ActorLocation: &ActorLocation{CountryCode: Ptr("alcc")}, + Business: Ptr("b"), CreatedAt: &Timestamp{referenceTime}, - DocumentID: String("did"), - ExternalIdentityNameID: String("ein"), - ExternalIdentityUsername: String("eiu"), - HashedToken: String("ht"), - Org: String("o"), - OrgID: Int64(1), + DocumentID: Ptr("did"), + ExternalIdentityNameID: Ptr("ein"), + ExternalIdentityUsername: Ptr("eiu"), + HashedToken: Ptr("ht"), + Org: Ptr("o"), + OrgID: Ptr(int64(1)), Timestamp: &Timestamp{referenceTime}, - TokenID: Int64(1), - TokenScopes: String("ts"), - User: String("u"), + TokenID: Ptr(int64(1)), + TokenScopes: Ptr("ts"), + User: Ptr("u"), Data: map[string]interface{}{ "old_name": "on", "old_login": "ol", diff --git a/github/orgs_codesecurity_configurations_test.go b/github/orgs_codesecurity_configurations_test.go index cb630bccb64..97dc058d841 100644 --- a/github/orgs_codesecurity_configurations_test.go +++ b/github/orgs_codesecurity_configurations_test.go @@ -41,8 +41,8 @@ func TestOrganizationsService_GetCodeSecurityConfigurations(t *testing.T) { } want := []*CodeSecurityConfiguration{ - {ID: Int64(1), Name: String("config1"), CodeScanningDefaultSetup: String("enabled")}, - {ID: Int64(2), Name: String("config2"), PrivateVulnerabilityReporting: String("enabled")}, + {ID: Ptr(int64(1)), Name: Ptr("config1"), CodeScanningDefaultSetup: Ptr("enabled")}, + {ID: Ptr(int64(2)), Name: Ptr("config2"), PrivateVulnerabilityReporting: Ptr("enabled")}, } if !reflect.DeepEqual(configurations, want) { t.Errorf("Organizations.GetCodeSecurityConfigurations returned %+v, want %+v", configurations, want) @@ -80,7 +80,7 @@ func TestOrganizationsService_GetCodeSecurityConfiguration(t *testing.T) { t.Errorf("Organizations.GetCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Int64(1), Name: String("config1"), CodeScanningDefaultSetup: String("enabled")} + want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: Ptr("config1"), CodeScanningDefaultSetup: Ptr("enabled")} if !reflect.DeepEqual(configuration, want) { t.Errorf("Organizations.GetCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -106,8 +106,8 @@ func TestOrganizationsService_CreateCodeSecurityConfiguration(t *testing.T) { ctx := context.Background() input := &CodeSecurityConfiguration{ - Name: String("config1"), - CodeScanningDefaultSetup: String("enabled"), + Name: Ptr("config1"), + CodeScanningDefaultSetup: Ptr("enabled"), } mux.HandleFunc("/orgs/o/code-security/configurations", func(w http.ResponseWriter, r *http.Request) { @@ -133,7 +133,7 @@ func TestOrganizationsService_CreateCodeSecurityConfiguration(t *testing.T) { t.Errorf("Organizations.CreateCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Int64(1), Name: String("config1"), CodeScanningDefaultSetup: String("enabled")} + want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: Ptr("config1"), CodeScanningDefaultSetup: Ptr("enabled")} if !reflect.DeepEqual(configuration, want) { t.Errorf("Organizations.CreateCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -179,8 +179,8 @@ func TestOrganizationsService_GetDefaultCodeSecurityConfigurations(t *testing.T) } want := []*CodeSecurityConfiguration{ - {ID: Int64(1), Name: String("config1"), CodeScanningDefaultSetup: String("enabled")}, - {ID: Int64(2), Name: String("config2"), PrivateVulnerabilityReporting: String("enabled")}, + {ID: Ptr(int64(1)), Name: Ptr("config1"), CodeScanningDefaultSetup: Ptr("enabled")}, + {ID: Ptr(int64(2)), Name: Ptr("config2"), PrivateVulnerabilityReporting: Ptr("enabled")}, } if !reflect.DeepEqual(configurations, want) { t.Errorf("Organizations.GetDefaultCodeSecurityConfigurations returned %+v, want %+v", configurations, want) @@ -239,8 +239,8 @@ func TestOrganizationsService_UpdateCodeSecurityConfiguration(t *testing.T) { client, mux, _ := setup(t) input := &CodeSecurityConfiguration{ - Name: String("config1"), - CodeScanningDefaultSetup: String("enabled"), + Name: Ptr("config1"), + CodeScanningDefaultSetup: Ptr("enabled"), } mux.HandleFunc("/orgs/o/code-security/configurations/1", func(w http.ResponseWriter, r *http.Request) { @@ -266,7 +266,7 @@ func TestOrganizationsService_UpdateCodeSecurityConfiguration(t *testing.T) { t.Errorf("Organizations.UpdateCodeSecurityConfiguration returned error: %v", err) } - want := &CodeSecurityConfiguration{ID: Int64(1), Name: String("config1"), CodeScanningDefaultSetup: String("enabled")} + want := &CodeSecurityConfiguration{ID: Ptr(int64(1)), Name: Ptr("config1"), CodeScanningDefaultSetup: Ptr("enabled")} if !reflect.DeepEqual(configuration, want) { t.Errorf("Organizations.UpdateCodeSecurityConfiguration returned %+v, want %+v", configuration, want) } @@ -392,9 +392,9 @@ func TestOrganizationsService_SetDefaultCodeSecurityConfiguration(t *testing.T) t.Errorf("Organizations.SetDefaultCodeSecurityConfiguration returned status %d, want %d", resp.StatusCode, wantStatus) } want := &CodeSecurityConfigurationWithDefaultForNewRepos{ - DefaultForNewRepos: String("all"), + DefaultForNewRepos: Ptr("all"), Configuration: &CodeSecurityConfiguration{ - ID: Int64(1), Name: String("config1"), CodeScanningDefaultSetup: String("enabled"), + ID: Ptr(int64(1)), Name: Ptr("config1"), CodeScanningDefaultSetup: Ptr("enabled"), }, } if !reflect.DeepEqual(got, want) { @@ -440,8 +440,8 @@ func TestOrganizationsService_GetRepositoriesForCodeSecurityConfiguration(t *tes } want := []*Repository{ - {ID: Int64(8), Name: String("repo8")}, - {ID: Int64(42), Name: String("repo42")}, + {ID: Ptr(int64(8)), Name: Ptr("repo8")}, + {ID: Ptr(int64(42)), Name: Ptr("repo42")}, } if !reflect.DeepEqual(repositories, want) { t.Errorf("Organizations.GetRepositoriesForCodeSecurityConfiguration returned %+v, want %+v", repositories, want) @@ -483,9 +483,9 @@ func TestOrganizationsService_GetCodeSecurityConfigurationForRepository(t *testi if err != nil { t.Errorf("Organizations.GetCodeSecurityConfigurationForRepository returned error: %v", err) } - c := &CodeSecurityConfiguration{ID: Int64(42), Name: String("config42"), CodeScanningDefaultSetup: String("enabled")} + c := &CodeSecurityConfiguration{ID: Ptr(int64(42)), Name: Ptr("config42"), CodeScanningDefaultSetup: Ptr("enabled")} want := &RepositoryCodeSecurityConfiguration{ - State: String("attached"), + State: Ptr("attached"), Configuration: c, } if !reflect.DeepEqual(rc, want) { diff --git a/github/orgs_credential_authorizations_test.go b/github/orgs_credential_authorizations_test.go index a03f20586b5..dfd7e559507 100644 --- a/github/orgs_credential_authorizations_test.go +++ b/github/orgs_credential_authorizations_test.go @@ -48,12 +48,12 @@ func TestOrganizationsService_ListCredentialAuthorizations(t *testing.T) { ts := time.Date(2017, time.January, 21, 0, 0, 0, 0, time.UTC) want := []*CredentialAuthorization{ { - Login: String("l"), - CredentialID: Int64(1), - CredentialType: String("t"), + Login: Ptr("l"), + CredentialID: Ptr(int64(1)), + CredentialType: Ptr("t"), CredentialAuthorizedAt: &Timestamp{ts}, CredentialAccessedAt: &Timestamp{ts}, - AuthorizedCredentialID: Int64(1), + AuthorizedCredentialID: Ptr(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 ddf8ef9759a..8e78e0a041c 100644 --- a/github/orgs_custom_repository_roles_test.go +++ b/github/orgs_custom_repository_roles_test.go @@ -53,24 +53,24 @@ func TestOrganizationsService_ListCustomRepoRoles(t *testing.T) { } want := &OrganizationCustomRepoRoles{ - TotalCount: Int(1), + TotalCount: Ptr(1), CustomRepoRoles: []*CustomRepoRoles{ { - ID: Int64(1), - Name: String("Developer"), - BaseRole: String("write"), + ID: Ptr(int64(1)), + Name: Ptr("Developer"), + BaseRole: Ptr("write"), Permissions: []string{"delete_alerts_code_scanning"}, Org: &Organization{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - HTMLURL: String("h"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), + 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"), }, CreatedAt: &Timestamp{time.Date(2024, time.July, 21, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2024, time.July, 21, 19, 33, 8, 0, time.UTC)}, @@ -108,9 +108,9 @@ func TestOrganizationsService_CreateCustomRepoRole(t *testing.T) { ctx := context.Background() opts := &CreateOrUpdateCustomRepoRoleOptions{ - Name: String("Labeler"), - Description: String("A role for issue and PR labelers"), - BaseRole: String("read"), + Name: Ptr("Labeler"), + Description: Ptr("A role for issue and PR labelers"), + BaseRole: Ptr("read"), Permissions: []string{"add_label"}, } apps, _, err := client.Organizations.CreateCustomRepoRole(ctx, "o", opts) @@ -118,7 +118,7 @@ func TestOrganizationsService_CreateCustomRepoRole(t *testing.T) { t.Errorf("Organizations.CreateCustomRepoRole returned error: %v", err) } - want := &CustomRepoRoles{ID: Int64(8030), Name: String("Labeler"), BaseRole: String("read"), Permissions: []string{"add_label"}, Description: String("A role for issue and PR labelers")} + 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")} if !cmp.Equal(apps, want) { t.Errorf("Organizations.CreateCustomRepoRole returned %+v, want %+v", apps, want) @@ -151,15 +151,15 @@ func TestOrganizationsService_UpdateCustomRepoRole(t *testing.T) { ctx := context.Background() opts := &CreateOrUpdateCustomRepoRoleOptions{ - Name: String("Updated Name"), - Description: String("Updated Description"), + Name: Ptr("Updated Name"), + Description: Ptr("Updated Description"), } apps, _, err := client.Organizations.UpdateCustomRepoRole(ctx, "o", 8030, opts) if err != nil { t.Errorf("Organizations.UpdateCustomRepoRole returned error: %v", err) } - want := &CustomRepoRoles{ID: Int64(8030), Name: String("Updated Name"), BaseRole: String("read"), Permissions: []string{"add_label"}, Description: String("Updated Description")} + want := &CustomRepoRoles{ID: Ptr(int64(8030)), Name: Ptr("Updated Name"), BaseRole: Ptr("read"), Permissions: []string{"add_label"}, Description: Ptr("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 d95b40c18f7..42f55c99aff 100644 --- a/github/orgs_hooks_configuration_test.go +++ b/github/orgs_hooks_configuration_test.go @@ -31,10 +31,10 @@ func TestOrganizationsService_GetHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("0"), - Secret: String("********"), - URL: String("https://example.com/webhook"), + ContentType: Ptr("json"), + InsecureSSL: Ptr("0"), + Secret: Ptr("********"), + URL: Ptr("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Organizations.GetHookConfiguration returned %+v, want %+v", config, want) @@ -89,10 +89,10 @@ func TestOrganizationsService_EditHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("0"), - Secret: String("********"), - URL: String("https://example.com/webhook"), + ContentType: Ptr("json"), + InsecureSSL: Ptr("0"), + Secret: Ptr("********"), + URL: Ptr("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Organizations.EditHookConfiguration returned %+v, want %+v", config, want) diff --git a/github/orgs_hooks_deliveries_test.go b/github/orgs_hooks_deliveries_test.go index 8b4b6463624..d4d68236143 100644 --- a/github/orgs_hooks_deliveries_test.go +++ b/github/orgs_hooks_deliveries_test.go @@ -32,7 +32,7 @@ func TestOrganizationsService_ListHookDeliveries(t *testing.T) { t.Errorf("Organizations.ListHookDeliveries returned error: %v", err) } - want := []*HookDelivery{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*HookDelivery{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if d := cmp.Diff(hooks, want); d != "" { t.Errorf("Organizations.ListHooks want (-), got (+):\n%s", d) } @@ -76,7 +76,7 @@ func TestOrganizationsService_GetHookDelivery(t *testing.T) { t.Errorf("Organizations.GetHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Int64(1)} + want := &HookDelivery{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.GetHookDelivery returned %+v, want %+v", hook, want) } @@ -120,7 +120,7 @@ func TestOrganizationsService_RedeliverHookDelivery(t *testing.T) { t.Errorf("Organizations.RedeliverHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Int64(1)} + want := &HookDelivery{ID: Ptr(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 59e4d0d857f..3b3b8bff91c 100644 --- a/github/orgs_hooks_test.go +++ b/github/orgs_hooks_test.go @@ -33,7 +33,7 @@ func TestOrganizationsService_ListHooks(t *testing.T) { t.Errorf("Organizations.ListHooks returned error: %v", err) } - want := []*Hook{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*Hook{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(hooks, want) { t.Errorf("Organizations.ListHooks returned %+v, want %+v", hooks, want) } @@ -87,7 +87,7 @@ func TestOrganizationsService_CreateHook(t *testing.T) { t.Errorf("Organizations.CreateHook returned error: %v", err) } - want := &Hook{ID: Int64(1)} + want := &Hook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.CreateHook returned %+v, want %+v", hook, want) } @@ -122,7 +122,7 @@ func TestOrganizationsService_GetHook(t *testing.T) { t.Errorf("Organizations.GetHook returned error: %v", err) } - want := &Hook{ID: Int64(1)} + want := &Hook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.GetHook returned %+v, want %+v", hook, want) } @@ -175,7 +175,7 @@ func TestOrganizationsService_EditHook(t *testing.T) { t.Errorf("Organizations.EditHook returned error: %v", err) } - want := &Hook{ID: Int64(1)} + want := &Hook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Organizations.EditHook returned %+v, want %+v", hook, want) } diff --git a/github/orgs_members_test.go b/github/orgs_members_test.go index a351ab9341a..71c7fbef3a7 100644 --- a/github/orgs_members_test.go +++ b/github/orgs_members_test.go @@ -42,7 +42,7 @@ func TestOrganizationsService_ListMembers(t *testing.T) { t.Errorf("Organizations.ListMembers returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want) } @@ -87,7 +87,7 @@ func TestOrganizationsService_ListMembers_public(t *testing.T) { t.Errorf("Organizations.ListMembers returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want) } @@ -392,7 +392,7 @@ func TestOrganizationsService_ListOrgMemberships(t *testing.T) { t.Errorf("Organizations.ListOrgMemberships returned error: %v", err) } - want := []*Membership{{URL: String("u")}} + want := []*Membership{{URL: Ptr("u")}} if !cmp.Equal(memberships, want) { t.Errorf("Organizations.ListOrgMemberships returned %+v, want %+v", memberships, want) } @@ -422,7 +422,7 @@ func TestOrganizationsService_GetOrgMembership_AuthenticatedUser(t *testing.T) { t.Errorf("Organizations.GetOrgMembership returned error: %v", err) } - want := &Membership{URL: String("u")} + want := &Membership{URL: Ptr("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.GetOrgMembership returned %+v, want %+v", membership, want) } @@ -457,7 +457,7 @@ func TestOrganizationsService_GetOrgMembership_SpecifiedUser(t *testing.T) { t.Errorf("Organizations.GetOrgMembership returned error: %v", err) } - want := &Membership{URL: String("u")} + want := &Membership{URL: Ptr("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.GetOrgMembership returned %+v, want %+v", membership, want) } @@ -467,7 +467,7 @@ func TestOrganizationsService_EditOrgMembership_AuthenticatedUser(t *testing.T) t.Parallel() client, mux, _ := setup(t) - input := &Membership{State: String("active")} + input := &Membership{State: Ptr("active")} mux.HandleFunc("/user/memberships/orgs/o", func(w http.ResponseWriter, r *http.Request) { v := new(Membership) @@ -487,7 +487,7 @@ func TestOrganizationsService_EditOrgMembership_AuthenticatedUser(t *testing.T) t.Errorf("Organizations.EditOrgMembership returned error: %v", err) } - want := &Membership{URL: String("u")} + want := &Membership{URL: Ptr("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.EditOrgMembership returned %+v, want %+v", membership, want) } @@ -511,7 +511,7 @@ func TestOrganizationsService_EditOrgMembership_SpecifiedUser(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Membership{State: String("active")} + input := &Membership{State: Ptr("active")} mux.HandleFunc("/orgs/o/memberships/u", func(w http.ResponseWriter, r *http.Request) { v := new(Membership) @@ -531,7 +531,7 @@ func TestOrganizationsService_EditOrgMembership_SpecifiedUser(t *testing.T) { t.Errorf("Organizations.EditOrgMembership returned error: %v", err) } - want := &Membership{URL: String("u")} + want := &Membership{URL: Ptr("u")} if !cmp.Equal(membership, want) { t.Errorf("Organizations.EditOrgMembership returned %+v, want %+v", membership, want) } @@ -612,32 +612,32 @@ func TestOrganizationsService_ListPendingOrgInvitations(t *testing.T) { createdAt := time.Date(2017, time.January, 21, 0, 0, 0, 0, time.UTC) want := []*Invitation{ { - ID: Int64(1), - Login: String("monalisa"), - Email: String("octocat@github.com"), - Role: String("direct_member"), + ID: Ptr(int64(1)), + Login: Ptr("monalisa"), + Email: Ptr("octocat@github.com"), + Role: Ptr("direct_member"), CreatedAt: &Timestamp{createdAt}, Inviter: &User{ - Login: String("other_user"), - ID: Int64(1), - AvatarURL: String("https://github.com/images/error/other_user_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/other_user"), - HTMLURL: String("https://github.com/other_user"), - FollowersURL: String("https://api.github.com/users/other_user/followers"), - FollowingURL: String("https://api.github.com/users/other_user/following/other_user"), - GistsURL: String("https://api.github.com/users/other_user/gists/gist_id"), - StarredURL: String("https://api.github.com/users/other_user/starred/owner/repo"), - SubscriptionsURL: String("https://api.github.com/users/other_user/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/other_user/orgs"), - ReposURL: String("https://api.github.com/users/other_user/repos"), - EventsURL: String("https://api.github.com/users/other_user/events/privacy"), - ReceivedEventsURL: String("https://api.github.com/users/other_user/received_events/privacy"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, - TeamCount: Int(2), - InvitationTeamURL: String("https://api.github.com/organizations/2/invitations/1/teams"), + TeamCount: Ptr(2), + InvitationTeamURL: Ptr("https://api.github.com/organizations/2/invitations/1/teams"), }} if !cmp.Equal(invitations, want) { @@ -664,8 +664,8 @@ func TestOrganizationsService_CreateOrgInvitation(t *testing.T) { client, mux, _ := setup(t) input := &CreateOrgInvitationOptions{ - Email: String("octocat@github.com"), - Role: String("direct_member"), + Email: Ptr("octocat@github.com"), + Role: Ptr("direct_member"), TeamID: []int64{ 12, 26, @@ -690,7 +690,7 @@ func TestOrganizationsService_CreateOrgInvitation(t *testing.T) { t.Errorf("Organizations.CreateOrgInvitation returned error: %v", err) } - want := &Invitation{Email: String("octocat@github.com")} + want := &Invitation{Email: Ptr("octocat@github.com")} if !cmp.Equal(invitations, want) { t.Errorf("Organizations.ListPendingOrgInvitations returned %+v, want %+v", invitations, want) } @@ -741,15 +741,15 @@ func TestOrganizationsService_ListOrgInvitationTeams(t *testing.T) { want := []*Team{ { - ID: Int64(1), - URL: String("https://api.github.com/teams/1"), - Name: String("Justice League"), - Slug: String("justice-league"), - Description: String("A great team."), - Privacy: String("closed"), - Permission: String("admin"), - MembersURL: String("https://api.github.com/teams/1/members{/member}"), - RepositoriesURL: String("https://api.github.com/teams/1/repos"), + 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"), }, } @@ -825,36 +825,36 @@ func TestOrganizationsService_ListFailedOrgInvitations(t *testing.T) { createdAt := time.Date(2016, time.November, 30, 6, 46, 10, 0, time.UTC) want := []*Invitation{ { - ID: Int64(1), - Login: String("monalisa"), - NodeID: String("MDQ6VXNlcjE="), - Email: String("octocat@github.com"), - Role: String("direct_member"), + ID: Ptr(int64(1)), + Login: Ptr("monalisa"), + NodeID: Ptr("MDQ6VXNlcjE="), + Email: Ptr("octocat@github.com"), + Role: Ptr("direct_member"), FailedAt: &Timestamp{time.Date(2017, time.January, 2, 1, 10, 0, 0, time.UTC)}, - FailedReason: String("the reason"), + FailedReason: Ptr("the reason"), CreatedAt: &Timestamp{createdAt}, Inviter: &User{ - Login: String("other_user"), - ID: Int64(1), - NodeID: String("MDQ6VXNlcjE="), - AvatarURL: String("https://github.com/images/error/other_user_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/other_user"), - HTMLURL: String("https://github.com/other_user"), - FollowersURL: String("https://api.github.com/users/other_user/followers"), - FollowingURL: String("https://api.github.com/users/other_user/following{/other_user}"), - GistsURL: String("https://api.github.com/users/other_user/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/other_user/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/other_user/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/other_user/orgs"), - ReposURL: String("https://api.github.com/users/other_user/repos"), - EventsURL: String("https://api.github.com/users/other_user/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/other_user/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, - TeamCount: Int(2), - InvitationTeamURL: String("https://api.github.com/organizations/2/invitations/1/teams"), + TeamCount: Ptr(2), + InvitationTeamURL: Ptr("https://api.github.com/organizations/2/invitations/1/teams"), }, } @@ -882,40 +882,40 @@ func TestMembership_Marshal(t *testing.T) { testJSONMarshal(t, &Membership{}, "{}") u := &Membership{ - URL: String("url"), - State: String("state"), - Role: String("email"), - OrganizationURL: String("orgurl"), + URL: Ptr("url"), + State: Ptr("state"), + Role: Ptr("email"), + OrganizationURL: Ptr("orgurl"), Organization: &Organization{ - BillingEmail: String("be"), - Blog: String("b"), - Company: String("c"), - Email: String("e"), - TwitterUsername: String("tu"), - Location: String("loc"), - Name: String("n"), - Description: String("d"), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("drp"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("marct"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("be"), + Blog: Ptr("b"), + Company: Ptr("c"), + Email: Ptr("e"), + TwitterUsername: Ptr("tu"), + Location: Ptr("loc"), + Name: Ptr("n"), + Description: Ptr("d"), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("drp"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("marct"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), }, User: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Login: Ptr("l"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + URL: Ptr("u"), + ReposURL: Ptr("r"), + EventsURL: Ptr("e"), + AvatarURL: Ptr("a"), }, } @@ -965,9 +965,9 @@ func TestCreateOrgInvitationOptions_Marshal(t *testing.T) { testJSONMarshal(t, &CreateOrgInvitationOptions{}, "{}") u := &CreateOrgInvitationOptions{ - InviteeID: Int64(1), - Email: String("email"), - Role: String("role"), + InviteeID: Ptr(int64(1)), + Email: Ptr("email"), + Role: Ptr("role"), TeamID: []int64{1}, } diff --git a/github/orgs_organization_roles_test.go b/github/orgs_organization_roles_test.go index 4989697e355..d64e13b1ef2 100644 --- a/github/orgs_organization_roles_test.go +++ b/github/orgs_organization_roles_test.go @@ -54,28 +54,28 @@ func TestOrganizationsService_ListRoles(t *testing.T) { } want := &OrganizationCustomRoles{ - TotalCount: Int(1), + TotalCount: Ptr(1), CustomRepoRoles: []*CustomOrgRoles{ { - ID: Int64(1), - Name: String("Auditor"), + ID: Ptr(int64(1)), + Name: Ptr("Auditor"), Permissions: []string{"read_audit_logs"}, Org: &Organization{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - HTMLURL: String("h"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), + 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"), }, CreatedAt: &Timestamp{time.Date(2024, time.July, 21, 19, 33, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2024, time.July, 21, 19, 33, 8, 0, time.UTC)}, - Source: String("Organization"), - BaseRole: String("admin"), + Source: Ptr("Organization"), + BaseRole: Ptr("admin"), }, }, } @@ -125,14 +125,14 @@ func TestOrganizationsService_GetOrgRole(t *testing.T) { } wantBuiltInRole := &CustomOrgRoles{ - ID: Int64(8132), - Name: String("all_repo_read"), - Description: String("Grants read access to all repositories in the organization."), + ID: Ptr(int64(8132)), + Name: Ptr("all_repo_read"), + Description: Ptr("Grants read access to all repositories in the organization."), Permissions: []string{}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Source: String("Predefined"), - BaseRole: String("read"), + Source: Ptr("Predefined"), + BaseRole: Ptr("read"), } if !cmp.Equal(gotBuiltInRole, wantBuiltInRole) { @@ -164,9 +164,9 @@ func TestOrganizationsService_GetOrgRole(t *testing.T) { } wantCustomRole := &CustomOrgRoles{ - ID: Int64(123456), - Name: String("test-role"), - Description: String("test-role"), + ID: Ptr(int64(123456)), + Name: Ptr("test-role"), + Description: Ptr("test-role"), Permissions: []string{ "read_organization_custom_org_role", "read_organization_custom_repo_role", @@ -174,7 +174,7 @@ func TestOrganizationsService_GetOrgRole(t *testing.T) { }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Source: String("Organization"), + Source: Ptr("Organization"), BaseRole: nil, } @@ -209,8 +209,8 @@ func TestOrganizationsService_CreateCustomOrgRole(t *testing.T) { ctx := context.Background() opts := &CreateOrUpdateOrgRoleOptions{ - Name: String("Reader"), - Description: String("A role for reading custom org roles"), + Name: Ptr("Reader"), + Description: Ptr("A role for reading custom org roles"), Permissions: []string{"read_organization_custom_org_role"}, } gotRoles, _, err := client.Organizations.CreateCustomOrgRole(ctx, "o", opts) @@ -218,7 +218,7 @@ func TestOrganizationsService_CreateCustomOrgRole(t *testing.T) { t.Errorf("Organizations.CreateCustomOrgRole returned error: %v", err) } - want := &CustomOrgRoles{ID: Int64(8030), Name: String("Reader"), Permissions: []string{"read_organization_custom_org_role"}, Description: String("A role for reading custom org roles")} + want := &CustomOrgRoles{ID: Ptr(int64(8030)), Name: Ptr("Reader"), Permissions: []string{"read_organization_custom_org_role"}, Description: Ptr("A role for reading custom org roles")} if !cmp.Equal(gotRoles, want) { t.Errorf("Organizations.CreateCustomOrgRole returned %+v, want %+v", gotRoles, want) @@ -251,15 +251,15 @@ func TestOrganizationsService_UpdateCustomOrgRole(t *testing.T) { ctx := context.Background() opts := &CreateOrUpdateOrgRoleOptions{ - Name: String("Updated Name"), - Description: String("Updated Description"), + Name: Ptr("Updated Name"), + Description: Ptr("Updated Description"), } gotRoles, _, err := client.Organizations.UpdateCustomOrgRole(ctx, "o", 8030, opts) if err != nil { t.Errorf("Organizations.UpdateCustomOrgRole returned error: %v", err) } - want := &CustomOrgRoles{ID: Int64(8030), Name: String("Updated Name"), Permissions: []string{"read_organization_custom_org_role"}, Description: String("Updated Description")} + want := &CustomOrgRoles{ID: Ptr(int64(8030)), Name: Ptr("Updated Name"), Permissions: []string{"read_organization_custom_org_role"}, Description: Ptr("Updated Description")} if !cmp.Equal(gotRoles, want) { t.Errorf("Organizations.UpdateCustomOrgRole returned %+v, want %+v", gotRoles, want) @@ -442,7 +442,7 @@ func TestOrganizationsService_ListTeamsAssignedToOrgRole(t *testing.T) { t.Errorf("Organizations.ListTeamsAssignedToOrgRole returned error: %v", err) } - want := []*Team{{ID: Int64(1)}} + want := []*Team{{ID: Ptr(int64(1))}} if !cmp.Equal(apps, want) { t.Errorf("Organizations.ListTeamsAssignedToOrgRole returned %+v, want %+v", apps, want) } @@ -477,7 +477,7 @@ func TestOrganizationsService_ListUsersAssignedToOrgRole(t *testing.T) { t.Errorf("Organizations.ListUsersAssignedToOrgRole returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(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 c366800f4bc..42b4b770192 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: Int64(1)}} + want := []*User{{ID: Ptr(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 a4bbfb915c4..5aa783d26e0 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: Int64(197), - Name: String("hello_docker"), - PackageType: String("container"), - VersionCount: Int64(1), - Visibility: String("private"), - URL: String("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, Owner: &User{ - Login: String("github"), - ID: Int64(9919), - NodeID: String("MDEyOk9yZ2FuaXphdGlvbjk5MTk="), - AvatarURL: String("https://avatars.githubusercontent.com/u/9919?v=4"), - GravatarID: String(""), - URL: String("https://api.github.com/users/github"), - HTMLURL: String("https://github.com/github"), - FollowersURL: String("https://api.github.com/users/github/followers"), - FollowingURL: String("https://api.github.com/users/github/following{/other_user}"), - GistsURL: String("https://api.github.com/users/github/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/github/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/github/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/github/orgs"), - ReposURL: String("https://api.github.com/users/github/repos"), - EventsURL: String("https://api.github.com/users/github/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/github/received_events"), - Type: String("Organization"), - SiteAdmin: Bool(false), + 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), }, }} if !cmp.Equal(packages, want) { @@ -143,13 +143,13 @@ func TestOrganizationsService_GetPackage(t *testing.T) { } want := &Package{ - ID: Int64(197), - Name: String("hello/hello_docker"), - PackageType: String("container"), - VersionCount: Int64(1), - Visibility: String("private"), - URL: String("https://api.github.com/orgs/github/packages/container/hello%2Fhello_docker"), - HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello%2Fhello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -261,7 +261,7 @@ func TestOrganizationsService_ListPackagesVersions(t *testing.T) { ctx := context.Background() opts := &PackageListOptions{ - String("internal"), String("container"), String("deleted"), ListOptions{Page: 1, PerPage: 2}, + Ptr("internal"), Ptr("container"), Ptr("deleted"), ListOptions{Page: 1, PerPage: 2}, } packages, _, err := client.Organizations.PackageGetAllVersions(ctx, "o", "container", "hello/hello_docker", opts) if err != nil { @@ -269,15 +269,15 @@ func TestOrganizationsService_ListPackagesVersions(t *testing.T) { } want := []*PackageVersion{{ - ID: Int64(45763), - Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), + HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), Metadata: &PackageMetadata{ - PackageType: String("container"), + PackageType: Ptr("container"), Container: &PackageContainerMetadata{ Tags: []string{"latest"}, }, @@ -339,15 +339,15 @@ func TestOrganizationsService_PackageGetVersion(t *testing.T) { } want := &PackageVersion{ - ID: Int64(45763), - Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), + HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), Metadata: &PackageMetadata{ - PackageType: String("container"), + PackageType: Ptr("container"), Container: &PackageContainerMetadata{ Tags: []string{"latest"}, }, diff --git a/github/orgs_personal_access_tokens_test.go b/github/orgs_personal_access_tokens_test.go index f4666004a77..8322c403916 100644 --- a/github/orgs_personal_access_tokens_test.go +++ b/github/orgs_personal_access_tokens_test.go @@ -99,35 +99,35 @@ func TestOrganizationsService_ListFineGrainedPersonalAccessTokens(t *testing.T) want := []*PersonalAccessToken{ { - ID: Int64(25381), + ID: Ptr(int64(25381)), Owner: &User{ - Login: String("octocat"), - ID: Int64(1), - NodeID: String("MDQ6VXNlcjE="), - AvatarURL: String("https://github.com/images/error/octocat_happy.gif"), - GravatarID: String(""), - URL: String("https://api.github.com/users/octocat"), - HTMLURL: String("https://github.com/octocat"), - FollowersURL: String("https://api.github.com/users/octocat/followers"), - FollowingURL: String("https://api.github.com/users/octocat/following{/other_user}"), - GistsURL: String("https://api.github.com/users/octocat/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/octocat/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/octocat/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/octocat/orgs"), - ReposURL: String("https://api.github.com/users/octocat/repos"), - EventsURL: String("https://api.github.com/users/octocat/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/octocat/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, - RepositorySelection: String("all"), - RepositoriesURL: String("https://api.github.com/organizations/652551/personal-access-tokens/25381/repositories"), + RepositorySelection: Ptr("all"), + RepositoriesURL: Ptr("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: &Timestamp{time.Date(2023, time.May, 16, 8, 47, 9, 0, time.FixedZone("PDT", -7*60*60))}, - TokenExpired: Bool(false), + TokenExpired: Ptr(false), TokenExpiresAt: &Timestamp{time.Date(2023, time.November, 16, 8, 47, 9, 0, time.FixedZone("PDT", -7*60*60))}, TokenLastUsedAt: nil, }, @@ -161,7 +161,7 @@ func TestOrganizationsService_ReviewPersonalAccessTokenRequest(t *testing.T) { input := ReviewPersonalAccessTokenRequestOptions{ Action: "a", - Reason: String("r"), + Reason: Ptr("r"), } mux.HandleFunc("/orgs/o/personal-access-token-requests/1", func(w http.ResponseWriter, r *http.Request) { @@ -203,7 +203,7 @@ func TestReviewPersonalAccessTokenRequestOptions_Marshal(t *testing.T) { u := &ReviewPersonalAccessTokenRequestOptions{ Action: "a", - Reason: String("r"), + Reason: Ptr("r"), } want := `{ diff --git a/github/orgs_projects_test.go b/github/orgs_projects_test.go index b6f082f0a45..f26cb90ac35 100644 --- a/github/orgs_projects_test.go +++ b/github/orgs_projects_test.go @@ -33,7 +33,7 @@ func TestOrganizationsService_ListProjects(t *testing.T) { t.Errorf("Organizations.ListProjects returned error: %v", err) } - want := []*Project{{ID: Int64(1)}} + want := []*Project{{ID: Ptr(int64(1))}} if !cmp.Equal(projects, want) { t.Errorf("Organizations.ListProjects returned %+v, want %+v", projects, want) } @@ -57,7 +57,7 @@ func TestOrganizationsService_CreateProject(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ProjectOptions{Name: String("Project Name"), Body: String("Project body.")} + input := &ProjectOptions{Name: Ptr("Project Name"), Body: Ptr("Project body.")} mux.HandleFunc("/orgs/o/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -78,7 +78,7 @@ func TestOrganizationsService_CreateProject(t *testing.T) { t.Errorf("Organizations.CreateProject returned error: %v", err) } - want := &Project{ID: Int64(1)} + want := &Project{ID: Ptr(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Organizations.CreateProject returned %+v, want %+v", project, want) } diff --git a/github/orgs_properties_test.go b/github/orgs_properties_test.go index b71132a8622..102f9e669c7 100644 --- a/github/orgs_properties_test.go +++ b/github/orgs_properties_test.go @@ -53,22 +53,22 @@ func TestOrganizationsService_GetAllCustomProperties(t *testing.T) { want := []*CustomProperty{ { - PropertyName: String("name"), + PropertyName: Ptr("name"), ValueType: "single_select", - Required: Bool(true), - DefaultValue: String("production"), - Description: String("Prod or dev environment"), + Required: Ptr(true), + DefaultValue: Ptr("production"), + Description: Ptr("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: String("org_actors"), + ValuesEditableBy: Ptr("org_actors"), }, { - PropertyName: String("service"), + PropertyName: Ptr("service"), ValueType: "string", }, { - PropertyName: String("team"), + PropertyName: Ptr("team"), ValueType: "string", - Description: String("Team owning the repository"), + Description: Ptr("Team owning the repository"), }, } if !cmp.Equal(properties, want) { @@ -109,12 +109,12 @@ func TestOrganizationsService_CreateOrUpdateCustomProperties(t *testing.T) { ctx := context.Background() properties, _, err := client.Organizations.CreateOrUpdateCustomProperties(ctx, "o", []*CustomProperty{ { - PropertyName: String("name"), + PropertyName: Ptr("name"), ValueType: "single_select", - Required: Bool(true), + Required: Ptr(true), }, { - PropertyName: String("service"), + PropertyName: Ptr("service"), ValueType: "string", }, }) @@ -124,12 +124,12 @@ func TestOrganizationsService_CreateOrUpdateCustomProperties(t *testing.T) { want := []*CustomProperty{ { - PropertyName: String("name"), + PropertyName: Ptr("name"), ValueType: "single_select", - Required: Bool(true), + Required: Ptr(true), }, { - PropertyName: String("service"), + PropertyName: Ptr("service"), ValueType: "string", }, } @@ -176,13 +176,13 @@ func TestOrganizationsService_GetCustomProperty(t *testing.T) { } want := &CustomProperty{ - PropertyName: String("name"), + PropertyName: Ptr("name"), ValueType: "single_select", - Required: Bool(true), - DefaultValue: String("production"), - Description: String("Prod or dev environment"), + Required: Ptr(true), + DefaultValue: Ptr("production"), + Description: Ptr("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: String("org_actors"), + ValuesEditableBy: Ptr("org_actors"), } if !cmp.Equal(property, want) { t.Errorf("Organizations.GetCustomProperty returned %+v, want %+v", property, want) @@ -222,24 +222,24 @@ func TestOrganizationsService_CreateOrUpdateCustomProperty(t *testing.T) { ctx := context.Background() property, _, err := client.Organizations.CreateOrUpdateCustomProperty(ctx, "o", "name", &CustomProperty{ ValueType: "single_select", - Required: Bool(true), - DefaultValue: String("production"), - Description: String("Prod or dev environment"), + Required: Ptr(true), + DefaultValue: Ptr("production"), + Description: Ptr("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: String("org_actors"), + ValuesEditableBy: Ptr("org_actors"), }) if err != nil { t.Errorf("Organizations.CreateOrUpdateCustomProperty returned error: %v", err) } want := &CustomProperty{ - PropertyName: String("name"), + PropertyName: Ptr("name"), ValueType: "single_select", - Required: Bool(true), - DefaultValue: String("production"), - Description: String("Prod or dev environment"), + Required: Ptr(true), + DefaultValue: Ptr("production"), + Description: Ptr("Prod or dev environment"), AllowedValues: []string{"production", "development"}, - ValuesEditableBy: String("org_actors"), + ValuesEditableBy: Ptr("org_actors"), } if !cmp.Equal(property, want) { t.Errorf("Organizations.CreateOrUpdateCustomProperty returned %+v, want %+v", property, want) @@ -452,7 +452,7 @@ func TestOrganizationsService_CreateOrUpdateRepoCustomPropertyValues(t *testing. _, err := client.Organizations.CreateOrUpdateRepoCustomPropertyValues(ctx, "o", []string{"repo"}, []*CustomPropertyValue{ { PropertyName: "service", - Value: String("string"), + Value: Ptr("string"), }, }) if err != nil { diff --git a/github/orgs_rules_test.go b/github/orgs_rules_test.go index ca6e3f84ce4..ebc559c640c 100644 --- a/github/orgs_rules_test.go +++ b/github/orgs_rules_test.go @@ -44,15 +44,15 @@ func TestOrganizationsService_GetAllOrganizationRulesets(t *testing.T) { } want := []*Ruleset{{ - ID: Int64(26110), + ID: Ptr(int64(26110)), Name: "test ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", - NodeID: String("nid"), + NodeID: Ptr("nid"), Links: &RulesetLinks{ - Self: &RulesetLink{HRef: String("https://api.github.com/orgs/o/rulesets/26110")}, + Self: &RulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/26110")}, }, }} if !cmp.Equal(rulesets, want) { @@ -221,16 +221,16 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) ctx := context.Background() ruleset, _, err := client.Organizations.CreateOrganizationRuleset(ctx, "o", &Ruleset{ - ID: Int64(21), + ID: Ptr(int64(21)), Name: "ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Int64(234), - ActorType: String("Team"), + ActorID: Ptr(int64(234)), + ActorType: Ptr("Team"), }, }, Conditions: &RulesetConditions{ @@ -241,7 +241,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) RepositoryName: &RulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Bool(true), + Protected: Ptr(true), }, }, Rules: []*RepositoryRule{ @@ -266,15 +266,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }), NewNonFastForwardRule(), NewCommitMessagePatternRule(&RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }), @@ -283,20 +283,20 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) Pattern: "github", }), NewCommitterEmailPatternRule(&RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }), NewBranchNamePatternRule(&RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }), NewTagNamePatternRule(&RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }), @@ -316,16 +316,16 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) } want := &Ruleset{ - ID: Int64(21), + ID: Ptr(int64(21)), Name: "ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Int64(234), - ActorType: String("Team"), + ActorID: Ptr(int64(234)), + ActorType: Ptr("Team"), }, }, Conditions: &RulesetConditions{ @@ -336,7 +336,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) RepositoryName: &RulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Bool(true), + Protected: Ptr(true), }, }, Rules: []*RepositoryRule{ @@ -361,15 +361,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }), NewNonFastForwardRule(), NewCommitMessagePatternRule(&RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }), @@ -378,20 +378,20 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) Pattern: "github", }), NewCommitterEmailPatternRule(&RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }), NewBranchNamePatternRule(&RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }), NewTagNamePatternRule(&RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }), @@ -572,16 +572,16 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. ctx := context.Background() ruleset, _, err := client.Organizations.CreateOrganizationRuleset(ctx, "o", &Ruleset{ - ID: Int64(21), + ID: Ptr(int64(21)), Name: "ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Int64(234), - ActorType: String("Team"), + ActorID: Ptr(int64(234)), + ActorType: Ptr("Team"), }, }, Conditions: &RulesetConditions{ @@ -589,7 +589,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: String("custom"), + Source: Ptr("custom"), Values: []string{"true"}, }, }, @@ -623,15 +623,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }), NewNonFastForwardRule(), NewCommitMessagePatternRule(&RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }), @@ -640,20 +640,20 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. Pattern: "github", }), NewCommitterEmailPatternRule(&RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }), NewBranchNamePatternRule(&RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }), NewTagNamePatternRule(&RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }), @@ -673,16 +673,16 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. } want := &Ruleset{ - ID: Int64(21), + ID: Ptr(int64(21)), Name: "ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Int64(234), - ActorType: String("Team"), + ActorID: Ptr(int64(234)), + ActorType: Ptr("Team"), }, }, Conditions: &RulesetConditions{ @@ -690,7 +690,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: String("custom"), + Source: Ptr("custom"), Values: []string{"true"}, }, }, @@ -724,15 +724,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }), NewNonFastForwardRule(), NewCommitMessagePatternRule(&RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }), @@ -741,20 +741,20 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoProperty(t *testing. Pattern: "github", }), NewCommitterEmailPatternRule(&RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }), NewBranchNamePatternRule(&RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }), NewTagNamePatternRule(&RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }), @@ -928,16 +928,16 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { ctx := context.Background() ruleset, _, err := client.Organizations.CreateOrganizationRuleset(ctx, "o", &Ruleset{ - ID: Int64(21), + ID: Ptr(int64(21)), Name: "ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Int64(234), - ActorType: String("Team"), + ActorID: Ptr(int64(234)), + ActorType: Ptr("Team"), }, }, Conditions: &RulesetConditions{ @@ -971,15 +971,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }), NewNonFastForwardRule(), NewCommitMessagePatternRule(&RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }), @@ -988,20 +988,20 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { Pattern: "github", }), NewCommitterEmailPatternRule(&RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }), NewBranchNamePatternRule(&RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }), NewTagNamePatternRule(&RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }), @@ -1021,16 +1021,16 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { } want := &Ruleset{ - ID: Int64(21), + ID: Ptr(int64(21)), Name: "ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", BypassActors: []*BypassActor{ { - ActorID: Int64(234), - ActorType: String("Team"), + ActorID: Ptr(int64(234)), + ActorType: Ptr("Team"), }, }, Conditions: &RulesetConditions{ @@ -1064,15 +1064,15 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, }), NewNonFastForwardRule(), NewCommitMessagePatternRule(&RulePatternParameters{ - Name: String("avoid test commits"), - Negate: Bool(true), + Name: Ptr("avoid test commits"), + Negate: Ptr(true), Operator: "starts_with", Pattern: "[test]", }), @@ -1081,20 +1081,20 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { Pattern: "github", }), NewCommitterEmailPatternRule(&RulePatternParameters{ - Name: String("avoid commit emails"), - Negate: Bool(true), + Name: Ptr("avoid commit emails"), + Negate: Ptr(true), Operator: "ends_with", Pattern: "abc", }), NewBranchNamePatternRule(&RulePatternParameters{ - Name: String("avoid branch names"), - Negate: Bool(true), + Name: Ptr("avoid branch names"), + Negate: Ptr(true), Operator: "regex", Pattern: "github$", }), NewTagNamePatternRule(&RulePatternParameters{ - Name: String("avoid tag names"), - Negate: Bool(true), + Name: Ptr("avoid tag names"), + Negate: Ptr(true), Operator: "contains", Pattern: "github", }), @@ -1180,15 +1180,15 @@ func TestOrganizationsService_GetOrganizationRuleset(t *testing.T) { } want := &Ruleset{ - ID: Int64(26110), + ID: Ptr(int64(26110)), Name: "test ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", - NodeID: String("nid"), + NodeID: Ptr("nid"), Links: &RulesetLinks{ - Self: &RulesetLink{HRef: String("https://api.github.com/orgs/o/rulesets/26110")}, + Self: &RulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/26110")}, }, Conditions: &RulesetConditions{ RefName: &RulesetRefConditionParameters{ @@ -1198,7 +1198,7 @@ func TestOrganizationsService_GetOrganizationRuleset(t *testing.T) { RepositoryName: &RulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Bool(true), + Protected: Ptr(true), }, }, Rules: []*RepositoryRule{ @@ -1269,22 +1269,22 @@ func TestOrganizationsService_GetOrganizationRulesetWithRepoPropCondition(t *tes } want := &Ruleset{ - ID: Int64(26110), + ID: Ptr(int64(26110)), Name: "test ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", - NodeID: String("nid"), + NodeID: Ptr("nid"), Links: &RulesetLinks{ - Self: &RulesetLink{HRef: String("https://api.github.com/orgs/o/rulesets/26110")}, + Self: &RulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/26110")}, }, Conditions: &RulesetConditions{ RepositoryProperty: &RulesetRepositoryPropertyConditionParameters{ Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: String("custom"), + Source: Ptr("custom"), Values: []string{"true"}, }, }, @@ -1362,7 +1362,7 @@ func TestOrganizationsService_UpdateOrganizationRuleset(t *testing.T) { ctx := context.Background() rulesets, _, err := client.Organizations.UpdateOrganizationRuleset(ctx, "o", 26110, &Ruleset{ Name: "test ruleset", - Target: String("branch"), + Target: Ptr("branch"), Enforcement: "active", Conditions: &RulesetConditions{ RefName: &RulesetRefConditionParameters{ @@ -1372,7 +1372,7 @@ func TestOrganizationsService_UpdateOrganizationRuleset(t *testing.T) { RepositoryName: &RulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Bool(true), + Protected: Ptr(true), }, }, Rules: []*RepositoryRule{ @@ -1385,15 +1385,15 @@ func TestOrganizationsService_UpdateOrganizationRuleset(t *testing.T) { } want := &Ruleset{ - ID: Int64(26110), + ID: Ptr(int64(26110)), Name: "test ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", - NodeID: String("nid"), + NodeID: Ptr("nid"), Links: &RulesetLinks{ - Self: &RulesetLink{HRef: String("https://api.github.com/orgs/o/rulesets/26110")}, + Self: &RulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/26110")}, }, Conditions: &RulesetConditions{ RefName: &RulesetRefConditionParameters{ @@ -1403,7 +1403,7 @@ func TestOrganizationsService_UpdateOrganizationRuleset(t *testing.T) { RepositoryName: &RulesetRepositoryNamesConditionParameters{ Include: []string{"important_repository", "another_important_repository"}, Exclude: []string{"unimportant_repository"}, - Protected: Bool(true), + Protected: Ptr(true), }, }, Rules: []*RepositoryRule{ @@ -1470,14 +1470,14 @@ func TestOrganizationsService_UpdateOrganizationRulesetWithRepoProp(t *testing.T ctx := context.Background() rulesets, _, err := client.Organizations.UpdateOrganizationRuleset(ctx, "o", 26110, &Ruleset{ Name: "test ruleset", - Target: String("branch"), + Target: Ptr("branch"), Enforcement: "active", Conditions: &RulesetConditions{ RepositoryProperty: &RulesetRepositoryPropertyConditionParameters{ Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: String("custom"), + Source: Ptr("custom"), Values: []string{"true"}, }, }, @@ -1494,22 +1494,22 @@ func TestOrganizationsService_UpdateOrganizationRulesetWithRepoProp(t *testing.T } want := &Ruleset{ - ID: Int64(26110), + ID: Ptr(int64(26110)), Name: "test ruleset", - Target: String("branch"), - SourceType: String("Organization"), + Target: Ptr("branch"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "active", - NodeID: String("nid"), + NodeID: Ptr("nid"), Links: &RulesetLinks{ - Self: &RulesetLink{HRef: String("https://api.github.com/orgs/o/rulesets/26110")}, + Self: &RulesetLink{HRef: Ptr("https://api.github.com/orgs/o/rulesets/26110")}, }, Conditions: &RulesetConditions{ RepositoryProperty: &RulesetRepositoryPropertyConditionParameters{ Include: []RulesetRepositoryPropertyTargetParameters{ { Name: "testIncludeProp", - Source: String("custom"), + Source: Ptr("custom"), Values: []string{"true"}, }, }, diff --git a/github/orgs_security_managers_test.go b/github/orgs_security_managers_test.go index 336a16a2abd..3ce67d24c03 100644 --- a/github/orgs_security_managers_test.go +++ b/github/orgs_security_managers_test.go @@ -29,7 +29,7 @@ func TestOrganizationsService_ListSecurityManagerTeams(t *testing.T) { t.Errorf("Organizations.ListSecurityManagerTeams returned error: %v", err) } - want := []*Team{{ID: Int64(1)}} + want := []*Team{{ID: Ptr(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 a7412baebac..3866ca78773 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -20,26 +20,26 @@ func TestOrganization_Marshal(t *testing.T) { testJSONMarshal(t, &Organization{}, "{}") o := &Organization{ - BillingEmail: String("support@github.com"), - Blog: String("https://github.com/blog"), - Company: String("GitHub"), - Email: String("support@github.com"), - TwitterUsername: String("github"), - Location: String("San Francisco"), - Name: String("github"), - Description: String("GitHub, the company."), - IsVerified: Bool(true), - HasOrganizationProjects: Bool(true), - HasRepositoryProjects: Bool(true), - DefaultRepoPermission: String("read"), - MembersCanCreateRepos: Bool(true), - MembersCanCreateInternalRepos: Bool(true), - MembersCanCreatePrivateRepos: Bool(true), - MembersCanCreatePublicRepos: Bool(false), - MembersAllowedRepositoryCreationType: String("all"), - MembersCanCreatePages: Bool(true), - MembersCanCreatePublicPages: Bool(false), - MembersCanCreatePrivatePages: Bool(true), + BillingEmail: Ptr("support@github.com"), + Blog: Ptr("https://github.com/blog"), + Company: Ptr("GitHub"), + Email: Ptr("support@github.com"), + TwitterUsername: Ptr("github"), + Location: Ptr("San Francisco"), + Name: Ptr("github"), + Description: Ptr("GitHub, the company."), + IsVerified: Ptr(true), + HasOrganizationProjects: Ptr(true), + HasRepositoryProjects: Ptr(true), + DefaultRepoPermission: Ptr("read"), + MembersCanCreateRepos: Ptr(true), + MembersCanCreateInternalRepos: Ptr(true), + MembersCanCreatePrivateRepos: Ptr(true), + MembersCanCreatePublicRepos: Ptr(false), + MembersAllowedRepositoryCreationType: Ptr("all"), + MembersCanCreatePages: Ptr(true), + MembersCanCreatePublicPages: Ptr(false), + MembersCanCreatePrivatePages: Ptr(true), } want := ` { @@ -86,7 +86,7 @@ func TestOrganizationsService_ListAll(t *testing.T) { t.Errorf("Organizations.ListAll returned error: %v", err) } - want := []*Organization{{ID: Int64(4314092)}} + want := []*Organization{{ID: Ptr(int64(4314092))}} if !cmp.Equal(orgs, want) { t.Errorf("Organizations.ListAll returned %+v, want %+v", orgs, want) } @@ -116,7 +116,7 @@ func TestOrganizationsService_List_authenticatedUser(t *testing.T) { t.Errorf("Organizations.List returned error: %v", err) } - want := []*Organization{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*Organization{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(orgs, want) { t.Errorf("Organizations.List returned %+v, want %+v", orgs, want) } @@ -153,7 +153,7 @@ func TestOrganizationsService_List_specifiedUser(t *testing.T) { t.Errorf("Organizations.List returned error: %v", err) } - want := []*Organization{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*Organization{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(orgs, want) { t.Errorf("Organizations.List returned %+v, want %+v", orgs, want) } @@ -198,7 +198,7 @@ func TestOrganizationsService_Get(t *testing.T) { t.Errorf("Organizations.Get returned error: %v", err) } - want := &Organization{ID: Int64(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")} + want := &Organization{ID: Ptr(int64(1)), Login: Ptr("l"), URL: Ptr("u"), AvatarURL: Ptr("a"), Location: Ptr("l")} if !cmp.Equal(org, want) { t.Errorf("Organizations.Get returned %+v, want %+v", org, want) } @@ -242,7 +242,7 @@ func TestOrganizationsService_GetByID(t *testing.T) { t.Fatalf("Organizations.GetByID returned error: %v", err) } - want := &Organization{ID: Int64(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")} + want := &Organization{ID: Ptr(int64(1)), Login: Ptr("l"), URL: Ptr("u"), AvatarURL: Ptr("a"), Location: Ptr("l")} if !cmp.Equal(org, want) { t.Errorf("Organizations.GetByID returned %+v, want %+v", org, want) } @@ -266,7 +266,7 @@ func TestOrganizationsService_Edit(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Organization{Login: String("l")} + input := &Organization{Login: Ptr("l")} mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) { v := new(Organization) @@ -287,7 +287,7 @@ func TestOrganizationsService_Edit(t *testing.T) { t.Errorf("Organizations.Edit returned error: %v", err) } - want := &Organization{ID: Int64(1)} + want := &Organization{ID: Ptr(int64(1))} if !cmp.Equal(org, want) { t.Errorf("Organizations.Edit returned %+v, want %+v", org, want) } @@ -356,7 +356,7 @@ func TestOrganizationsService_ListInstallations(t *testing.T) { t.Errorf("Organizations.ListInstallations returned error: %v", err) } - want := &OrganizationInstallations{TotalCount: Int(1), Installations: []*Installation{{ID: Int64(1), AppID: Int64(5)}}} + want := &OrganizationInstallations{TotalCount: Ptr(1), Installations: []*Installation{{ID: Ptr(int64(1)), AppID: Ptr(int64(5))}}} if !cmp.Equal(apps, want) { t.Errorf("Organizations.ListInstallations returned %+v, want %+v", apps, want) } @@ -401,7 +401,7 @@ func TestOrganizationsService_ListInstallations_withListOptions(t *testing.T) { t.Errorf("Organizations.ListInstallations returned error: %v", err) } - want := &OrganizationInstallations{TotalCount: Int(2), Installations: []*Installation{{ID: Int64(2), AppID: Int64(10)}}} + want := &OrganizationInstallations{TotalCount: Ptr(2), Installations: []*Installation{{ID: Ptr(int64(2)), AppID: Ptr(int64(10))}}} if !cmp.Equal(apps, want) { t.Errorf("Organizations.ListInstallations returned %+v, want %+v", apps, want) } @@ -432,8 +432,8 @@ func TestOrganizationInstallations_Marshal(t *testing.T) { testJSONMarshal(t, &OrganizationInstallations{}, "{}") o := &OrganizationInstallations{ - TotalCount: Int(1), - Installations: []*Installation{{ID: Int64(1)}}, + TotalCount: Ptr(1), + Installations: []*Installation{{ID: Ptr(int64(1))}}, } want := `{ "total_count": 1, @@ -452,12 +452,12 @@ func TestPlan_Marshal(t *testing.T) { testJSONMarshal(t, &Plan{}, "{}") o := &Plan{ - Name: String("name"), - Space: Int(1), - Collaborators: Int(1), - PrivateRepos: Int64(1), - FilledSeats: Int(1), - Seats: Int(1), + Name: Ptr("name"), + Space: Ptr(1), + Collaborators: Ptr(1), + PrivateRepos: Ptr(int64(1)), + FilledSeats: Ptr(1), + Seats: Ptr(1), } want := `{ "name": "name", diff --git a/github/orgs_users_blocking_test.go b/github/orgs_users_blocking_test.go index b544f3a49cc..82172fb033e 100644 --- a/github/orgs_users_blocking_test.go +++ b/github/orgs_users_blocking_test.go @@ -34,7 +34,7 @@ func TestOrganizationsService_ListBlockedUsers(t *testing.T) { t.Errorf("Organizations.ListBlockedUsers returned error: %v", err) } - want := []*User{{Login: String("octocat")}} + want := []*User{{Login: Ptr("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 d4e33989642..718998f7efd 100644 --- a/github/packages_test.go +++ b/github/packages_test.go @@ -12,11 +12,11 @@ func TestPackageRegistry_Marshal(t *testing.T) { testJSONMarshal(t, &PackageRegistry{}, "{}") o := &PackageRegistry{ - AboutURL: String("aurl"), - Name: String("name"), - Type: String("type"), - URL: String("url"), - Vendor: String("vendor"), + AboutURL: Ptr("aurl"), + Name: Ptr("name"), + Type: Ptr("type"), + URL: Ptr("url"), + Vendor: Ptr("vendor"), } want := `{ "about_url": "aurl", @@ -34,35 +34,35 @@ func TestPackageFile_Marshal(t *testing.T) { testJSONMarshal(t, &PackageFile{}, "{}") o := &PackageFile{ - DownloadURL: String("durl"), - ID: Int64(1), - Name: String("name"), - SHA256: String("sha256"), - SHA1: String("sha1"), - MD5: String("md5"), - ContentType: String("ct"), - State: String("state"), + DownloadURL: Ptr("durl"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + SHA256: Ptr("sha256"), + SHA1: Ptr("sha1"), + MD5: Ptr("md5"), + ContentType: Ptr("ct"), + State: Ptr("state"), Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Size: Int64(1), + Size: Ptr(int64(1)), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -109,34 +109,34 @@ func TestPackageRelease_Marshal(t *testing.T) { testJSONMarshal(t, &PackageRelease{}, "{}") o := &PackageRelease{ - URL: String("url"), - HTMLURL: String("hurl"), - ID: Int64(1), - TagName: String("tn"), - TargetCommitish: String("tcs"), - Name: String("name"), - Draft: Bool(true), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + ID: Ptr(int64(1)), + TagName: Ptr("tn"), + TargetCommitish: Ptr("tcs"), + Name: Ptr("name"), + Draft: Ptr(true), Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Prerelease: Bool(true), + Prerelease: Ptr(true), CreatedAt: &Timestamp{referenceTime}, PublishedAt: &Timestamp{referenceTime}, } @@ -182,108 +182,108 @@ func TestPackageVersion_Marshal(t *testing.T) { testJSONMarshal(t, &PackageVersion{}, "{}") o := &PackageVersion{ - ID: Int64(1), - Version: String("ver"), - Summary: String("sum"), - Body: String("body"), - BodyHTML: String("btnhtml"), + ID: Ptr(int64(1)), + Version: Ptr("ver"), + Summary: Ptr("sum"), + Body: Ptr("body"), + BodyHTML: Ptr("btnhtml"), Release: &PackageRelease{ - URL: String("url"), - HTMLURL: String("hurl"), - ID: Int64(1), - TagName: String("tn"), - TargetCommitish: String("tcs"), - Name: String("name"), - Draft: Bool(true), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + ID: Ptr(int64(1)), + TagName: Ptr("tn"), + TargetCommitish: Ptr("tcs"), + Name: Ptr("name"), + Draft: Ptr(true), Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Prerelease: Bool(true), + Prerelease: Ptr(true), CreatedAt: &Timestamp{referenceTime}, PublishedAt: &Timestamp{referenceTime}, }, - Manifest: String("mani"), - HTMLURL: String("hurl"), - TagName: String("tn"), - TargetCommitish: String("tcs"), - TargetOID: String("tid"), - Draft: Bool(true), - Prerelease: Bool(true), + Manifest: Ptr("mani"), + HTMLURL: Ptr("hurl"), + TagName: Ptr("tn"), + TargetCommitish: Ptr("tcs"), + TargetOID: Ptr("tid"), + Draft: Ptr(true), + Prerelease: Ptr(true), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, PackageFiles: []*PackageFile{ { - DownloadURL: String("durl"), - ID: Int64(1), - Name: String("name"), - SHA256: String("sha256"), - SHA1: String("sha1"), - MD5: String("md5"), - ContentType: String("ct"), - State: String("state"), + DownloadURL: Ptr("durl"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + SHA256: Ptr("sha256"), + SHA1: Ptr("sha1"), + MD5: Ptr("md5"), + ContentType: Ptr("ct"), + State: Ptr("state"), Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Size: Int64(1), + Size: Ptr(int64(1)), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, }, Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - InstallationCommand: String("ic"), + InstallationCommand: Ptr("ic"), } want := `{ @@ -399,143 +399,143 @@ func TestPackage_Marshal(t *testing.T) { testJSONMarshal(t, &Package{}, "{}") o := &Package{ - ID: Int64(1), - Name: String("name"), - PackageType: String("pt"), - HTMLURL: String("hurl"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + PackageType: Ptr("pt"), + HTMLURL: Ptr("hurl"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Visibility: String("private"), + Visibility: Ptr("private"), Owner: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, PackageVersion: &PackageVersion{ - ID: Int64(1), - Version: String("ver"), - Summary: String("sum"), - Body: String("body"), - BodyHTML: String("btnhtml"), + ID: Ptr(int64(1)), + Version: Ptr("ver"), + Summary: Ptr("sum"), + Body: Ptr("body"), + BodyHTML: Ptr("btnhtml"), Release: &PackageRelease{ - URL: String("url"), - HTMLURL: String("hurl"), - ID: Int64(1), - TagName: String("tn"), - TargetCommitish: String("tcs"), - Name: String("name"), - Draft: Bool(true), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + ID: Ptr(int64(1)), + TagName: Ptr("tn"), + TargetCommitish: Ptr("tcs"), + Name: Ptr("name"), + Draft: Ptr(true), Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Prerelease: Bool(true), + Prerelease: Ptr(true), CreatedAt: &Timestamp{referenceTime}, PublishedAt: &Timestamp{referenceTime}, }, - Manifest: String("mani"), - HTMLURL: String("hurl"), - TagName: String("tn"), - TargetCommitish: String("tcs"), - TargetOID: String("tid"), - Draft: Bool(true), - Prerelease: Bool(true), + Manifest: Ptr("mani"), + HTMLURL: Ptr("hurl"), + TagName: Ptr("tn"), + TargetCommitish: Ptr("tcs"), + TargetOID: Ptr("tid"), + Draft: Ptr(true), + Prerelease: Ptr(true), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, PackageFiles: []*PackageFile{ { - DownloadURL: String("durl"), - ID: Int64(1), - Name: String("name"), - SHA256: String("sha256"), - SHA1: String("sha1"), - MD5: String("md5"), - ContentType: String("ct"), - State: String("state"), + DownloadURL: Ptr("durl"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + SHA256: Ptr("sha256"), + SHA1: Ptr("sha1"), + MD5: Ptr("md5"), + ContentType: Ptr("ct"), + State: Ptr("state"), Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Size: Int64(1), + Size: Ptr(int64(1)), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, }, Author: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - InstallationCommand: String("ic"), + InstallationCommand: Ptr("ic"), }, Registry: &PackageRegistry{ - AboutURL: String("aurl"), - Name: String("name"), - Type: String("type"), - URL: String("url"), - Vendor: String("vendor"), + AboutURL: Ptr("aurl"), + Name: Ptr("name"), + Type: Ptr("type"), + URL: Ptr("url"), + Vendor: Ptr("vendor"), }, } diff --git a/github/projects_test.go b/github/projects_test.go index e69f8b6725d..f02e2a725a4 100644 --- a/github/projects_test.go +++ b/github/projects_test.go @@ -20,34 +20,34 @@ func TestProject_Marshal(t *testing.T) { testJSONMarshal(t, &Project{}, "{}") u := &Project{ - ID: Int64(1), - URL: String("u"), - HTMLURL: String("h"), - ColumnsURL: String("c"), - OwnerURL: String("o"), - Name: String("n"), - Body: String("b"), - Number: Int(1), - State: String("s"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + HTMLURL: Ptr("h"), + ColumnsURL: Ptr("c"), + OwnerURL: Ptr("o"), + Name: Ptr("n"), + Body: Ptr("b"), + Number: Ptr(1), + State: Ptr("s"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - NodeID: String("n"), + NodeID: Ptr("n"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, } want := `{ @@ -89,12 +89,12 @@ func TestProjectsService_UpdateProject(t *testing.T) { client, mux, _ := setup(t) input := &ProjectOptions{ - Name: String("Project Name"), - Body: String("Project body."), - State: String("open"), - Private: Bool(false), + Name: Ptr("Project Name"), + Body: Ptr("Project body."), + State: Ptr("open"), + Private: Ptr(false), - OrganizationPermission: String("read"), + OrganizationPermission: Ptr("read"), } mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) { @@ -116,7 +116,7 @@ func TestProjectsService_UpdateProject(t *testing.T) { t.Errorf("Projects.UpdateProject returned error: %v", err) } - want := &Project{ID: Int64(1)} + want := &Project{ID: Ptr(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Projects.UpdateProject returned %+v, want %+v", project, want) } @@ -152,7 +152,7 @@ func TestProjectsService_GetProject(t *testing.T) { t.Errorf("Projects.GetProject returned error: %v", err) } - want := &Project{ID: Int64(1)} + want := &Project{ID: Ptr(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Projects.GetProject returned %+v, want %+v", project, want) } @@ -216,7 +216,7 @@ func TestProjectsService_ListProjectColumns(t *testing.T) { t.Errorf("Projects.ListProjectColumns returned error: %v", err) } - want := []*ProjectColumn{{ID: Int64(1)}} + want := []*ProjectColumn{{ID: Ptr(int64(1))}} if !cmp.Equal(columns, want) { t.Errorf("Projects.ListProjectColumns returned %+v, want %+v", columns, want) } @@ -252,7 +252,7 @@ func TestProjectsService_GetProjectColumn(t *testing.T) { t.Errorf("Projects.GetProjectColumn returned error: %v", err) } - want := &ProjectColumn{ID: Int64(1)} + want := &ProjectColumn{ID: Ptr(int64(1))} if !cmp.Equal(column, want) { t.Errorf("Projects.GetProjectColumn returned %+v, want %+v", column, want) } @@ -297,7 +297,7 @@ func TestProjectsService_CreateProjectColumn(t *testing.T) { t.Errorf("Projects.CreateProjectColumn returned error: %v", err) } - want := &ProjectColumn{ID: Int64(1)} + want := &ProjectColumn{ID: Ptr(int64(1))} if !cmp.Equal(column, want) { t.Errorf("Projects.CreateProjectColumn returned %+v, want %+v", column, want) } @@ -342,7 +342,7 @@ func TestProjectsService_UpdateProjectColumn(t *testing.T) { t.Errorf("Projects.UpdateProjectColumn returned error: %v", err) } - want := &ProjectColumn{ID: Int64(1)} + want := &ProjectColumn{ID: Ptr(int64(1))} if !cmp.Equal(column, want) { t.Errorf("Projects.UpdateProjectColumn returned %+v, want %+v", column, want) } @@ -436,7 +436,7 @@ func TestProjectsService_ListProjectCards(t *testing.T) { }) opt := &ProjectCardListOptions{ - ArchivedState: String("all"), + ArchivedState: Ptr("all"), ListOptions: ListOptions{Page: 2}} ctx := context.Background() cards, _, err := client.Projects.ListProjectCards(ctx, 1, opt) @@ -444,7 +444,7 @@ func TestProjectsService_ListProjectCards(t *testing.T) { t.Errorf("Projects.ListProjectCards returned error: %v", err) } - want := []*ProjectCard{{ID: Int64(1)}} + want := []*ProjectCard{{ID: Ptr(int64(1))}} if !cmp.Equal(cards, want) { t.Errorf("Projects.ListProjectCards returned %+v, want %+v", cards, want) } @@ -480,7 +480,7 @@ func TestProjectsService_GetProjectCard(t *testing.T) { t.Errorf("Projects.GetProjectCard returned error: %v", err) } - want := &ProjectCard{ID: Int64(1)} + want := &ProjectCard{ID: Ptr(int64(1))} if !cmp.Equal(card, want) { t.Errorf("Projects.GetProjectCard returned %+v, want %+v", card, want) } @@ -528,7 +528,7 @@ func TestProjectsService_CreateProjectCard(t *testing.T) { t.Errorf("Projects.CreateProjectCard returned error: %v", err) } - want := &ProjectCard{ID: Int64(1)} + want := &ProjectCard{ID: Ptr(int64(1))} if !cmp.Equal(card, want) { t.Errorf("Projects.CreateProjectCard returned %+v, want %+v", card, want) } @@ -576,7 +576,7 @@ func TestProjectsService_UpdateProjectCard(t *testing.T) { t.Errorf("Projects.UpdateProjectCard returned error: %v", err) } - want := &ProjectCard{ID: Int64(1), Archived: Bool(false)} + want := &ProjectCard{ID: Ptr(int64(1)), Archived: Ptr(false)} if !cmp.Equal(card, want) { t.Errorf("Projects.UpdateProjectCard returned %+v, want %+v", card, want) } @@ -661,7 +661,7 @@ func TestProjectsService_AddProjectCollaborator(t *testing.T) { client, mux, _ := setup(t) opt := &ProjectCollaboratorOptions{ - Permission: String("admin"), + Permission: Ptr("admin"), } mux.HandleFunc("/projects/1/collaborators/u", func(w http.ResponseWriter, r *http.Request) { @@ -759,7 +759,7 @@ func TestProjectsService_ListCollaborators(t *testing.T) { t.Errorf("Projects.ListProjectCollaborators returned error: %v", err) } - want := []*User{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Projects.ListProjectCollaborators returned %+v, want %+v", users, want) } @@ -792,7 +792,7 @@ func TestProjectsService_ListCollaborators_withAffiliation(t *testing.T) { opt := &ListCollaboratorOptions{ ListOptions: ListOptions{Page: 2}, - Affiliation: String("all"), + Affiliation: Ptr("all"), } ctx := context.Background() users, _, err := client.Projects.ListProjectCollaborators(ctx, 1, opt) @@ -800,7 +800,7 @@ func TestProjectsService_ListCollaborators_withAffiliation(t *testing.T) { t.Errorf("Projects.ListProjectCollaborators returned error: %v", err) } - want := []*User{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Projects.ListProjectCollaborators returned %+v, want %+v", users, want) } @@ -823,9 +823,9 @@ func TestProjectsService_ReviewProjectCollaboratorPermission(t *testing.T) { } want := &ProjectPermissionLevel{ - Permission: String("admin"), + Permission: Ptr("admin"), User: &User{ - Login: String("u"), + Login: Ptr("u"), }, } @@ -853,11 +853,11 @@ func TestProjectOptions_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectOptions{}, "{}") u := &ProjectOptions{ - Name: String("name"), - Body: String("body"), - State: String("state"), - OrganizationPermission: String("op"), - Private: Bool(false), + Name: Ptr("name"), + Body: Ptr("body"), + State: Ptr("state"), + OrganizationPermission: Ptr("op"), + Private: Ptr(false), } want := `{ @@ -876,14 +876,14 @@ func TestProjectColumn_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectColumn{}, "{}") u := &ProjectColumn{ - ID: Int64(1), - Name: String("name"), - URL: String("url"), - ProjectURL: String("purl"), - CardsURL: String("curl"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + URL: Ptr("url"), + ProjectURL: Ptr("purl"), + CardsURL: Ptr("curl"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - NodeID: String("onidp"), + NodeID: Ptr("onidp"), } want := `{ @@ -935,40 +935,40 @@ func TestProjectCard_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectCard{}, "{}") u := &ProjectCard{ - URL: String("url"), - ColumnURL: String("curl"), - ContentURL: String("conurl"), - ID: Int64(1), - Note: String("note"), + URL: Ptr("url"), + ColumnURL: Ptr("curl"), + ContentURL: Ptr("conurl"), + ID: Ptr(int64(1)), + Note: Ptr("note"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - NodeID: String("nid"), - Archived: Bool(true), - ColumnID: Int64(1), - ProjectID: Int64(1), - ProjectURL: String("purl"), - ColumnName: String("cn"), - PreviousColumnName: String("pcn"), + NodeID: Ptr("nid"), + Archived: Ptr(true), + ColumnID: Ptr(int64(1)), + ProjectID: Ptr(int64(1)), + ProjectURL: Ptr("purl"), + ColumnName: Ptr("cn"), + PreviousColumnName: Ptr("pcn"), } want := `{ @@ -1019,7 +1019,7 @@ func TestProjectCardOptions_Marshal(t *testing.T) { Note: "note", ContentID: 1, ContentType: "ct", - Archived: Bool(false), + Archived: Ptr(false), } want := `{ @@ -1054,7 +1054,7 @@ func TestProjectCollaboratorOptions_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectCollaboratorOptions{}, "{}") u := &ProjectCollaboratorOptions{ - Permission: String("per"), + Permission: Ptr("per"), } want := `{ @@ -1069,24 +1069,24 @@ func TestProjectPermissionLevel_Marshal(t *testing.T) { testJSONMarshal(t, &ProjectPermissionLevel{}, "{}") u := &ProjectPermissionLevel{ - Permission: String("per"), + Permission: Ptr("per"), User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go index 0df6f020a2c..3df530662d0 100644 --- a/github/pulls_comments_test.go +++ b/github/pulls_comments_test.go @@ -24,58 +24,58 @@ func TestPullComments_Marshal(t *testing.T) { createdAt := Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)} updatedAt := Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)} reactions := &Reactions{ - TotalCount: Int(1), - PlusOne: Int(1), - MinusOne: Int(0), - Laugh: Int(0), - Confused: Int(0), - Heart: Int(0), - Hooray: Int(0), - Rocket: Int(0), - Eyes: Int(0), - URL: String("u"), + TotalCount: Ptr(1), + PlusOne: Ptr(1), + MinusOne: Ptr(0), + Laugh: Ptr(0), + Confused: Ptr(0), + Heart: Ptr(0), + Hooray: Ptr(0), + Rocket: Ptr(0), + Eyes: Ptr(0), + URL: Ptr("u"), } u := &PullRequestComment{ - ID: Int64(10), - InReplyTo: Int64(8), - Body: String("Test comment"), - Path: String("file1.txt"), - DiffHunk: String("@@ -16,33 +16,40 @@ fmt.Println()"), - PullRequestReviewID: Int64(42), - Position: Int(1), - OriginalPosition: Int(4), - StartLine: Int(2), - Line: Int(3), - OriginalLine: Int(2), - OriginalStartLine: Int(2), - Side: String("RIGHT"), - StartSide: String("LEFT"), - CommitID: String("ab"), - OriginalCommitID: String("9c"), + ID: Ptr(int64(10)), + InReplyTo: Ptr(int64(8)), + Body: Ptr("Test comment"), + Path: Ptr("file1.txt"), + DiffHunk: Ptr("@@ -16,33 +16,40 @@ fmt.Println()"), + PullRequestReviewID: Ptr(int64(42)), + Position: Ptr(1), + OriginalPosition: Ptr(4), + StartLine: Ptr(2), + Line: Ptr(3), + OriginalLine: Ptr(2), + OriginalStartLine: Ptr(2), + Side: Ptr("RIGHT"), + StartSide: Ptr("LEFT"), + CommitID: Ptr("ab"), + OriginalCommitID: Ptr("9c"), User: &User{ - Login: String("ll"), - ID: Int64(123), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("ll"), + ID: Ptr(int64(123)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }, Reactions: reactions, CreatedAt: &createdAt, UpdatedAt: &updatedAt, - URL: String("pullrequestcommentUrl"), - HTMLURL: String("pullrequestcommentHTMLUrl"), - PullRequestURL: String("pullrequestcommentPullRequestURL"), + URL: Ptr("pullrequestcommentUrl"), + HTMLURL: Ptr("pullrequestcommentHTMLUrl"), + PullRequestURL: Ptr("pullrequestcommentPullRequestURL"), } want := `{ @@ -163,7 +163,7 @@ func TestPullRequestsService_ListComments_allPulls(t *testing.T) { t.Errorf("PullRequests.ListComments returned error: %v", err) } - want := []*PullRequestComment{{ID: Int64(1)}} + want := []*PullRequestComment{{ID: Ptr(int64(1))}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want) } @@ -200,7 +200,7 @@ func TestPullRequestsService_ListComments_specificPull(t *testing.T) { t.Errorf("PullRequests.ListComments returned error: %v", err) } - want := []*PullRequestComment{{ID: Int64(1), PullRequestReviewID: Int64(42)}} + want := []*PullRequestComment{{ID: Ptr(int64(1)), PullRequestReviewID: Ptr(int64(42))}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want) } @@ -232,7 +232,7 @@ func TestPullRequestsService_GetComment(t *testing.T) { t.Errorf("PullRequests.GetComment returned error: %v", err) } - want := &PullRequestComment{ID: Int64(1)} + want := &PullRequestComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("PullRequests.GetComment returned %+v, want %+v", comment, want) } @@ -265,7 +265,7 @@ func TestPullRequestsService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &PullRequestComment{Body: String("b")} + input := &PullRequestComment{Body: Ptr("b")} wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { @@ -288,7 +288,7 @@ func TestPullRequestsService_CreateComment(t *testing.T) { t.Errorf("PullRequests.CreateComment returned error: %v", err) } - want := &PullRequestComment{ID: Int64(1)} + want := &PullRequestComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("PullRequests.CreateComment returned %+v, want %+v", comment, want) } @@ -321,7 +321,7 @@ func TestPullRequestsService_CreateCommentInReplyTo(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &PullRequestComment{Body: String("b")} + input := &PullRequestComment{Body: Ptr("b")} mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestComment) @@ -341,7 +341,7 @@ func TestPullRequestsService_CreateCommentInReplyTo(t *testing.T) { t.Errorf("PullRequests.CreateCommentInReplyTo returned error: %v", err) } - want := &PullRequestComment{ID: Int64(1)} + want := &PullRequestComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("PullRequests.CreateCommentInReplyTo returned %+v, want %+v", comment, want) } @@ -365,7 +365,7 @@ func TestPullRequestsService_EditComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &PullRequestComment{Body: String("b")} + input := &PullRequestComment{Body: Ptr("b")} mux.HandleFunc("/repos/o/r/pulls/comments/1", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestComment) @@ -385,7 +385,7 @@ func TestPullRequestsService_EditComment(t *testing.T) { t.Errorf("PullRequests.EditComment returned error: %v", err) } - want := &PullRequestComment{ID: Int64(1)} + want := &PullRequestComment{ID: Ptr(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 dfe7e6b7216..53b8d521beb 100644 --- a/github/pulls_reviewers_test.go +++ b/github/pulls_reviewers_test.go @@ -19,7 +19,7 @@ func TestReviewersRequest_Marshal(t *testing.T) { testJSONMarshal(t, &ReviewersRequest{}, "{}") u := &ReviewersRequest{ - NodeID: String("n"), + NodeID: Ptr("n"), Reviewers: []string{"r"}, TeamReviewers: []string{"t"}, } @@ -43,38 +43,38 @@ func TestReviewers_Marshal(t *testing.T) { u := &Reviewers{ Users: []*User{{ - Login: String("l"), - ID: Int64(1), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), }}, Teams: []*Team{{ - ID: Int64(1), - NodeID: String("node"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("priv"), - MembersCount: Int(1), - ReposCount: Int(1), + ID: Ptr(int64(1)), + NodeID: Ptr("node"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("priv"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), Organization: nil, - MembersURL: String("m"), - RepositoriesURL: String("r"), + MembersURL: Ptr("m"), + RepositoriesURL: Ptr("r"), Parent: nil, - LDAPDN: String("l"), + LDAPDN: Ptr("l"), }}, } @@ -136,7 +136,7 @@ func TestRequestReviewers(t *testing.T) { if err != nil { t.Errorf("PullRequests.RequestReviewers returned error: %v", err) } - want := &PullRequest{Number: Int(1)} + want := &PullRequest{Number: Ptr(1)} if !cmp.Equal(got, want) { t.Errorf("PullRequests.RequestReviewers returned %+v, want %+v", got, want) } @@ -211,14 +211,14 @@ func TestListReviewers(t *testing.T) { want := &Reviewers{ Users: []*User{ { - Login: String("octocat"), - ID: Int64(1), + Login: Ptr("octocat"), + ID: Ptr(int64(1)), }, }, Teams: []*Team{ { - ID: Int64(1), - Name: String("Justice League"), + ID: Ptr(int64(1)), + Name: Ptr("Justice League"), }, }, } diff --git a/github/pulls_reviews_test.go b/github/pulls_reviews_test.go index c7c5b62bec5..2417f765376 100644 --- a/github/pulls_reviews_test.go +++ b/github/pulls_reviews_test.go @@ -35,8 +35,8 @@ func TestPullRequestsService_ListReviews(t *testing.T) { } want := []*PullRequestReview{ - {ID: Int64(1)}, - {ID: Int64(2)}, + {ID: Ptr(int64(1))}, + {ID: Ptr(int64(2))}, } if !cmp.Equal(reviews, want) { t.Errorf("PullRequests.ListReviews returned %+v, want %+v", reviews, want) @@ -81,7 +81,7 @@ func TestPullRequestsService_GetReview(t *testing.T) { t.Errorf("PullRequests.GetReview returned error: %v", err) } - want := &PullRequestReview{ID: Int64(1)} + want := &PullRequestReview{ID: Ptr(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.GetReview returned %+v, want %+v", review, want) } @@ -125,7 +125,7 @@ func TestPullRequestsService_DeletePendingReview(t *testing.T) { t.Errorf("PullRequests.DeletePendingReview returned error: %v", err) } - want := &PullRequestReview{ID: Int64(1)} + want := &PullRequestReview{ID: Ptr(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.DeletePendingReview returned %+v, want %+v", review, want) } @@ -170,8 +170,8 @@ func TestPullRequestsService_ListReviewComments(t *testing.T) { } want := []*PullRequestComment{ - {ID: Int64(1)}, - {ID: Int64(2)}, + {ID: Ptr(int64(1))}, + {ID: Ptr(int64(2))}, } if !cmp.Equal(comments, want) { t.Errorf("PullRequests.ListReviewComments returned %+v, want %+v", comments, want) @@ -361,9 +361,9 @@ func TestPullRequestsService_CreateReview(t *testing.T) { client, mux, _ := setup(t) input := &PullRequestReviewRequest{ - CommitID: String("commit_id"), - Body: String("b"), - Event: String("APPROVE"), + CommitID: Ptr("commit_id"), + Body: Ptr("b"), + Event: Ptr("APPROVE"), } mux.HandleFunc("/repos/o/r/pulls/1/reviews", func(w http.ResponseWriter, r *http.Request) { @@ -384,7 +384,7 @@ func TestPullRequestsService_CreateReview(t *testing.T) { t.Errorf("PullRequests.CreateReview returned error: %v", err) } - want := &PullRequestReview{ID: Int64(1)} + want := &PullRequestReview{ID: Ptr(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.CreateReview returned %+v, want %+v", review, want) } @@ -504,7 +504,7 @@ func TestPullRequestsService_UpdateReview(t *testing.T) { t.Errorf("PullRequests.UpdateReview returned error: %v", err) } - want := &PullRequestReview{ID: Int64(1)} + want := &PullRequestReview{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("PullRequests.UpdateReview = %+v, want %+v", got, want) } @@ -529,8 +529,8 @@ func TestPullRequestsService_SubmitReview(t *testing.T) { client, mux, _ := setup(t) input := &PullRequestReviewRequest{ - Body: String("b"), - Event: String("APPROVE"), + Body: Ptr("b"), + Event: Ptr("APPROVE"), } mux.HandleFunc("/repos/o/r/pulls/1/reviews/1/events", func(w http.ResponseWriter, r *http.Request) { @@ -551,7 +551,7 @@ func TestPullRequestsService_SubmitReview(t *testing.T) { t.Errorf("PullRequests.SubmitReview returned error: %v", err) } - want := &PullRequestReview{ID: Int64(1)} + want := &PullRequestReview{ID: Ptr(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.SubmitReview returned %+v, want %+v", review, want) } @@ -584,7 +584,7 @@ func TestPullRequestsService_DismissReview(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &PullRequestReviewDismissalRequest{Message: String("m")} + input := &PullRequestReviewDismissalRequest{Message: Ptr("m")} mux.HandleFunc("/repos/o/r/pulls/1/reviews/1/dismissals", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestReviewDismissalRequest) @@ -604,7 +604,7 @@ func TestPullRequestsService_DismissReview(t *testing.T) { t.Errorf("PullRequests.DismissReview returned error: %v", err) } - want := &PullRequestReview{ID: Int64(1)} + want := &PullRequestReview{ID: Ptr(int64(1))} if !cmp.Equal(review, want) { t.Errorf("PullRequests.DismissReview returned %+v, want %+v", review, want) } @@ -638,7 +638,7 @@ func TestPullRequestReviewDismissalRequest_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestReviewDismissalRequest{}, "{}") u := &PullRequestReviewDismissalRequest{ - Message: String("msg"), + Message: Ptr("msg"), } want := `{ @@ -653,13 +653,13 @@ func TestDraftReviewComment_Marshal(t *testing.T) { testJSONMarshal(t, &DraftReviewComment{}, "{}") u := &DraftReviewComment{ - Path: String("path"), - Position: Int(1), - Body: String("body"), - StartSide: String("ss"), - Side: String("side"), - StartLine: Int(1), - Line: Int(1), + Path: Ptr("path"), + Position: Ptr(1), + Body: Ptr("body"), + StartSide: Ptr("ss"), + Side: Ptr("side"), + StartLine: Ptr(1), + Line: Ptr(1), } want := `{ @@ -680,19 +680,19 @@ func TestPullRequestReviewRequest_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestReviewRequest{}, "{}") u := &PullRequestReviewRequest{ - NodeID: String("nodeid"), - CommitID: String("cid"), - Body: String("body"), - Event: String("event"), + NodeID: Ptr("nodeid"), + CommitID: Ptr("cid"), + Body: Ptr("body"), + Event: Ptr("event"), Comments: []*DraftReviewComment{ { - Path: String("path"), - Position: Int(1), - Body: String("body"), - StartSide: String("ss"), - Side: String("side"), - StartLine: Int(1), - Line: Int(1), + Path: Ptr("path"), + Position: Ptr(1), + Body: Ptr("body"), + StartSide: Ptr("ss"), + Side: Ptr("side"), + StartLine: Ptr(1), + Line: Ptr(1), }, }, } @@ -723,35 +723,35 @@ func TestPullRequestReview_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestReview{}, "{}") u := &PullRequestReview{ - ID: Int64(1), - NodeID: String("nid"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Body: String("body"), + Body: Ptr("body"), SubmittedAt: &Timestamp{referenceTime}, - CommitID: String("cid"), - HTMLURL: String("hurl"), - PullRequestURL: String("prurl"), - State: String("state"), - AuthorAssociation: String("aa"), + CommitID: Ptr("cid"), + HTMLURL: Ptr("hurl"), + PullRequestURL: Ptr("prurl"), + State: Ptr("state"), + AuthorAssociation: Ptr("aa"), } want := `{ diff --git a/github/pulls_test.go b/github/pulls_test.go index b4e9e87d2af..4a48bdb08ae 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -41,7 +41,7 @@ func TestPullRequestsService_List(t *testing.T) { t.Errorf("PullRequests.List returned error: %v", err) } - want := []*PullRequest{{Number: Int(1)}} + want := []*PullRequest{{Number: Ptr(1)}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.List returned %+v, want %+v", pulls, want) } @@ -81,7 +81,7 @@ func TestPullRequestsService_ListPullRequestsWithCommit(t *testing.T) { t.Errorf("PullRequests.ListPullRequestsWithCommit returned error: %v", err) } - want := []*PullRequest{{Number: Int(1)}} + want := []*PullRequest{{Number: Ptr(1)}} if !cmp.Equal(pulls, want) { t.Errorf("PullRequests.ListPullRequestsWithCommit returned %+v, want %+v", pulls, want) } @@ -125,7 +125,7 @@ func TestPullRequestsService_Get(t *testing.T) { t.Errorf("PullRequests.Get returned error: %v", err) } - want := &PullRequest{Number: Int(1)} + want := &PullRequest{Number: Ptr(1)} if !cmp.Equal(pull, want) { t.Errorf("PullRequests.Get returned %+v, want %+v", pull, want) } @@ -247,24 +247,24 @@ func TestPullRequestsService_Get_links(t *testing.T) { } want := &PullRequest{ - Number: Int(1), + Number: Ptr(1), Links: &PRLinks{ Self: &PRLink{ - HRef: String("https://api.github.com/repos/octocat/Hello-World/pulls/1347"), + HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347"), }, HTML: &PRLink{ - HRef: String("https://github.com/octocat/Hello-World/pull/1347"), + HRef: Ptr("https://github.com/octocat/Hello-World/pull/1347"), }, Issue: &PRLink{ - HRef: String("https://api.github.com/repos/octocat/Hello-World/issues/1347"), + HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/issues/1347"), }, Comments: &PRLink{ - HRef: String("https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"), + HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"), }, ReviewComments: &PRLink{ - HRef: String("https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"), + HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"), }, ReviewComment: &PRLink{ - HRef: String("https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"), + HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"), }, Commits: &PRLink{ - HRef: String("https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"), + HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"), }, Statuses: &PRLink{ - HRef: String("https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"), + HRef: Ptr("https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"), }, }, } @@ -289,14 +289,14 @@ func TestPullRequestsService_Get_headAndBase(t *testing.T) { } want := &PullRequest{ - Number: Int(1), + Number: Ptr(1), Head: &PullRequestBranch{ - Ref: String("r2"), - Repo: &Repository{ID: Int64(2)}, + Ref: Ptr("r2"), + Repo: &Repository{ID: Ptr(int64(2))}, }, Base: &PullRequestBranch{ - Ref: String("r1"), - Repo: &Repository{ID: Int64(1)}, + Ref: Ptr("r1"), + Repo: &Repository{ID: Ptr(int64(1))}, }, } if !cmp.Equal(pull, want) { @@ -328,15 +328,15 @@ func TestPullRequestsService_Get_urlFields(t *testing.T) { } want := &PullRequest{ - Number: Int(1), - URL: String("https://api.github.com/repos/octocat/Hello-World/pulls/1347"), - HTMLURL: String("https://github.com/octocat/Hello-World/pull/1347"), - IssueURL: String("https://api.github.com/repos/octocat/Hello-World/issues/1347"), - StatusesURL: String("https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"), - DiffURL: String("https://github.com/octocat/Hello-World/pull/1347.diff"), - PatchURL: String("https://github.com/octocat/Hello-World/pull/1347.patch"), - ReviewCommentsURL: String("https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"), - ReviewCommentURL: String("https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"), + 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}"), } if !cmp.Equal(pull, want) { @@ -357,7 +357,7 @@ func TestPullRequestsService_Create(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &NewPullRequest{Title: String("t")} + input := &NewPullRequest{Title: Ptr("t")} mux.HandleFunc("/repos/o/r/pulls", func(w http.ResponseWriter, r *http.Request) { v := new(NewPullRequest) @@ -377,7 +377,7 @@ func TestPullRequestsService_Create(t *testing.T) { t.Errorf("PullRequests.Create returned error: %v", err) } - want := &PullRequest{Number: Int(1)} + want := &PullRequest{Number: Ptr(1)} if !cmp.Equal(pull, want) { t.Errorf("PullRequests.Create returned %+v, want %+v", pull, want) } @@ -421,7 +421,7 @@ func TestPullRequestsService_UpdateBranch(t *testing.T) { }) opts := &PullRequestBranchUpdateOptions{ - ExpectedHeadSHA: String("s"), + ExpectedHeadSHA: Ptr("s"), } ctx := context.Background() @@ -431,8 +431,8 @@ func TestPullRequestsService_UpdateBranch(t *testing.T) { } want := &PullRequestBranchUpdateResponse{ - Message: String("Updating pull request branch."), - URL: String("https://github.com/repos/o/r/pulls/1"), + Message: Ptr("Updating pull request branch."), + URL: Ptr("https://github.com/repos/o/r/pulls/1"), } if !cmp.Equal(pull, want) { @@ -466,19 +466,19 @@ func TestPullRequestsService_Edit(t *testing.T) { want *PullRequest }{ { - input: &PullRequest{Title: String("t")}, + input: &PullRequest{Title: Ptr("t")}, sendResponse: `{"number":1}`, wantUpdate: `{"title":"t"}`, - want: &PullRequest{Number: Int(1)}, + want: &PullRequest{Number: Ptr(1)}, }, { // base update - input: &PullRequest{Base: &PullRequestBranch{Ref: String("master")}}, + input: &PullRequest{Base: &PullRequestBranch{Ref: Ptr("master")}}, sendResponse: `{"number":1,"base":{"ref":"master"}}`, wantUpdate: `{"base":"master"}`, want: &PullRequest{ - Number: Int(1), - Base: &PullRequestBranch{Ref: String("master")}, + Number: Ptr(1), + Base: &PullRequestBranch{Ref: Ptr("master")}, }, }, } @@ -561,18 +561,18 @@ func TestPullRequestsService_ListCommits(t *testing.T) { want := []*RepositoryCommit{ { - SHA: String("3"), + SHA: Ptr("3"), Parents: []*Commit{ { - SHA: String("2"), + SHA: Ptr("2"), }, }, }, { - SHA: String("2"), + SHA: Ptr("2"), Parents: []*Commit{ { - SHA: String("1"), + SHA: Ptr("1"), }, }, }, @@ -635,22 +635,22 @@ func TestPullRequestsService_ListFiles(t *testing.T) { want := []*CommitFile{ { - SHA: String("6dcb09b5b57875f334f61aebed695e2e4193db5e"), - Filename: String("file1.txt"), - Additions: Int(103), - Deletions: Int(21), - Changes: Int(124), - Status: String("added"), - Patch: String("@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"), + 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: String("f61aebed695e2e4193db5e6dcb09b5b57875f334"), - Filename: String("file2.txt"), - Additions: Int(5), - Deletions: Int(3), - Changes: Int(103), - Status: String("modified"), - Patch: String("@@ -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"), }, } @@ -730,9 +730,9 @@ func TestPullRequestsService_Merge(t *testing.T) { } want := &PullRequestMergeResult{ - SHA: String("6dcb09b5b57875f334f61aebed695e2e4193db5e"), - Merged: Bool(true), - Message: String("Pull Request successfully merged"), + SHA: Ptr("6dcb09b5b57875f334f61aebed695e2e4193db5e"), + Merged: Ptr(true), + Message: Ptr("Pull Request successfully merged"), } if !cmp.Equal(merge, want) { t.Errorf("PullRequests.Merge returned %+v, want %+v", merge, want) @@ -844,7 +844,7 @@ func TestPullRequestMergeRequest_Marshal(t *testing.T) { testJSONMarshal(t, &pullRequestMergeRequest{}, "{}") u := &pullRequestMergeRequest{ - CommitMessage: String("cm"), + CommitMessage: Ptr("cm"), CommitTitle: "ct", MergeMethod: "mm", SHA: "sha", @@ -865,9 +865,9 @@ func TestPullRequestMergeResult_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestMergeResult{}, "{}") u := &PullRequestMergeResult{ - SHA: String("sha"), - Merged: Bool(false), - Message: String("msg"), + SHA: Ptr("sha"), + Merged: Ptr(false), + Message: Ptr("msg"), } want := `{ @@ -884,11 +884,11 @@ func TestPullRequestUpdate_Marshal(t *testing.T) { testJSONMarshal(t, &pullRequestUpdate{}, "{}") u := &pullRequestUpdate{ - Title: String("title"), - Body: String("body"), - State: String("state"), - Base: String("base"), - MaintainerCanModify: Bool(false), + Title: Ptr("title"), + Body: Ptr("body"), + State: Ptr("state"), + Base: Ptr("base"), + MaintainerCanModify: Ptr(false), } want := `{ @@ -907,8 +907,8 @@ func TestPullRequestBranchUpdateResponse_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestBranchUpdateResponse{}, "{}") u := &PullRequestBranchUpdateResponse{ - Message: String("message"), - URL: String("url"), + Message: Ptr("message"), + URL: Ptr("url"), } want := `{ @@ -924,7 +924,7 @@ func TestPullRequestBranchUpdateOptions_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestBranchUpdateOptions{}, "{}") u := &PullRequestBranchUpdateOptions{ - ExpectedHeadSHA: String("eh"), + ExpectedHeadSHA: Ptr("eh"), } want := `{ @@ -939,14 +939,14 @@ func TestNewPullRequest_Marshal(t *testing.T) { testJSONMarshal(t, &NewPullRequest{}, "{}") u := &NewPullRequest{ - Title: String("eh"), - Head: String("eh"), - HeadRepo: String("eh"), - Base: String("eh"), - Body: String("eh"), - Issue: Int(1), - MaintainerCanModify: Bool(false), - Draft: Bool(false), + Title: Ptr("eh"), + Head: Ptr("eh"), + HeadRepo: Ptr("eh"), + Base: Ptr("eh"), + Body: Ptr("eh"), + Issue: Ptr(1), + MaintainerCanModify: Ptr(false), + Draft: Ptr(false), } want := `{ @@ -968,27 +968,27 @@ func TestPullRequestBranch_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequestBranch{}, "{}") u := &PullRequestBranch{ - Label: String("label"), - Ref: String("ref"), - SHA: String("sha"), - Repo: &Repository{ID: Int64(1)}, + Label: Ptr("label"), + Ref: Ptr("ref"), + SHA: Ptr("sha"), + Repo: &Repository{ID: Ptr(int64(1))}, User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -1031,7 +1031,7 @@ func TestPRLink_Marshal(t *testing.T) { testJSONMarshal(t, &PRLink{}, "{}") u := &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), } want := `{ @@ -1047,28 +1047,28 @@ func TestPRLinks_Marshal(t *testing.T) { u := &PRLinks{ Self: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, HTML: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Issue: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Comments: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, ReviewComments: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, ReviewComment: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Commits: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Statuses: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, } @@ -1108,28 +1108,28 @@ func TestPullRequestAutoMerge_Marshal(t *testing.T) { u := &PullRequestAutoMerge{ EnabledBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - MergeMethod: String("mm"), - CommitTitle: String("ct"), - CommitMessage: String("cm"), + MergeMethod: Ptr("mm"), + CommitTitle: Ptr("ct"), + CommitMessage: Ptr("cm"), } want := `{ @@ -1166,208 +1166,208 @@ func TestPullRequest_Marshal(t *testing.T) { testJSONMarshal(t, &PullRequest{}, "{}") u := &PullRequest{ - ID: Int64(1), - Number: Int(1), - State: String("state"), - Locked: Bool(false), - Title: String("title"), - Body: String("body"), + ID: Ptr(int64(1)), + Number: Ptr(1), + State: Ptr("state"), + Locked: Ptr(false), + Title: Ptr("title"), + Body: Ptr("body"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, ClosedAt: &Timestamp{referenceTime}, MergedAt: &Timestamp{referenceTime}, - Labels: []*Label{{ID: Int64(1)}}, + Labels: []*Label{{ID: Ptr(int64(1))}}, User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Draft: Bool(false), - Merged: Bool(false), - Mergeable: Bool(false), - MergeableState: String("ms"), + Draft: Ptr(false), + Merged: Ptr(false), + Mergeable: Ptr(false), + MergeableState: Ptr("ms"), MergedBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - MergeCommitSHA: String("mcs"), - Rebaseable: Bool(false), - Comments: Int(1), - Commits: Int(1), - Additions: Int(1), - Deletions: Int(1), - ChangedFiles: Int(1), - URL: String("url"), - HTMLURL: String("hurl"), - IssueURL: String("iurl"), - StatusesURL: String("surl"), - DiffURL: String("durl"), - PatchURL: String("purl"), - CommitsURL: String("curl"), - CommentsURL: String("comurl"), - ReviewCommentsURL: String("rcurls"), - ReviewCommentURL: String("rcurl"), - ReviewComments: Int(1), + MergeCommitSHA: Ptr("mcs"), + Rebaseable: Ptr(false), + Comments: Ptr(1), + Commits: Ptr(1), + Additions: Ptr(1), + Deletions: Ptr(1), + ChangedFiles: Ptr(1), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + IssueURL: Ptr("iurl"), + StatusesURL: Ptr("surl"), + DiffURL: Ptr("durl"), + PatchURL: Ptr("purl"), + CommitsURL: Ptr("curl"), + CommentsURL: Ptr("comurl"), + ReviewCommentsURL: Ptr("rcurls"), + ReviewCommentURL: Ptr("rcurl"), + ReviewComments: Ptr(1), Assignee: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, Assignees: []*User{ { - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, }, - Milestone: &Milestone{ID: Int64(1)}, - MaintainerCanModify: Bool(true), - AuthorAssociation: String("aa"), - NodeID: String("nid"), + Milestone: &Milestone{ID: Ptr(int64(1))}, + MaintainerCanModify: Ptr(true), + AuthorAssociation: Ptr("aa"), + NodeID: Ptr("nid"), RequestedReviewers: []*User{ { - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, }, AutoMerge: &PullRequestAutoMerge{ EnabledBy: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - MergeMethod: String("mm"), - CommitTitle: String("ct"), - CommitMessage: String("cm"), + MergeMethod: Ptr("mm"), + CommitTitle: Ptr("ct"), + CommitMessage: Ptr("cm"), }, - RequestedTeams: []*Team{{ID: Int64(1)}}, + RequestedTeams: []*Team{{ID: Ptr(int64(1))}}, Links: &PRLinks{ Self: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, HTML: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Issue: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Comments: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, ReviewComments: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, ReviewComment: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Commits: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, Statuses: &PRLink{ - HRef: String("href"), + HRef: Ptr("href"), }, }, Head: &PullRequestBranch{ - Ref: String("r2"), - Repo: &Repository{ID: Int64(2)}, + Ref: Ptr("r2"), + Repo: &Repository{ID: Ptr(int64(2))}, }, Base: &PullRequestBranch{ - Ref: String("r2"), - Repo: &Repository{ID: Int64(2)}, + Ref: Ptr("r2"), + Repo: &Repository{ID: Ptr(int64(2))}, }, - ActiveLockReason: String("alr"), + ActiveLockReason: Ptr("alr"), } want := `{ diff --git a/github/pulls_threads_test.go b/github/pulls_threads_test.go index 25882a31c31..ea81e358d2a 100644 --- a/github/pulls_threads_test.go +++ b/github/pulls_threads_test.go @@ -17,63 +17,63 @@ func TestPullRequestThread_Marshal(t *testing.T) { createdAt := Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)} updatedAt := Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)} reactions := &Reactions{ - TotalCount: Int(1), - PlusOne: Int(1), - MinusOne: Int(0), - Laugh: Int(0), - Confused: Int(0), - Heart: Int(0), - Hooray: Int(0), - Rocket: Int(0), - Eyes: Int(0), - URL: String("u"), + TotalCount: Ptr(1), + PlusOne: Ptr(1), + MinusOne: Ptr(0), + Laugh: Ptr(0), + Confused: Ptr(0), + Heart: Ptr(0), + Hooray: Ptr(0), + Rocket: Ptr(0), + Eyes: Ptr(0), + URL: Ptr("u"), } user := &User{ - Login: String("ll"), - ID: Int64(123), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("ll"), + ID: Ptr(int64(123)), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), + URL: Ptr("u"), } comment := &PullRequestComment{ - ID: Int64(10), - InReplyTo: Int64(8), - Body: String("Test comment"), - Path: String("file1.txt"), - DiffHunk: String("@@ -16,33 +16,40 @@ fmt.Println()"), - PullRequestReviewID: Int64(42), - Position: Int(1), - OriginalPosition: Int(4), - StartLine: Int(2), - Line: Int(3), - OriginalLine: Int(2), - OriginalStartLine: Int(2), - Side: String("RIGHT"), - StartSide: String("LEFT"), - CommitID: String("ab"), - OriginalCommitID: String("9c"), + ID: Ptr(int64(10)), + InReplyTo: Ptr(int64(8)), + Body: Ptr("Test comment"), + Path: Ptr("file1.txt"), + DiffHunk: Ptr("@@ -16,33 +16,40 @@ fmt.Println()"), + PullRequestReviewID: Ptr(int64(42)), + Position: Ptr(1), + OriginalPosition: Ptr(4), + StartLine: Ptr(2), + Line: Ptr(3), + OriginalLine: Ptr(2), + OriginalStartLine: Ptr(2), + Side: Ptr("RIGHT"), + StartSide: Ptr("LEFT"), + CommitID: Ptr("ab"), + OriginalCommitID: Ptr("9c"), User: user, Reactions: reactions, CreatedAt: &createdAt, UpdatedAt: &updatedAt, - URL: String("pullrequestcommentUrl"), - HTMLURL: String("pullrequestcommentHTMLUrl"), - PullRequestURL: String("pullrequestcommentPullRequestURL"), + URL: Ptr("pullrequestcommentUrl"), + HTMLURL: Ptr("pullrequestcommentHTMLUrl"), + PullRequestURL: Ptr("pullrequestcommentPullRequestURL"), } u := &PullRequestThread{ - ID: Int64(1), - NodeID: String("nid"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), Comments: []*PullRequestComment{comment, comment}, } diff --git a/github/reactions.go b/github/reactions.go index 1aa7ac38f2a..9f9f72faeed 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -98,7 +98,7 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -178,7 +178,7 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - body := &Reaction{Content: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -258,7 +258,7 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -338,7 +338,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -415,7 +415,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - body := &Reaction{Content: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -490,7 +490,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - body := &Reaction{Content: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -552,7 +552,7 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res func (s *ReactionsService) CreateReleaseReaction(ctx context.Context, owner, repo string, releaseID int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/releases/%v/reactions", owner, repo, releaseID) - body := &Reaction{Content: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err diff --git a/github/reactions_test.go b/github/reactions_test.go index 246588674de..5758a705f05 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -19,10 +19,10 @@ func TestReaction_Marshal(t *testing.T) { testJSONMarshal(t, &Reaction{}, "{}") r := &Reaction{ - ID: Int64(1), + ID: Ptr(int64(1)), User: nil, - NodeID: String("n"), - Content: String("+1"), + NodeID: Ptr("n"), + Content: Ptr("+1"), } want := `{ @@ -39,16 +39,16 @@ func TestReactions_Marshal(t *testing.T) { testJSONMarshal(t, &Reactions{}, "{}") r := &Reactions{ - TotalCount: Int(1), - PlusOne: Int(1), - MinusOne: Int(1), - Laugh: Int(1), - Confused: Int(1), - Heart: Int(1), - Hooray: Int(1), - Rocket: Int(1), - Eyes: Int(1), - URL: String("u"), + TotalCount: Ptr(1), + PlusOne: Ptr(1), + MinusOne: Ptr(1), + Laugh: Ptr(1), + Confused: Ptr(1), + Heart: Ptr(1), + Hooray: Ptr(1), + Rocket: Ptr(1), + Eyes: Ptr(1), + URL: Ptr("u"), } want := `{ @@ -85,7 +85,7 @@ func TestReactionsService_ListCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}} + want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} if !cmp.Equal(reactions, want) { t.Errorf("ListCommentReactions = %+v, want %+v", reactions, want) } @@ -122,7 +122,7 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateCommentReaction returned error: %v", err) } - want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} + want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateCommentReaction = %+v, want %+v", got, want) } @@ -159,7 +159,7 @@ func TestReactionsService_ListIssueReactions(t *testing.T) { if err != nil { t.Errorf("ListIssueReactions returned error: %v", err) } - want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}} + want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListIssueReactions = %+v, want %+v", got, want) } @@ -203,7 +203,7 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) { if err != nil { t.Errorf("CreateIssueReaction returned error: %v", err) } - want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} + want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateIssueReaction = %+v, want %+v", got, want) } @@ -240,7 +240,7 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListIssueCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}} + want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListIssueCommentReactions = %+v, want %+v", got, want) } @@ -284,7 +284,7 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateIssueCommentReaction returned error: %v", err) } - want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} + want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateIssueCommentReaction = %+v, want %+v", got, want) } @@ -321,7 +321,7 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListPullRequestCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}} + want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListPullRequestCommentReactions = %+v, want %+v", got, want) } @@ -365,7 +365,7 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreatePullRequestCommentReaction returned error: %v", err) } - want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} + want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} if !cmp.Equal(got, want) { t.Errorf("CreatePullRequestCommentReaction = %+v, want %+v", got, want) } @@ -402,7 +402,7 @@ func TestReactionsService_ListTeamDiscussionReactions(t *testing.T) { if err != nil { t.Errorf("ListTeamDiscussionReactions returned error: %v", err) } - want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}} + want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListTeamDiscussionReactions = %+v, want %+v", got, want) } @@ -446,7 +446,7 @@ func TestReactionsService_CreateTeamDiscussionReaction(t *testing.T) { if err != nil { t.Errorf("CreateTeamDiscussionReaction returned error: %v", err) } - want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} + want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateTeamDiscussionReaction = %+v, want %+v", got, want) } @@ -483,7 +483,7 @@ func TestReactionService_ListTeamDiscussionCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListTeamDiscussionCommentReactions returned error: %v", err) } - want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}} + want := []*Reaction{{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")}} if !cmp.Equal(got, want) { t.Errorf("ListTeamDiscussionCommentReactions = %+v, want %+v", got, want) } @@ -527,7 +527,7 @@ func TestReactionService_CreateTeamDiscussionCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateTeamDiscussionCommentReaction returned error: %v", err) } - want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} + want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("+1")} if !cmp.Equal(got, want) { t.Errorf("CreateTeamDiscussionCommentReaction = %+v, want %+v", got, want) } @@ -890,7 +890,7 @@ func TestReactionService_CreateReleaseReaction(t *testing.T) { t.Errorf("%v returned error: %v", methodName, err) } - want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("rocket")} + want := &Reaction{ID: Ptr(int64(1)), User: &User{Login: Ptr("l"), ID: Ptr(int64(2))}, Content: Ptr("rocket")} if !cmp.Equal(got, want) { t.Errorf("%v = %+v, want %+v", methodName, got, want) } diff --git a/github/repos_actions_access_test.go b/github/repos_actions_access_test.go index 9d30f78b84b..c7550dd28ba 100644 --- a/github/repos_actions_access_test.go +++ b/github/repos_actions_access_test.go @@ -29,7 +29,7 @@ func TestRepositoriesService_GetActionsAccessLevel(t *testing.T) { if err != nil { t.Errorf("Repositories.GetActionsAccessLevel returned error: %v", err) } - want := &RepositoryActionsAccessLevel{AccessLevel: String("none")} + want := &RepositoryActionsAccessLevel{AccessLevel: Ptr("none")} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetActionsAccessLevel returned %+v, want %+v", org, want) } @@ -53,7 +53,7 @@ func TestRepositoriesService_EditActionsAccessLevel(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &RepositoryActionsAccessLevel{AccessLevel: String("organization")} + input := &RepositoryActionsAccessLevel{AccessLevel: Ptr("organization")} mux.HandleFunc("/repos/o/r/actions/permissions/access", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryActionsAccessLevel) @@ -88,7 +88,7 @@ func TestRepositoryActionsAccessLevel_Marshal(t *testing.T) { testJSONMarshal(t, &ActionsPermissions{}, "{}") u := &RepositoryActionsAccessLevel{ - AccessLevel: String("enterprise"), + AccessLevel: Ptr("enterprise"), } want := `{ diff --git a/github/repos_actions_allowed_test.go b/github/repos_actions_allowed_test.go index f9d22797116..9a86b2282d2 100644 --- a/github/repos_actions_allowed_test.go +++ b/github/repos_actions_allowed_test.go @@ -29,7 +29,7 @@ func TestRepositoryService_GetActionsAllowed(t *testing.T) { if err != nil { t.Errorf("Repositories.GetActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetActionsAllowed returned %+v, want %+v", org, want) } @@ -53,7 +53,7 @@ func TestRepositoriesService_EditActionsAllowed(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + input := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(false), PatternsAllowed: []string{"a/b"}} mux.HandleFunc("/repos/o/r/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsAllowed) @@ -73,7 +73,7 @@ func TestRepositoriesService_EditActionsAllowed(t *testing.T) { t.Errorf("Repositories.EditActionsAllowed returned error: %v", err) } - want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + want := &ActionsAllowed{GithubOwnedAllowed: Ptr(true), VerifiedAllowed: Ptr(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 9e10928292a..be0c7883f44 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -29,7 +29,7 @@ func TestRepositoriesService_GetActionsPermissions(t *testing.T) { if err != nil { t.Errorf("Repositories.GetActionsPermissions returned error: %v", err) } - want := &ActionsPermissionsRepository{Enabled: Bool(true), AllowedActions: String("all")} + want := &ActionsPermissionsRepository{Enabled: Ptr(true), AllowedActions: Ptr("all")} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetActionsPermissions returned %+v, want %+v", org, want) } @@ -53,7 +53,7 @@ func TestRepositoriesService_EditActionsPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ActionsPermissionsRepository{Enabled: Bool(true), AllowedActions: String("selected")} + input := &ActionsPermissionsRepository{Enabled: Ptr(true), AllowedActions: Ptr("selected")} mux.HandleFunc("/repos/o/r/actions/permissions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsPermissionsRepository) @@ -73,7 +73,7 @@ func TestRepositoriesService_EditActionsPermissions(t *testing.T) { t.Errorf("Repositories.EditActionsPermissions returned error: %v", err) } - want := &ActionsPermissionsRepository{Enabled: Bool(true), AllowedActions: String("selected")} + want := &ActionsPermissionsRepository{Enabled: Ptr(true), AllowedActions: Ptr("selected")} if !cmp.Equal(org, want) { t.Errorf("Repositories.EditActionsPermissions returned %+v, want %+v", org, want) } @@ -98,9 +98,9 @@ func TestActionsPermissionsRepository_Marshal(t *testing.T) { testJSONMarshal(t, &ActionsPermissions{}, "{}") u := &ActionsPermissionsRepository{ - Enabled: Bool(true), - AllowedActions: String("all"), - SelectedActionsURL: String("someURL"), + Enabled: Ptr(true), + AllowedActions: Ptr("all"), + SelectedActionsURL: Ptr("someURL"), } want := `{ @@ -126,7 +126,7 @@ func TestRepositoriesService_GetDefaultWorkflowPermissions(t *testing.T) { if err != nil { t.Errorf("Repositories.GetDefaultWorkflowPermissions returned error: %v", err) } - want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} if !cmp.Equal(org, want) { t.Errorf("Repositories.GetDefaultWorkflowPermissions returned %+v, want %+v", org, want) } @@ -150,7 +150,7 @@ func TestRepositoriesService_EditDefaultWorkflowPermissions(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + input := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} mux.HandleFunc("/repos/o/r/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { v := new(DefaultWorkflowPermissionRepository) @@ -170,7 +170,7 @@ func TestRepositoriesService_EditDefaultWorkflowPermissions(t *testing.T) { t.Errorf("Repositories.EditDefaultWorkflowPermissions returned error: %v", err) } - want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: Ptr("read"), CanApprovePullRequestReviews: Ptr(true)} if !cmp.Equal(org, want) { t.Errorf("Repositories.EditDefaultWorkflowPermissions returned %+v, want %+v", org, want) } diff --git a/github/repos_autolinks_test.go b/github/repos_autolinks_test.go index 1cf7a968f2a..5fdd8d44f0b 100644 --- a/github/repos_autolinks_test.go +++ b/github/repos_autolinks_test.go @@ -35,8 +35,8 @@ func TestRepositoriesService_ListAutolinks(t *testing.T) { } want := []*Autolink{ - {ID: Int64(1), KeyPrefix: String("TICKET-"), URLTemplate: String("https://example.com/TICKET?query=")}, - {ID: Int64(2), KeyPrefix: String("STORY-"), URLTemplate: String("https://example.com/STORY?query=")}, + {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=")}, } if !cmp.Equal(autolinks, want) { @@ -63,9 +63,9 @@ func TestRepositoriesService_AddAutolink(t *testing.T) { client, mux, _ := setup(t) opt := &AutolinkOptions{ - KeyPrefix: String("TICKET-"), - URLTemplate: String("https://example.com/TICKET?query="), - IsAlphanumeric: Bool(true), + KeyPrefix: Ptr("TICKET-"), + URLTemplate: Ptr("https://example.com/TICKET?query="), + IsAlphanumeric: Ptr(true), } mux.HandleFunc("/repos/o/r/autolinks", func(w http.ResponseWriter, r *http.Request) { v := new(AutolinkOptions) @@ -89,9 +89,9 @@ func TestRepositoriesService_AddAutolink(t *testing.T) { t.Errorf("Repositories.AddAutolink returned error: %v", err) } want := &Autolink{ - KeyPrefix: String("TICKET-"), - URLTemplate: String("https://example.com/TICKET?query="), - IsAlphanumeric: Bool(true), + KeyPrefix: Ptr("TICKET-"), + URLTemplate: Ptr("https://example.com/TICKET?query="), + IsAlphanumeric: Ptr(true), } if !cmp.Equal(autolink, want) { @@ -128,7 +128,7 @@ func TestRepositoriesService_GetAutolink(t *testing.T) { t.Errorf("Repositories.GetAutolink returned error: %v", err) } - want := &Autolink{ID: Int64(1), KeyPrefix: String("TICKET-"), URLTemplate: String("https://example.com/TICKET?query=")} + want := &Autolink{ID: Ptr(int64(1)), KeyPrefix: Ptr("TICKET-"), URLTemplate: Ptr("https://example.com/TICKET?query=")} if !cmp.Equal(autolink, want) { t.Errorf("Repositories.GetAutolink returned %+v, want %+v", autolink, want) } @@ -169,9 +169,9 @@ func TestAutolinkOptions_Marshal(t *testing.T) { testJSONMarshal(t, &AutolinkOptions{}, "{}") r := &AutolinkOptions{ - KeyPrefix: String("kp"), - URLTemplate: String("URLT"), - IsAlphanumeric: Bool(true), + KeyPrefix: Ptr("kp"), + URLTemplate: Ptr("URLT"), + IsAlphanumeric: Ptr(true), } want := `{ @@ -188,10 +188,10 @@ func TestAutolink_Marshal(t *testing.T) { testJSONMarshal(t, &Autolink{}, "{}") r := &Autolink{ - ID: Int64(1), - KeyPrefix: String("kp"), - URLTemplate: String("URLT"), - IsAlphanumeric: Bool(true), + ID: Ptr(int64(1)), + KeyPrefix: Ptr("kp"), + URLTemplate: Ptr("URLT"), + IsAlphanumeric: Ptr(true), } want := `{ diff --git a/github/repos_codeowners_test.go b/github/repos_codeowners_test.go index f3ced1ca41a..0b3c784274b 100644 --- a/github/repos_codeowners_test.go +++ b/github/repos_codeowners_test.go @@ -50,7 +50,7 @@ func TestRepositoriesService_GetCodeownersErrors_noRef(t *testing.T) { Column: 1, Kind: "Invalid pattern", Source: "***/*.rb @monalisa", - Suggestion: String("Did you mean **/*.rb?"), + Suggestion: Ptr("Did you mean **/*.rb?"), Message: "Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", Path: ".github/CODEOWNERS", }, @@ -113,7 +113,7 @@ func TestRepositoriesService_GetCodeownersErrors_specificRef(t *testing.T) { Column: 1, Kind: "Invalid pattern", Source: "***/*.rb @monalisa", - Suggestion: String("Did you mean **/*.rb?"), + Suggestion: Ptr("Did you mean **/*.rb?"), Message: "Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", Path: ".github/CODEOWNERS", }, @@ -149,7 +149,7 @@ func TestCodeownersErrors_Marshal(t *testing.T) { Column: 1, Kind: "Invalid pattern", Source: "***/*.rb @monalisa", - Suggestion: String("Did you mean **/*.rb?"), + Suggestion: Ptr("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 1aa9a6fb9bf..0525ca5f568 100644 --- a/github/repos_collaborators_test.go +++ b/github/repos_collaborators_test.go @@ -34,7 +34,7 @@ func TestRepositoriesService_ListCollaborators(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want) } @@ -74,7 +74,7 @@ func TestRepositoriesService_ListCollaborators_withAffiliation(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want) } @@ -114,7 +114,7 @@ func TestRepositoriesService_ListCollaborators_withPermission(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want) } @@ -236,9 +236,9 @@ func TestRepositoryService_GetPermissionLevel(t *testing.T) { } want := &RepositoryPermissionLevel{ - Permission: String("admin"), + Permission: Ptr("admin"), User: &User{ - Login: String("u"), + Login: Ptr("u"), }, } @@ -282,21 +282,21 @@ func TestRepositoriesService_AddCollaborator(t *testing.T) { t.Errorf("Repositories.AddCollaborator returned error: %v", err) } want := &CollaboratorInvitation{ - ID: Int64(1), + ID: Ptr(int64(1)), Repo: &Repository{ - ID: Int64(1), - URL: String("s"), - Name: String("r"), + ID: Ptr(int64(1)), + URL: Ptr("s"), + Name: Ptr("r"), }, Invitee: &User{ - Login: String("u"), + Login: Ptr("u"), }, Inviter: &User{ - Login: String("o"), + Login: Ptr("o"), }, - Permissions: String("write"), - URL: String("https://api.github.com/user/repository_invitations/1296269"), - HTMLURL: String("https://github.com/octocat/Hello-World/invitations"), + Permissions: Ptr("write"), + URL: Ptr("https://api.github.com/user/repository_invitations/1296269"), + HTMLURL: Ptr("https://github.com/octocat/Hello-World/invitations"), } if !cmp.Equal(collaboratorInvitation, want) { @@ -382,24 +382,24 @@ func TestRepositoryPermissionLevel_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryPermissionLevel{}, "{}") r := &RepositoryPermissionLevel{ - Permission: String("permission"), + Permission: Ptr("permission"), User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, @@ -437,57 +437,57 @@ func TestCollaboratorInvitation_Marshal(t *testing.T) { testJSONMarshal(t, &CollaboratorInvitation{}, "{}") r := &CollaboratorInvitation{ - ID: Int64(1), + ID: Ptr(int64(1)), Repo: &Repository{ - ID: Int64(1), - URL: String("url"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("url"), + Name: Ptr("n"), }, Invitee: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, Inviter: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Permissions: String("per"), + Permissions: Ptr("per"), CreatedAt: &Timestamp{referenceTime}, - URL: String("url"), - HTMLURL: String("hurl"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), } want := `{ diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go index 5daf3c53dd7..c415b1c3202 100644 --- a/github/repos_comments_test.go +++ b/github/repos_comments_test.go @@ -33,7 +33,7 @@ func TestRepositoriesService_ListComments(t *testing.T) { t.Errorf("Repositories.ListComments returned error: %v", err) } - want := []*RepositoryComment{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*RepositoryComment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(comments, want) { t.Errorf("Repositories.ListComments returned %+v, want %+v", comments, want) } @@ -80,7 +80,7 @@ func TestRepositoriesService_ListCommitComments(t *testing.T) { t.Errorf("Repositories.ListCommitComments returned error: %v", err) } - want := []*RepositoryComment{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*RepositoryComment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(comments, want) { t.Errorf("Repositories.ListCommitComments returned %+v, want %+v", comments, want) } @@ -113,7 +113,7 @@ func TestRepositoriesService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &RepositoryComment{Body: String("b")} + input := &RepositoryComment{Body: Ptr("b")} mux.HandleFunc("/repos/o/r/commits/s/comments", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryComment) @@ -133,7 +133,7 @@ func TestRepositoriesService_CreateComment(t *testing.T) { t.Errorf("Repositories.CreateComment returned error: %v", err) } - want := &RepositoryComment{ID: Int64(1)} + want := &RepositoryComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Repositories.CreateComment returned %+v, want %+v", comment, want) } @@ -178,7 +178,7 @@ func TestRepositoriesService_GetComment(t *testing.T) { t.Errorf("Repositories.GetComment returned error: %v", err) } - want := &RepositoryComment{ID: Int64(1)} + want := &RepositoryComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Repositories.GetComment returned %+v, want %+v", comment, want) } @@ -211,7 +211,7 @@ func TestRepositoriesService_UpdateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &RepositoryComment{Body: String("b")} + input := &RepositoryComment{Body: Ptr("b")} mux.HandleFunc("/repos/o/r/comments/1", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryComment) @@ -231,7 +231,7 @@ func TestRepositoriesService_UpdateComment(t *testing.T) { t.Errorf("Repositories.UpdateComment returned error: %v", err) } - want := &RepositoryComment{ID: Int64(1)} + want := &RepositoryComment{ID: Ptr(int64(1))} if !cmp.Equal(comment, want) { t.Errorf("Repositories.UpdateComment returned %+v, want %+v", comment, want) } @@ -299,48 +299,48 @@ func TestRepositoryComment_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryComment{}, "{}") r := &RepositoryComment{ - HTMLURL: String("hurl"), - URL: String("url"), - ID: Int64(1), - NodeID: String("nid"), - CommitID: String("cid"), + HTMLURL: Ptr("hurl"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + CommitID: Ptr("cid"), User: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, Reactions: &Reactions{ - TotalCount: Int(1), - PlusOne: Int(1), - MinusOne: Int(1), - Laugh: Int(1), - Confused: Int(1), - Heart: Int(1), - Hooray: Int(1), - Rocket: Int(1), - Eyes: Int(1), - URL: String("u"), + TotalCount: Ptr(1), + PlusOne: Ptr(1), + MinusOne: Ptr(1), + Laugh: Ptr(1), + Confused: Ptr(1), + Heart: Ptr(1), + Hooray: Ptr(1), + Rocket: Ptr(1), + Eyes: Ptr(1), + URL: Ptr("u"), }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - Body: String("body"), - Path: String("path"), - Position: Int(1), + Body: Ptr("body"), + Path: Ptr("path"), + Position: Ptr(1), } want := `{ diff --git a/github/repos_commits_test.go b/github/repos_commits_test.go index 08326d2715c..fb99a75a614 100644 --- a/github/repos_commits_test.go +++ b/github/repos_commits_test.go @@ -48,7 +48,7 @@ func TestRepositoriesService_ListCommits(t *testing.T) { t.Errorf("Repositories.ListCommits returned error: %v", err) } - want := []*RepositoryCommit{{SHA: String("s")}} + want := []*RepositoryCommit{{SHA: Ptr("s")}} if !cmp.Equal(commits, want) { t.Errorf("Repositories.ListCommits returned %+v, want %+v", commits, want) } @@ -106,37 +106,37 @@ func TestRepositoriesService_GetCommit(t *testing.T) { } want := &RepositoryCommit{ - SHA: String("s"), + SHA: Ptr("s"), Commit: &Commit{ - Message: String("m"), + Message: Ptr("m"), }, Author: &User{ - Login: String("l"), + Login: Ptr("l"), }, Committer: &User{ - Login: String("l"), + Login: Ptr("l"), }, Parents: []*Commit{ { - SHA: String("s"), + SHA: Ptr("s"), }, }, Stats: &CommitStats{ - Additions: Int(104), - Deletions: Int(4), - Total: Int(108), + Additions: Ptr(104), + Deletions: Ptr(4), + Total: Ptr(108), }, Files: []*CommitFile{ { - Filename: String("f"), - Additions: Int(10), - Deletions: Int(2), - Changes: Int(12), - Status: String("s"), - Patch: String("p"), - BlobURL: String("b"), - RawURL: String("r"), - ContentsURL: String("c"), + 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"), }, }, } @@ -443,50 +443,50 @@ func TestRepositoriesService_CompareCommits(t *testing.T) { want := &CommitsComparison{ BaseCommit: &RepositoryCommit{ - SHA: String("s"), + SHA: Ptr("s"), Commit: &Commit{ - Author: &CommitAuthor{Name: String("n")}, - Committer: &CommitAuthor{Name: String("n")}, - Message: String("m"), - Tree: &Tree{SHA: String("t")}, + Author: &CommitAuthor{Name: Ptr("n")}, + Committer: &CommitAuthor{Name: Ptr("n")}, + Message: Ptr("m"), + Tree: &Tree{SHA: Ptr("t")}, }, - Author: &User{Login: String("l")}, - Committer: &User{Login: String("l")}, + Author: &User{Login: Ptr("l")}, + Committer: &User{Login: Ptr("l")}, Parents: []*Commit{ { - SHA: String("s"), + SHA: Ptr("s"), }, }, }, - Status: String("s"), - AheadBy: Int(1), - BehindBy: Int(2), - TotalCommits: Int(1), + Status: Ptr("s"), + AheadBy: Ptr(1), + BehindBy: Ptr(2), + TotalCommits: Ptr(1), Commits: []*RepositoryCommit{ { - SHA: String("s"), + SHA: Ptr("s"), Commit: &Commit{ - Author: &CommitAuthor{Name: String("n")}, + Author: &CommitAuthor{Name: Ptr("n")}, }, - Author: &User{Login: String("l")}, - Committer: &User{Login: String("l")}, + Author: &User{Login: Ptr("l")}, + Committer: &User{Login: Ptr("l")}, Parents: []*Commit{ { - SHA: String("s"), + SHA: Ptr("s"), }, }, }, }, Files: []*CommitFile{ { - Filename: String("f"), + Filename: Ptr("f"), }, }, - HTMLURL: String(fmt.Sprintf("https://github.com/o/r/compare/%v...%v", escapedBase, escapedHead)), - PermalinkURL: String("https://github.com/o/r/compare/o:bbcd538c8e72b8c175046e27cc8f907076331401...o:0328041d1152db8ae77652d1618a02e57f745f17"), - DiffURL: String(fmt.Sprintf("https://github.com/o/r/compare/%v...%v.diff", escapedBase, escapedHead)), - PatchURL: String(fmt.Sprintf("https://github.com/o/r/compare/%v...%v.patch", escapedBase, escapedHead)), - URL: String(fmt.Sprintf("https://api.github.com/repos/o/r/compare/%v...%v", escapedBase, escapedHead)), + 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)), } if !cmp.Equal(got, want) { @@ -652,12 +652,12 @@ func TestRepositoriesService_ListBranchesHeadCommit(t *testing.T) { want := []*BranchCommit{ { - Name: String("b"), + Name: Ptr("b"), Commit: &Commit{ - SHA: String("2e90302801c870f17b6152327d9b9a03c8eca0e2"), - URL: String("https://api.github.com/repos/google/go-github/commits/2e90302801c870f17b6152327d9b9a03c8eca0e2"), + SHA: Ptr("2e90302801c870f17b6152327d9b9a03c8eca0e2"), + URL: Ptr("https://api.github.com/repos/google/go-github/commits/2e90302801c870f17b6152327d9b9a03c8eca0e2"), }, - Protected: Bool(true), + Protected: Ptr(true), }, } if !cmp.Equal(branches, want) { @@ -684,53 +684,53 @@ func TestBranchCommit_Marshal(t *testing.T) { testJSONMarshal(t, &BranchCommit{}, "{}") r := &BranchCommit{ - Name: String("n"), + Name: Ptr("n"), Commit: &Commit{ - SHA: String("s"), + SHA: Ptr("s"), Author: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), }, Committer: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), }, - Message: String("m"), + Message: Ptr("m"), Tree: &Tree{ - SHA: String("s"), + SHA: Ptr("s"), Entries: []*TreeEntry{{ - SHA: String("s"), - Path: String("p"), - Mode: String("m"), - Type: String("t"), - Size: Int(1), - Content: String("c"), - URL: String("u"), + SHA: Ptr("s"), + Path: Ptr("p"), + Mode: Ptr("m"), + Type: Ptr("t"), + Size: Ptr(1), + Content: Ptr("c"), + URL: Ptr("u"), }}, - Truncated: Bool(false), + Truncated: Ptr(false), }, Parents: nil, Stats: &CommitStats{ - Additions: Int(1), - Deletions: Int(1), - Total: Int(1), + Additions: Ptr(1), + Deletions: Ptr(1), + Total: Ptr(1), }, - HTMLURL: String("h"), - URL: String("u"), + HTMLURL: Ptr("h"), + URL: Ptr("u"), Verification: &SignatureVerification{ - Verified: Bool(false), - Reason: String("r"), - Signature: String("s"), - Payload: String("p"), + Verified: Ptr(false), + Reason: Ptr("r"), + Signature: Ptr("s"), + Payload: Ptr("p"), }, - NodeID: String("n"), - CommentCount: Int(1), + NodeID: Ptr("n"), + CommentCount: Ptr(1), }, - Protected: Bool(false), + Protected: Ptr(false), } want := `{ @@ -792,27 +792,27 @@ func TestCommitsComparison_Marshal(t *testing.T) { testJSONMarshal(t, &CommitsComparison{}, "{}") r := &CommitsComparison{ - BaseCommit: &RepositoryCommit{NodeID: String("nid")}, - MergeBaseCommit: &RepositoryCommit{NodeID: String("nid")}, - Status: String("status"), - AheadBy: Int(1), - BehindBy: Int(1), - TotalCommits: Int(1), + BaseCommit: &RepositoryCommit{NodeID: Ptr("nid")}, + MergeBaseCommit: &RepositoryCommit{NodeID: Ptr("nid")}, + Status: Ptr("status"), + AheadBy: Ptr(1), + BehindBy: Ptr(1), + TotalCommits: Ptr(1), Commits: []*RepositoryCommit{ { - NodeID: String("nid"), + NodeID: Ptr("nid"), }, }, Files: []*CommitFile{ { - SHA: String("sha"), + SHA: Ptr("sha"), }, }, - HTMLURL: String("hurl"), - PermalinkURL: String("purl"), - DiffURL: String("durl"), - PatchURL: String("purl"), - URL: String("url"), + HTMLURL: Ptr("hurl"), + PermalinkURL: Ptr("purl"), + DiffURL: Ptr("durl"), + PatchURL: Ptr("purl"), + URL: Ptr("url"), } want := `{ @@ -851,17 +851,17 @@ func TestCommitFile_Marshal(t *testing.T) { testJSONMarshal(t, &CommitFile{}, "{}") r := &CommitFile{ - SHA: String("sha"), - Filename: String("fn"), - Additions: Int(1), - Deletions: Int(1), - Changes: Int(1), - Status: String("status"), - Patch: String("patch"), - BlobURL: String("burl"), - RawURL: String("rurl"), - ContentsURL: String("curl"), - PreviousFilename: String("pf"), + SHA: Ptr("sha"), + Filename: Ptr("fn"), + Additions: Ptr(1), + Deletions: Ptr(1), + Changes: Ptr(1), + Status: Ptr("status"), + Patch: Ptr("patch"), + BlobURL: Ptr("burl"), + RawURL: Ptr("rurl"), + ContentsURL: Ptr("curl"), + PreviousFilename: Ptr("pf"), } want := `{ @@ -886,9 +886,9 @@ func TestCommitStats_Marshal(t *testing.T) { testJSONMarshal(t, &CommitStats{}, "{}") r := &CommitStats{ - Additions: Int(1), - Deletions: Int(1), - Total: Int(1), + Additions: Ptr(1), + Deletions: Ptr(1), + Total: Ptr(1), } want := `{ @@ -905,41 +905,41 @@ func TestRepositoryCommit_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryCommit{}, "{}") r := &RepositoryCommit{ - NodeID: String("nid"), - SHA: String("sha"), + NodeID: Ptr("nid"), + SHA: Ptr("sha"), Commit: &Commit{ - Message: String("m"), + Message: Ptr("m"), }, Author: &User{ - Login: String("l"), + Login: Ptr("l"), }, Committer: &User{ - Login: String("l"), + Login: Ptr("l"), }, Parents: []*Commit{ { - SHA: String("s"), + SHA: Ptr("s"), }, }, - HTMLURL: String("hurl"), - URL: String("url"), - CommentsURL: String("curl"), + HTMLURL: Ptr("hurl"), + URL: Ptr("url"), + CommentsURL: Ptr("curl"), Stats: &CommitStats{ - Additions: Int(104), - Deletions: Int(4), - Total: Int(108), + Additions: Ptr(104), + Deletions: Ptr(4), + Total: Ptr(108), }, Files: []*CommitFile{ { - Filename: String("f"), - Additions: Int(10), - Deletions: Int(2), - Changes: Int(12), - Status: String("s"), - Patch: String("p"), - BlobURL: String("b"), - RawURL: String("r"), - ContentsURL: String("c"), + 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"), }, }, } diff --git a/github/repos_community_health_test.go b/github/repos_community_health_test.go index 4d4a4d86ee0..eb7f2ce507c 100644 --- a/github/repos_community_health_test.go +++ b/github/repos_community_health_test.go @@ -74,43 +74,43 @@ func TestRepositoriesService_GetCommunityHealthMetrics(t *testing.T) { updatedAt := time.Date(2017, time.February, 28, 0, 0, 0, 0, time.UTC) want := &CommunityHealthMetrics{ - HealthPercentage: Int(100), - Description: String("My first repository on GitHub!"), + HealthPercentage: Ptr(100), + Description: Ptr("My first repository on GitHub!"), UpdatedAt: &Timestamp{updatedAt}, - ContentReportsEnabled: Bool(true), + ContentReportsEnabled: Ptr(true), Files: &CommunityHealthFiles{ CodeOfConduct: &Metric{ - Name: String("Contributor Covenant"), - Key: String("contributor_covenant"), - HTMLURL: String("https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"), + Name: Ptr("Contributor Covenant"), + Key: Ptr("contributor_covenant"), + HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"), }, CodeOfConductFile: &Metric{ - URL: String("https://api.github.com/repos/octocat/Hello-World/contents/CODE_OF_CONDUCT.md"), - HTMLURL: String("https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"), + 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"), }, Contributing: &Metric{ - URL: String("https://api.github.com/repos/octocat/Hello-World/contents/CONTRIBUTING"), - HTMLURL: String("https://github.com/octocat/Hello-World/blob/master/CONTRIBUTING"), + URL: Ptr("https://api.github.com/repos/octocat/Hello-World/contents/CONTRIBUTING"), + HTMLURL: Ptr("https://github.com/octocat/Hello-World/blob/master/CONTRIBUTING"), }, IssueTemplate: &Metric{ - URL: String("https://api.github.com/repos/octocat/Hello-World/contents/ISSUE_TEMPLATE"), - HTMLURL: String("https://github.com/octocat/Hello-World/blob/master/ISSUE_TEMPLATE"), + 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"), }, PullRequestTemplate: &Metric{ - URL: String("https://api.github.com/repos/octocat/Hello-World/contents/PULL_REQUEST_TEMPLATE"), - HTMLURL: String("https://github.com/octocat/Hello-World/blob/master/PULL_REQUEST_TEMPLATE"), + 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"), }, License: &Metric{ - Name: String("MIT License"), - Key: String("mit"), - SPDXID: String("MIT"), - URL: String("https://api.github.com/licenses/mit"), - HTMLURL: String("https://github.com/octocat/Hello-World/blob/master/LICENSE"), - NodeID: String("MDc6TGljZW5zZW1pdA=="), + 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=="), }, Readme: &Metric{ - URL: String("https://api.github.com/repos/octocat/Hello-World/contents/README.md"), - HTMLURL: String("https://github.com/octocat/Hello-World/blob/master/README.md"), + 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"), }, }, } @@ -138,12 +138,12 @@ func TestMetric_Marshal(t *testing.T) { testJSONMarshal(t, &Metric{}, "{}") r := &Metric{ - Name: String("name"), - Key: String("key"), - SPDXID: String("spdx_id"), - URL: String("url"), - HTMLURL: String("hurl"), - NodeID: String("node_id"), + Name: Ptr("name"), + Key: Ptr("key"), + SPDXID: Ptr("spdx_id"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + NodeID: Ptr("node_id"), } want := `{ @@ -164,48 +164,48 @@ func TestCommunityHealthFiles_Marshal(t *testing.T) { r := &CommunityHealthFiles{ CodeOfConduct: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, CodeOfConductFile: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, Contributing: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, IssueTemplate: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, PullRequestTemplate: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, License: &Metric{ - Name: String("name"), - Key: String("key"), - SPDXID: String("spdx_id"), - URL: String("url"), - HTMLURL: String("hurl"), - NodeID: String("node_id"), + Name: Ptr("name"), + Key: Ptr("key"), + SPDXID: Ptr("spdx_id"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + NodeID: Ptr("node_id"), }, Readme: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, } @@ -264,57 +264,57 @@ func TestCommunityHealthMetrics_Marshal(t *testing.T) { testJSONMarshal(t, &CommunityHealthMetrics{}, "{}") r := &CommunityHealthMetrics{ - HealthPercentage: Int(1), - Description: String("desc"), - Documentation: String("docs"), + HealthPercentage: Ptr(1), + Description: Ptr("desc"), + Documentation: Ptr("docs"), Files: &CommunityHealthFiles{ CodeOfConduct: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, CodeOfConductFile: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, Contributing: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, IssueTemplate: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, PullRequestTemplate: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, License: &Metric{ - Name: String("name"), - Key: String("key"), - SPDXID: String("spdx_id"), - URL: String("url"), - HTMLURL: String("hurl"), - NodeID: String("node_id"), + Name: Ptr("name"), + Key: Ptr("key"), + SPDXID: Ptr("spdx_id"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + NodeID: Ptr("node_id"), }, Readme: &Metric{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - HTMLURL: String("hurl"), + Name: Ptr("name"), + Key: Ptr("key"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), }, }, UpdatedAt: &Timestamp{referenceTime}, - ContentReportsEnabled: Bool(true), + ContentReportsEnabled: Ptr(true), } want := `{ diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index cf139d77d61..b50e32fc30c 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -25,14 +25,14 @@ func TestRepositoryContent_GetContent(t *testing.T) { wantErr bool // whether an error is expected }{ { - encoding: String(""), - content: String("hello"), + encoding: Ptr(""), + content: Ptr("hello"), want: "hello", wantErr: false, }, { encoding: nil, - content: String("hello"), + content: Ptr("hello"), want: "hello", wantErr: false, }, @@ -43,19 +43,19 @@ func TestRepositoryContent_GetContent(t *testing.T) { wantErr: false, }, { - encoding: String("base64"), - content: String("aGVsbG8="), + encoding: Ptr("base64"), + content: Ptr("aGVsbG8="), want: "hello", wantErr: false, }, { - encoding: String("bad"), - content: String("aGVsbG8="), + encoding: Ptr("bad"), + content: Ptr("aGVsbG8="), want: "", wantErr: true, }, { - encoding: String("none"), + encoding: Ptr("none"), content: nil, want: "", wantErr: true, @@ -107,7 +107,7 @@ func TestRepositoriesService_GetReadme(t *testing.T) { if err != nil { t.Errorf("Repositories.GetReadme returned error: %v", err) } - want := &RepositoryContent{Type: String("file"), Name: String("README.md"), Size: Int(5362), Encoding: String("base64"), Path: String("README.md")} + want := &RepositoryContent{Type: Ptr("file"), Name: Ptr("README.md"), Size: Ptr(5362), Encoding: Ptr("base64"), Path: Ptr("README.md")} if !cmp.Equal(readme, want) { t.Errorf("Repositories.GetReadme returned %+v, want %+v", readme, want) } @@ -433,7 +433,7 @@ func TestRepositoriesService_GetContents_File(t *testing.T) { if err != nil { t.Errorf("Repositories.GetContents returned error: %v", err) } - want := &RepositoryContent{Type: String("file"), Name: String("LICENSE"), Size: Int(20678), Encoding: String("base64"), Path: String("LICENSE")} + want := &RepositoryContent{Type: Ptr("file"), Name: Ptr("LICENSE"), Size: Ptr(20678), Encoding: Ptr("base64"), Path: Ptr("LICENSE")} if !cmp.Equal(fileContents, want) { t.Errorf("Repositories.GetContents returned %+v, want %+v", fileContents, want) } @@ -536,8 +536,8 @@ func TestRepositoriesService_GetContents_Directory(t *testing.T) { if err != nil { t.Errorf("Repositories.GetContents returned error: %v", err) } - want := []*RepositoryContent{{Type: String("dir"), Name: String("lib"), Path: String("lib")}, - {Type: String("file"), Name: String("LICENSE"), Size: Int(20678), Path: String("LICENSE")}} + want := []*RepositoryContent{{Type: Ptr("dir"), Name: Ptr("lib"), Path: Ptr("lib")}, + {Type: Ptr("file"), Name: Ptr("LICENSE"), Size: Ptr(20678), Path: Ptr("LICENSE")}} if !cmp.Equal(directoryContents, want) { t.Errorf("Repositories.GetContents_Directory returned %+v, want %+v", directoryContents, want) } @@ -564,7 +564,7 @@ func TestRepositoriesService_CreateFile(t *testing.T) { repositoryContentsOptions := &RepositoryContentFileOptions{ Message: &message, Content: content, - Committer: &CommitAuthor{Name: String("n"), Email: String("e")}, + Committer: &CommitAuthor{Name: Ptr("n"), Email: Ptr("e")}, } ctx := context.Background() createResponse, _, err := client.Repositories.CreateFile(ctx, "o", "r", "p", repositoryContentsOptions) @@ -572,10 +572,10 @@ func TestRepositoriesService_CreateFile(t *testing.T) { t.Errorf("Repositories.CreateFile returned error: %v", err) } want := &RepositoryContentResponse{ - Content: &RepositoryContent{Name: String("p")}, + Content: &RepositoryContent{Name: Ptr("p")}, Commit: Commit{ - Message: String("m"), - SHA: String("f5f369044773ff9c6383c087466d12adb6fa0828"), + Message: Ptr("m"), + SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), }, } if !cmp.Equal(createResponse, want) { @@ -620,7 +620,7 @@ func TestRepositoriesService_UpdateFile(t *testing.T) { Message: &message, Content: content, SHA: &sha, - Committer: &CommitAuthor{Name: String("n"), Email: String("e")}, + Committer: &CommitAuthor{Name: Ptr("n"), Email: Ptr("e")}, } ctx := context.Background() updateResponse, _, err := client.Repositories.UpdateFile(ctx, "o", "r", "p", repositoryContentsOptions) @@ -628,10 +628,10 @@ func TestRepositoriesService_UpdateFile(t *testing.T) { t.Errorf("Repositories.UpdateFile returned error: %v", err) } want := &RepositoryContentResponse{ - Content: &RepositoryContent{Name: String("p")}, + Content: &RepositoryContent{Name: Ptr("p")}, Commit: Commit{ - Message: String("m"), - SHA: String("f5f369044773ff9c6383c087466d12adb6fa0828"), + Message: Ptr("m"), + SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), }, } if !cmp.Equal(updateResponse, want) { @@ -672,7 +672,7 @@ func TestRepositoriesService_DeleteFile(t *testing.T) { repositoryContentsOptions := &RepositoryContentFileOptions{ Message: &message, SHA: &sha, - Committer: &CommitAuthor{Name: String("n"), Email: String("e")}, + Committer: &CommitAuthor{Name: Ptr("n"), Email: Ptr("e")}, } ctx := context.Background() deleteResponse, _, err := client.Repositories.DeleteFile(ctx, "o", "r", "p", repositoryContentsOptions) @@ -682,8 +682,8 @@ func TestRepositoriesService_DeleteFile(t *testing.T) { want := &RepositoryContentResponse{ Content: nil, Commit: Commit{ - Message: String("m"), - SHA: String("f5f369044773ff9c6383c087466d12adb6fa0828"), + Message: Ptr("m"), + SHA: Ptr("f5f369044773ff9c6383c087466d12adb6fa0828"), }, } if !cmp.Equal(deleteResponse, want) { @@ -811,19 +811,19 @@ func TestRepositoryContent_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryContent{}, "{}") r := &RepositoryContent{ - Type: String("type"), - Target: String("target"), - Encoding: String("encoding"), - Size: Int(1), - Name: String("name"), - Path: String("path"), - Content: String("content"), - SHA: String("sha"), - URL: String("url"), - GitURL: String("gurl"), - HTMLURL: String("hurl"), - DownloadURL: String("durl"), - SubmoduleGitURL: String("smgurl"), + Type: Ptr("type"), + Target: Ptr("target"), + Encoding: Ptr("encoding"), + Size: Ptr(1), + Name: Ptr("name"), + Path: Ptr("path"), + Content: Ptr("content"), + SHA: Ptr("sha"), + URL: Ptr("url"), + GitURL: Ptr("gurl"), + HTMLURL: Ptr("hurl"), + DownloadURL: Ptr("durl"), + SubmoduleGitURL: Ptr("smgurl"), } want := `{ @@ -851,64 +851,64 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) { r := &RepositoryContentResponse{ Content: &RepositoryContent{ - Type: String("type"), - Target: String("target"), - Encoding: String("encoding"), - Size: Int(1), - Name: String("name"), - Path: String("path"), - Content: String("content"), - SHA: String("sha"), - URL: String("url"), - GitURL: String("gurl"), - HTMLURL: String("hurl"), - DownloadURL: String("durl"), - SubmoduleGitURL: String("smgurl"), + Type: Ptr("type"), + Target: Ptr("target"), + Encoding: Ptr("encoding"), + Size: Ptr(1), + Name: Ptr("name"), + Path: Ptr("path"), + Content: Ptr("content"), + SHA: Ptr("sha"), + URL: Ptr("url"), + GitURL: Ptr("gurl"), + HTMLURL: Ptr("hurl"), + DownloadURL: Ptr("durl"), + SubmoduleGitURL: Ptr("smgurl"), }, Commit: Commit{ - SHA: String("s"), + SHA: Ptr("s"), Author: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), }, Committer: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("n"), - Email: String("e"), - Login: String("u"), + Name: Ptr("n"), + Email: Ptr("e"), + Login: Ptr("u"), }, - Message: String("m"), + Message: Ptr("m"), Tree: &Tree{ - SHA: String("s"), + SHA: Ptr("s"), Entries: []*TreeEntry{{ - SHA: String("s"), - Path: String("p"), - Mode: String("m"), - Type: String("t"), - Size: Int(1), - Content: String("c"), - URL: String("u"), + SHA: Ptr("s"), + Path: Ptr("p"), + Mode: Ptr("m"), + Type: Ptr("t"), + Size: Ptr(1), + Content: Ptr("c"), + URL: Ptr("u"), }}, - Truncated: Bool(false), + Truncated: Ptr(false), }, Parents: nil, Stats: &CommitStats{ - Additions: Int(1), - Deletions: Int(1), - Total: Int(1), + Additions: Ptr(1), + Deletions: Ptr(1), + Total: Ptr(1), }, - HTMLURL: String("h"), - URL: String("u"), + HTMLURL: Ptr("h"), + URL: Ptr("u"), Verification: &SignatureVerification{ - Verified: Bool(false), - Reason: String("r"), - Signature: String("s"), - Payload: String("p"), + Verified: Ptr(false), + Reason: Ptr("r"), + Signature: Ptr("s"), + Payload: Ptr("p"), }, - NodeID: String("n"), - CommentCount: Int(1), + NodeID: Ptr("n"), + CommentCount: Ptr(1), }, } @@ -984,21 +984,21 @@ func TestRepositoryContentFileOptions_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryContentFileOptions{}, "{}") r := &RepositoryContentFileOptions{ - Message: String("type"), + Message: Ptr("type"), Content: []byte{1}, - SHA: String("type"), - Branch: String("type"), + SHA: Ptr("type"), + Branch: Ptr("type"), Author: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("name"), - Email: String("email"), - Login: String("login"), + Name: Ptr("name"), + Email: Ptr("email"), + Login: Ptr("login"), }, Committer: &CommitAuthor{ Date: &Timestamp{referenceTime}, - Name: String("name"), - Email: String("email"), - Login: String("login"), + Name: Ptr("name"), + Email: Ptr("email"), + Login: Ptr("login"), }, } diff --git a/github/repos_deployment_branch_policies_test.go b/github/repos_deployment_branch_policies_test.go index 355bcb442e4..bbf4499cf9c 100644 --- a/github/repos_deployment_branch_policies_test.go +++ b/github/repos_deployment_branch_policies_test.go @@ -29,10 +29,10 @@ func TestRepositoriesService_ListDeploymentBranchPolicies(t *testing.T) { want := &DeploymentBranchPolicyResponse{ BranchPolicies: []*DeploymentBranchPolicy{ - {ID: Int64(1)}, - {ID: Int64(2)}, + {ID: Ptr(int64(1))}, + {ID: Ptr(int64(2))}, }, - TotalCount: Int(2), + TotalCount: Ptr(2), } if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.ListDeploymentBranchPolicies = %+v, want %+v", got, want) @@ -62,7 +62,7 @@ func TestRepositoriesService_GetDeploymentBranchPolicy(t *testing.T) { t.Errorf("Repositories.GetDeploymentBranchPolicy returned error: %v", err) } - want := &DeploymentBranchPolicy{ID: Int64(1)} + want := &DeploymentBranchPolicy{ID: Ptr(int64(1))} if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.GetDeploymentBranchPolicy = %+v, want %+v", got, want) } @@ -87,19 +87,19 @@ func TestRepositoriesService_CreateDeploymentBranchPolicy(t *testing.T) { }) ctx := context.Background() - got, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", &DeploymentBranchPolicyRequest{Name: String("n"), Type: String("branch")}) + got, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", &DeploymentBranchPolicyRequest{Name: Ptr("n"), Type: Ptr("branch")}) if err != nil { t.Errorf("Repositories.CreateDeploymentBranchPolicy returned error: %v", err) } - want := &DeploymentBranchPolicy{ID: Int64(1), Type: String("branch")} + want := &DeploymentBranchPolicy{ID: Ptr(int64(1)), Type: Ptr("branch")} if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.CreateDeploymentBranchPolicy = %+v, want %+v", got, want) } const methodName = "CreateDeploymentBranchPolicy" testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", &DeploymentBranchPolicyRequest{Name: String("n")}) + got, resp, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", &DeploymentBranchPolicyRequest{Name: Ptr("n")}) if got != nil { t.Errorf("got non-nil Repositories.CreateDeploymentBranchPolicy response: %+v", got) } @@ -117,19 +117,19 @@ func TestRepositoriesService_UpdateDeploymentBranchPolicy(t *testing.T) { }) ctx := context.Background() - got, _, err := client.Repositories.UpdateDeploymentBranchPolicy(ctx, "o", "r", "e", 1, &DeploymentBranchPolicyRequest{Name: String("n")}) + got, _, err := client.Repositories.UpdateDeploymentBranchPolicy(ctx, "o", "r", "e", 1, &DeploymentBranchPolicyRequest{Name: Ptr("n")}) if err != nil { t.Errorf("Repositories.UpdateDeploymentBranchPolicy returned error: %v", err) } - want := &DeploymentBranchPolicy{ID: Int64(1)} + want := &DeploymentBranchPolicy{ID: Ptr(int64(1))} if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.UpdateDeploymentBranchPolicy = %+v, want %+v", got, want) } const methodName = "UpdateDeploymentBranchPolicy" testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.UpdateDeploymentBranchPolicy(ctx, "o", "r", "e", 1, &DeploymentBranchPolicyRequest{Name: String("n")}) + got, resp, err := client.Repositories.UpdateDeploymentBranchPolicy(ctx, "o", "r", "e", 1, &DeploymentBranchPolicyRequest{Name: Ptr("n")}) if got != nil { t.Errorf("got non-nil Repositories.UpdateDeploymentBranchPolicy response: %+v", got) } diff --git a/github/repos_deployment_protection_rules_test.go b/github/repos_deployment_protection_rules_test.go index 5677d5f8afc..d17f0695a0c 100644 --- a/github/repos_deployment_protection_rules_test.go +++ b/github/repos_deployment_protection_rules_test.go @@ -33,10 +33,10 @@ func TestRepositoriesService_GetAllDeploymentProtectionRules(t *testing.T) { want := &ListDeploymentProtectionRuleResponse{ ProtectionRules: []*CustomDeploymentProtectionRule{ - {ID: Int64(3), NodeID: String("IEH37kRlcGxveW1lbnRTdGF0ddiv"), Enabled: Bool(true), App: &CustomDeploymentProtectionRuleApp{ID: Int64(1), NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: String("a-custom-app"), IntegrationURL: String("https://api.github.com/apps/a-custom-app")}}, - {ID: Int64(4), NodeID: String("MDE2OkRlcGxveW1lbnRTdHJ41128"), Enabled: Bool(true), App: &CustomDeploymentProtectionRuleApp{ID: Int64(1), NodeID: String("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: String("another-custom-app"), IntegrationURL: String("https://api.github.com/apps/another-custom-app")}}, + {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")}}, }, - TotalCount: Int(2), + TotalCount: Ptr(2), } if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.GetAllDeploymentProtectionRules = %+v, want %+v", got, want) @@ -57,7 +57,7 @@ func TestRepositoriesService_CreateCustomDeploymentProtectionRule(t *testing.T) client, mux, _ := setup(t) input := &CustomDeploymentProtectionRuleRequest{ - IntegrationID: Int64(5), + IntegrationID: Ptr(int64(5)), } mux.HandleFunc("/repos/o/r/environments/e/deployment_protection_rules", func(w http.ResponseWriter, r *http.Request) { @@ -80,14 +80,14 @@ func TestRepositoriesService_CreateCustomDeploymentProtectionRule(t *testing.T) } want := &CustomDeploymentProtectionRule{ - ID: Int64(3), - NodeID: String("IEH37kRlcGxveW1lbnRTdGF0ddiv"), - Enabled: Bool(true), + ID: Ptr(int64(3)), + NodeID: Ptr("IEH37kRlcGxveW1lbnRTdGF0ddiv"), + Enabled: Ptr(true), App: &CustomDeploymentProtectionRuleApp{ - ID: Int64(1), - NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), - Slug: String("a-custom-app"), - IntegrationURL: String("https://api.github.com/apps/a-custom-app"), + ID: Ptr(int64(1)), + NodeID: Ptr("GHT58kRlcGxveW1lbnRTdTY!bbcy"), + Slug: Ptr("a-custom-app"), + IntegrationURL: Ptr("https://api.github.com/apps/a-custom-app"), }, } if !reflect.DeepEqual(got, want) { @@ -125,10 +125,10 @@ func TestRepositoriesService_ListCustomDeploymentRuleIntegrations(t *testing.T) } want := &ListCustomDeploymentRuleIntegrationsResponse{ - TotalCount: Int(2), + TotalCount: Ptr(2), AvailableIntegrations: []*CustomDeploymentProtectionRuleApp{ - {ID: Int64(1), NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: String("a-custom-app"), IntegrationURL: String("https://api.github.com/apps/a-custom-app")}, - {ID: Int64(2), NodeID: String("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: String("another-custom-app"), IntegrationURL: String("https://api.github.com/apps/another-custom-app")}, + {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")}, }, } if !reflect.DeepEqual(got, want) { @@ -161,14 +161,14 @@ func TestRepositoriesService_GetCustomDeploymentProtectionRule(t *testing.T) { } want := &CustomDeploymentProtectionRule{ - ID: Int64(1), - NodeID: String("IEH37kRlcGxveW1lbnRTdGF0ddiv"), - Enabled: Bool(true), + ID: Ptr(int64(1)), + NodeID: Ptr("IEH37kRlcGxveW1lbnRTdGF0ddiv"), + Enabled: Ptr(true), App: &CustomDeploymentProtectionRuleApp{ - ID: Int64(1), - NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), - Slug: String("a-custom-app"), - IntegrationURL: String("https://api.github.com/apps/a-custom-app"), + ID: Ptr(int64(1)), + NodeID: Ptr("GHT58kRlcGxveW1lbnRTdTY!bbcy"), + Slug: Ptr("a-custom-app"), + IntegrationURL: Ptr("https://api.github.com/apps/a-custom-app"), }, } diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index 722d31d9037..cc451e34236 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -33,7 +33,7 @@ func TestRepositoriesService_ListDeployments(t *testing.T) { t.Errorf("Repositories.ListDeployments returned error: %v", err) } - want := []*Deployment{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*Deployment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(deployments, want) { t.Errorf("Repositories.ListDeployments returned %+v, want %+v", deployments, want) } @@ -68,7 +68,7 @@ func TestRepositoriesService_GetDeployment(t *testing.T) { t.Errorf("Repositories.GetDeployment returned error: %v", err) } - want := &Deployment{ID: Int64(3)} + want := &Deployment{ID: Ptr(int64(3))} if !cmp.Equal(deployment, want) { t.Errorf("Repositories.GetDeployment returned %+v, want %+v", deployment, want) @@ -93,7 +93,7 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &DeploymentRequest{Ref: String("1111"), Task: String("deploy"), TransientEnvironment: Bool(true)} + input := &DeploymentRequest{Ref: Ptr("1111"), Task: Ptr("deploy"), TransientEnvironment: Ptr(true)} mux.HandleFunc("/repos/o/r/deployments", func(w http.ResponseWriter, r *http.Request) { v := new(DeploymentRequest) @@ -115,7 +115,7 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { t.Errorf("Repositories.CreateDeployment returned error: %v", err) } - want := &Deployment{Ref: String("1111"), Task: String("deploy")} + want := &Deployment{Ref: Ptr("1111"), Task: Ptr("deploy")} if !cmp.Equal(deployment, want) { t.Errorf("Repositories.CreateDeployment returned %+v, want %+v", deployment, want) } @@ -191,7 +191,7 @@ func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) { t.Errorf("Repositories.ListDeploymentStatuses returned error: %v", err) } - want := []*DeploymentStatus{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*DeploymentStatus{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(statutses, want) { t.Errorf("Repositories.ListDeploymentStatuses returned %+v, want %+v", statutses, want) } @@ -228,7 +228,7 @@ func TestRepositoriesService_GetDeploymentStatus(t *testing.T) { t.Errorf("Repositories.GetDeploymentStatus returned error: %v", err) } - want := &DeploymentStatus{ID: Int64(4)} + want := &DeploymentStatus{ID: Ptr(int64(4))} if !cmp.Equal(deploymentStatus, want) { t.Errorf("Repositories.GetDeploymentStatus returned %+v, want %+v", deploymentStatus, want) } @@ -252,7 +252,7 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &DeploymentStatusRequest{State: String("inactive"), Description: String("deploy"), AutoInactive: Bool(false)} + input := &DeploymentStatusRequest{State: Ptr("inactive"), Description: Ptr("deploy"), AutoInactive: Ptr(false)} mux.HandleFunc("/repos/o/r/deployments/1/statuses", func(w http.ResponseWriter, r *http.Request) { v := new(DeploymentStatusRequest) @@ -274,7 +274,7 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) { t.Errorf("Repositories.CreateDeploymentStatus returned error: %v", err) } - want := &DeploymentStatus{State: String("inactive"), Description: String("deploy")} + want := &DeploymentStatus{State: Ptr("inactive"), Description: Ptr("deploy")} if !cmp.Equal(deploymentStatus, want) { t.Errorf("Repositories.CreateDeploymentStatus returned %+v, want %+v", deploymentStatus, want) } @@ -299,12 +299,12 @@ func TestDeploymentStatusRequest_Marshal(t *testing.T) { testJSONMarshal(t, &DeploymentStatusRequest{}, "{}") r := &DeploymentStatusRequest{ - State: String("state"), - LogURL: String("logurl"), - Description: String("desc"), - Environment: String("env"), - EnvironmentURL: String("eurl"), - AutoInactive: Bool(false), + State: Ptr("state"), + LogURL: Ptr("logurl"), + Description: Ptr("desc"), + Environment: Ptr("env"), + EnvironmentURL: Ptr("eurl"), + AutoInactive: Ptr(false), } want := `{ @@ -324,39 +324,39 @@ func TestDeploymentStatus_Marshal(t *testing.T) { testJSONMarshal(t, &DeploymentStatus{}, "{}") r := &DeploymentStatus{ - ID: Int64(1), - State: String("state"), + ID: Ptr(int64(1)), + State: Ptr("state"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Description: String("desc"), - Environment: String("env"), - NodeID: String("nid"), + Description: Ptr("desc"), + Environment: Ptr("env"), + NodeID: Ptr("nid"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - TargetURL: String("turl"), - DeploymentURL: String("durl"), - RepositoryURL: String("rurl"), - EnvironmentURL: String("eurl"), - LogURL: String("lurl"), - URL: String("url"), + TargetURL: Ptr("turl"), + DeploymentURL: Ptr("durl"), + RepositoryURL: Ptr("rurl"), + EnvironmentURL: Ptr("eurl"), + LogURL: Ptr("lurl"), + URL: Ptr("url"), } want := `{ @@ -403,15 +403,15 @@ func TestDeploymentRequest_Marshal(t *testing.T) { testJSONMarshal(t, &DeploymentRequest{}, "{}") r := &DeploymentRequest{ - Ref: String("ref"), - Task: String("task"), - AutoMerge: Bool(false), + Ref: Ptr("ref"), + Task: Ptr("task"), + AutoMerge: Ptr(false), RequiredContexts: &[]string{"s"}, Payload: "payload", - Environment: String("environment"), - Description: String("description"), - TransientEnvironment: Bool(false), - ProductionEnvironment: Bool(false), + Environment: Ptr("environment"), + Description: Ptr("description"), + TransientEnvironment: Ptr(false), + ProductionEnvironment: Ptr(false), } want := `{ @@ -437,39 +437,39 @@ func TestDeployment_Marshal(t *testing.T) { jsonMsg, _ := json.Marshal(str) r := &Deployment{ - URL: String("url"), - ID: Int64(1), - SHA: String("sha"), - Ref: String("ref"), - Task: String("task"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + SHA: Ptr("sha"), + Ref: Ptr("ref"), + Task: Ptr("task"), Payload: jsonMsg, - Environment: String("env"), - Description: String("desc"), + Environment: Ptr("env"), + Description: Ptr("desc"), Creator: &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - StatusesURL: String("surl"), - RepositoryURL: String("rurl"), - NodeID: String("nid"), + StatusesURL: Ptr("surl"), + RepositoryURL: Ptr("rurl"), + NodeID: Ptr("nid"), } want := `{ diff --git a/github/repos_environments.go b/github/repos_environments.go index ed81e3a1f95..d3e34fa8f80 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -157,10 +157,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 = Int(0) + c.WaitTimer = Ptr(0) } if c.CanAdminsBypass == nil { - c.CanAdminsBypass = Bool(true) + c.CanAdminsBypass = Ptr(true) } return json.Marshal(&struct { *Alias diff --git a/github/repos_environments_test.go b/github/repos_environments_test.go index 34b02ca8637..438ab71c288 100644 --- a/github/repos_environments_test.go +++ b/github/repos_environments_test.go @@ -24,17 +24,17 @@ func TestRequiredReviewer_UnmarshalJSON(t *testing.T) { }{ "User Reviewer": { data: []byte(`[{"type": "User", "reviewer": {"id": 1,"login": "octocat"}}]`), - wantRule: []*RequiredReviewer{{Type: String("User"), Reviewer: &User{ID: Int64(1), Login: String("octocat")}}}, + wantRule: []*RequiredReviewer{{Type: Ptr("User"), Reviewer: &User{ID: Ptr(int64(1)), Login: Ptr("octocat")}}}, wantError: false, }, "Team Reviewer": { data: []byte(`[{"type": "Team", "reviewer": {"id": 1, "name": "Justice League"}}]`), - wantRule: []*RequiredReviewer{{Type: String("Team"), Reviewer: &Team{ID: Int64(1), Name: String("Justice League")}}}, + wantRule: []*RequiredReviewer{{Type: Ptr("Team"), Reviewer: &Team{ID: Ptr(int64(1)), Name: Ptr("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: String("User"), Reviewer: &User{ID: Int64(1), Login: String("octocat")}}, {Type: String("Team"), Reviewer: &Team{ID: Int64(1), Name: String("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")}}}, wantError: false, }, "Empty JSON Object": { @@ -54,12 +54,12 @@ func TestRequiredReviewer_UnmarshalJSON(t *testing.T) { }, "Wrong ID Type in User Object": { data: []byte(`[{"type": "User", "reviewer": {"id": "string"}}]`), - wantRule: []*RequiredReviewer{{Type: String("User"), Reviewer: nil}}, + wantRule: []*RequiredReviewer{{Type: Ptr("User"), Reviewer: nil}}, wantError: true, }, "Wrong ID Type in Team Object": { data: []byte(`[{"type": "Team", "reviewer": {"id": "string"}}]`), - wantRule: []*RequiredReviewer{{Type: String("Team"), Reviewer: nil}}, + wantRule: []*RequiredReviewer{{Type: Ptr("Team"), Reviewer: nil}}, wantError: true, }, "Wrong Type of Reviewer": { @@ -123,7 +123,7 @@ func TestRepositoriesService_ListEnvironments(t *testing.T) { if err != nil { t.Errorf("Repositories.ListEnvironments returned error: %v", err) } - want := &EnvResponse{TotalCount: Int(1), Environments: []*Environment{{ID: Int64(1)}, {ID: Int64(2)}}} + want := &EnvResponse{TotalCount: Ptr(1), Environments: []*Environment{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}} if !cmp.Equal(environments, want) { t.Errorf("Repositories.ListEnvironments returned %+v, want %+v", environments, want) } @@ -158,7 +158,7 @@ func TestRepositoriesService_GetEnvironment(t *testing.T) { t.Errorf("Repositories.GetEnvironment returned error: %v\n%v", err, resp.Body) } - want := &Environment{ID: Int64(1), Name: String("staging"), DeploymentBranchPolicy: &BranchPolicy{ProtectedBranches: Bool(true), CustomBranchPolicies: Bool(false)}, CanAdminsBypass: Bool(false)} + want := &Environment{ID: Ptr(int64(1)), Name: Ptr("staging"), DeploymentBranchPolicy: &BranchPolicy{ProtectedBranches: Ptr(true), CustomBranchPolicies: Ptr(false)}, CanAdminsBypass: Ptr(false)} if !cmp.Equal(release, want) { t.Errorf("Repositories.GetEnvironment returned %+v, want %+v", release, want) } @@ -183,7 +183,7 @@ func TestRepositoriesService_CreateEnvironment(t *testing.T) { client, mux, _ := setup(t) input := &CreateUpdateEnvironment{ - WaitTimer: Int(30), + WaitTimer: Ptr(30), } mux.HandleFunc("/repos/o/r/environments/e", func(w http.ResponseWriter, r *http.Request) { @@ -191,7 +191,7 @@ func TestRepositoriesService_CreateEnvironment(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") - want := &CreateUpdateEnvironment{WaitTimer: Int(30), CanAdminsBypass: Bool(true)} + want := &CreateUpdateEnvironment{WaitTimer: Ptr(30), CanAdminsBypass: Ptr(true)} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -204,7 +204,7 @@ func TestRepositoriesService_CreateEnvironment(t *testing.T) { t.Errorf("Repositories.CreateUpdateEnvironment returned error: %v", err) } - want := &Environment{ID: Int64(1), Name: String("staging"), ProtectionRules: []*ProtectionRule{{ID: Int64(1), Type: String("wait_timer"), WaitTimer: Int(30)}}} + want := &Environment{ID: Ptr(int64(1)), Name: Ptr("staging"), ProtectionRules: []*ProtectionRule{{ID: Ptr(int64(1)), Type: Ptr("wait_timer"), WaitTimer: Ptr(30)}}} if !cmp.Equal(release, want) { t.Errorf("Repositories.CreateUpdateEnvironment returned %+v, want %+v", release, want) } @@ -254,7 +254,7 @@ func TestRepositoriesService_CreateEnvironment_noEnterprise(t *testing.T) { t.Errorf("Repositories.CreateUpdateEnvironment returned error: %v", err) } - want := &Environment{ID: Int64(1), Name: String("staging"), ProtectionRules: []*ProtectionRule{}} + want := &Environment{ID: Ptr(int64(1)), Name: Ptr("staging"), ProtectionRules: []*ProtectionRule{}} if !cmp.Equal(release, want) { t.Errorf("Repositories.CreateUpdateEnvironment returned %+v, want %+v", release, want) } @@ -266,8 +266,8 @@ func TestRepositoriesService_createNewEnvNoEnterprise(t *testing.T) { input := &CreateUpdateEnvironment{ DeploymentBranchPolicy: &BranchPolicy{ - ProtectedBranches: Bool(true), - CustomBranchPolicies: Bool(false), + ProtectedBranches: Ptr(true), + CustomBranchPolicies: Ptr(false), }, } @@ -278,8 +278,8 @@ func TestRepositoriesService_createNewEnvNoEnterprise(t *testing.T) { testMethod(t, r, "PUT") want := &createUpdateEnvironmentNoEnterprise{ DeploymentBranchPolicy: &BranchPolicy{ - ProtectedBranches: Bool(true), - CustomBranchPolicies: Bool(false), + ProtectedBranches: Ptr(true), + CustomBranchPolicies: Ptr(false), }, } if !cmp.Equal(v, want) { @@ -295,18 +295,18 @@ func TestRepositoriesService_createNewEnvNoEnterprise(t *testing.T) { } want := &Environment{ - ID: Int64(1), - Name: String("staging"), + ID: Ptr(int64(1)), + Name: Ptr("staging"), ProtectionRules: []*ProtectionRule{ { - ID: Int64(1), - NodeID: String("id"), - Type: String("branch_policy"), + ID: Ptr(int64(1)), + NodeID: Ptr("id"), + Type: Ptr("branch_policy"), }, }, DeploymentBranchPolicy: &BranchPolicy{ - ProtectedBranches: Bool(true), - CustomBranchPolicies: Bool(false), + ProtectedBranches: Ptr(true), + CustomBranchPolicies: Ptr(false), }, } if !cmp.Equal(release, want) { @@ -358,40 +358,40 @@ func TestRepoEnvironment_Marshal(t *testing.T) { testJSONMarshal(t, &EnvResponse{}, "{}") repoEnv := &EnvResponse{ - TotalCount: Int(1), + TotalCount: Ptr(1), Environments: []*Environment{ { - Owner: String("me"), - Repo: String("se"), - EnvironmentName: String("dev"), - WaitTimer: Int(123), + Owner: Ptr("me"), + Repo: Ptr("se"), + EnvironmentName: Ptr("dev"), + WaitTimer: Ptr(123), Reviewers: []*EnvReviewers{ { - Type: String("main"), - ID: Int64(1), + Type: Ptr("main"), + ID: Ptr(int64(1)), }, { - Type: String("rev"), - ID: Int64(2), + Type: Ptr("rev"), + ID: Ptr(int64(2)), }, }, DeploymentBranchPolicy: &BranchPolicy{ - ProtectedBranches: Bool(false), - CustomBranchPolicies: Bool(false), + ProtectedBranches: Ptr(false), + CustomBranchPolicies: Ptr(false), }, - ID: Int64(2), - NodeID: String("star"), - Name: String("eg"), - URL: String("https://hey.in"), - HTMLURL: String("htmlurl"), + ID: Ptr(int64(2)), + NodeID: Ptr("star"), + Name: Ptr("eg"), + URL: Ptr("https://hey.in"), + HTMLURL: Ptr("htmlurl"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, ProtectionRules: []*ProtectionRule{ { - ID: Int64(21), - NodeID: String("mnb"), - Type: String("ewq"), - WaitTimer: Int(9090), + ID: Ptr(int64(21)), + NodeID: Ptr("mnb"), + Type: Ptr("ewq"), + WaitTimer: Ptr(9090), }, }, }, @@ -447,8 +447,8 @@ func TestEnvReviewers_Marshal(t *testing.T) { testJSONMarshal(t, &EnvReviewers{}, "{}") repoEnv := &EnvReviewers{ - Type: String("main"), - ID: Int64(1), + Type: Ptr("main"), + ID: Ptr(int64(1)), } want := `{ @@ -464,37 +464,37 @@ func TestEnvironment_Marshal(t *testing.T) { testJSONMarshal(t, &Environment{}, "{}") repoEnv := &Environment{ - Owner: String("o"), - Repo: String("r"), - EnvironmentName: String("e"), - WaitTimer: Int(123), + Owner: Ptr("o"), + Repo: Ptr("r"), + EnvironmentName: Ptr("e"), + WaitTimer: Ptr(123), Reviewers: []*EnvReviewers{ { - Type: String("main"), - ID: Int64(1), + Type: Ptr("main"), + ID: Ptr(int64(1)), }, { - Type: String("rev"), - ID: Int64(2), + Type: Ptr("rev"), + ID: Ptr(int64(2)), }, }, DeploymentBranchPolicy: &BranchPolicy{ - ProtectedBranches: Bool(false), - CustomBranchPolicies: Bool(false), + ProtectedBranches: Ptr(false), + CustomBranchPolicies: Ptr(false), }, - ID: Int64(2), - NodeID: String("star"), - Name: String("eg"), - URL: String("https://hey.in"), - HTMLURL: String("htmlurl"), + ID: Ptr(int64(2)), + NodeID: Ptr("star"), + Name: Ptr("eg"), + URL: Ptr("https://hey.in"), + HTMLURL: Ptr("htmlurl"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, ProtectionRules: []*ProtectionRule{ { - ID: Int64(21), - NodeID: String("mnb"), - Type: String("ewq"), - WaitTimer: Int(9090), + ID: Ptr(int64(21)), + NodeID: Ptr("mnb"), + Type: Ptr("ewq"), + WaitTimer: Ptr(9090), }, }, } @@ -543,8 +543,8 @@ func TestBranchPolicy_Marshal(t *testing.T) { testJSONMarshal(t, &BranchPolicy{}, "{}") bp := &BranchPolicy{ - ProtectedBranches: Bool(false), - CustomBranchPolicies: Bool(false), + ProtectedBranches: Ptr(false), + CustomBranchPolicies: Ptr(false), } want := `{ diff --git a/github/repos_forks_test.go b/github/repos_forks_test.go index ff7271b27c1..d90fbfd9a0d 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: Int64(1)}, {ID: Int64(2)}} + want := []*Repository{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(repos, want) { t.Errorf("Repositories.ListForks returned %+v, want %+v", repos, want) } @@ -84,7 +84,7 @@ func TestRepositoriesService_CreateFork(t *testing.T) { t.Errorf("Repositories.CreateFork returned error: %v", err) } - want := &Repository{ID: Int64(1)} + want := &Repository{ID: Ptr(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Repositories.CreateFork returned %+v, want %+v", repo, want) } @@ -123,7 +123,7 @@ func TestRepositoriesService_CreateFork_deferred(t *testing.T) { t.Errorf("Repositories.CreateFork returned error: %v (want AcceptedError)", err) } - want := &Repository{ID: Int64(1)} + want := &Repository{ID: Ptr(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 c17e1004255..d3403193277 100644 --- a/github/repos_hooks_configuration_test.go +++ b/github/repos_hooks_configuration_test.go @@ -31,10 +31,10 @@ func TestRepositoriesService_GetHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("0"), - Secret: String("********"), - URL: String("https://example.com/webhook"), + ContentType: Ptr("json"), + InsecureSSL: Ptr("0"), + Secret: Ptr("********"), + URL: Ptr("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Repositories.GetHookConfiguration returned %+v, want %+v", config, want) @@ -89,10 +89,10 @@ func TestRepositoriesService_EditHookConfiguration(t *testing.T) { } want := &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("0"), - Secret: String("********"), - URL: String("https://example.com/webhook"), + ContentType: Ptr("json"), + InsecureSSL: Ptr("0"), + Secret: Ptr("********"), + URL: Ptr("https://example.com/webhook"), } if !cmp.Equal(config, want) { t.Errorf("Repositories.EditHookConfiguration returned %+v, want %+v", config, want) diff --git a/github/repos_hooks_deliveries_test.go b/github/repos_hooks_deliveries_test.go index 71a04077a13..b168964674b 100644 --- a/github/repos_hooks_deliveries_test.go +++ b/github/repos_hooks_deliveries_test.go @@ -34,7 +34,7 @@ func TestRepositoriesService_ListHookDeliveries(t *testing.T) { t.Errorf("Repositories.ListHookDeliveries returned error: %v", err) } - want := []*HookDelivery{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*HookDelivery{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if d := cmp.Diff(hooks, want); d != "" { t.Errorf("Repositories.ListHooks want (-), got (+):\n%s", d) } @@ -78,7 +78,7 @@ func TestRepositoriesService_GetHookDelivery(t *testing.T) { t.Errorf("Repositories.GetHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Int64(1)} + want := &HookDelivery{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.GetHookDelivery returned %+v, want %+v", hook, want) } @@ -122,7 +122,7 @@ func TestRepositoriesService_RedeliverHookDelivery(t *testing.T) { t.Errorf("Repositories.RedeliverHookDelivery returned error: %v", err) } - want := &HookDelivery{ID: Int64(1)} + want := &HookDelivery{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.RedeliverHookDelivery returned %+v, want %+v", hook, want) } @@ -219,7 +219,7 @@ func TestHookDelivery_ParsePayload(t *testing.T) { p := json.RawMessage(bs) d := &HookDelivery{ - Event: String(evt), + Event: Ptr(evt), Request: &HookRequest{ RawPayload: &p, }, @@ -242,7 +242,7 @@ func TestHookDelivery_ParsePayload_invalidEvent(t *testing.T) { p := json.RawMessage(nil) d := &HookDelivery{ - Event: String("some_invalid_event"), + Event: Ptr("some_invalid_event"), Request: &HookRequest{ RawPayload: &p, }, @@ -259,7 +259,7 @@ func TestHookDelivery_ParsePayload_invalidPayload(t *testing.T) { p := json.RawMessage([]byte(`{"check_run":{"id":"invalid"}}`)) d := &HookDelivery{ - Event: String("check_run"), + Event: Ptr("check_run"), Request: &HookRequest{ RawPayload: &p, }, @@ -333,17 +333,17 @@ func TestHookDelivery_Marshal(t *testing.T) { jsonMsg, _ := json.Marshal(&header) r := &HookDelivery{ - ID: Int64(1), - GUID: String("guid"), + ID: Ptr(int64(1)), + GUID: Ptr("guid"), DeliveredAt: &Timestamp{referenceTime}, - Redelivery: Bool(true), - Duration: Float64(1), - Status: String("guid"), - StatusCode: Int(1), - Event: String("guid"), - Action: String("guid"), - InstallationID: Int64(1), - RepositoryID: Int64(1), + Redelivery: Ptr(true), + Duration: Ptr(1.0), + Status: Ptr("guid"), + StatusCode: Ptr(1), + Event: Ptr("guid"), + Action: Ptr("guid"), + InstallationID: Ptr(int64(1)), + RepositoryID: Ptr(int64(1)), Request: &HookRequest{ Headers: header, RawPayload: (*json.RawMessage)(&jsonMsg), diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index 27d81f4eaa7..17b13daadd4 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -40,7 +40,7 @@ func TestRepositoriesService_CreateHook(t *testing.T) { t.Errorf("Repositories.CreateHook returned error: %v", err) } - want := &Hook{ID: Int64(1)} + want := &Hook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.CreateHook returned %+v, want %+v", hook, want) } @@ -78,7 +78,7 @@ func TestRepositoriesService_ListHooks(t *testing.T) { t.Errorf("Repositories.ListHooks returned error: %v", err) } - want := []*Hook{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*Hook{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(hooks, want) { t.Errorf("Repositories.ListHooks returned %+v, want %+v", hooks, want) } @@ -132,7 +132,7 @@ func TestRepositoriesService_GetHook(t *testing.T) { t.Errorf("Repositories.GetHook returned error: %v", err) } - want := &Hook{ID: Int64(1)} + want := &Hook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.GetHook returned %+v, want %+v", hook, want) } @@ -185,7 +185,7 @@ func TestRepositoriesService_EditHook(t *testing.T) { t.Errorf("Repositories.EditHook returned error: %v", err) } - want := &Hook{ID: Int64(1)} + want := &Hook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.EditHook returned %+v, want %+v", hook, want) } @@ -312,64 +312,64 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) { testJSONMarshal(t, &WebHookPayload{}, "{}") v := &WebHookPayload{ - Action: String("action"), - After: String("after"), - Before: String("before"), + Action: Ptr("action"), + After: Ptr("after"), + Before: Ptr("before"), Commits: []*WebHookCommit{ { Added: []string{"1", "2", "3"}, Author: &WebHookAuthor{ - Email: String("abc@gmail.com"), - Name: String("abc"), - Login: String("abc_12"), + Email: Ptr("abc@gmail.com"), + Name: Ptr("abc"), + Login: Ptr("abc_12"), }, Committer: &WebHookAuthor{ - Email: String("abc@gmail.com"), - Name: String("abc"), - Login: String("abc_12"), + Email: Ptr("abc@gmail.com"), + Name: Ptr("abc"), + Login: Ptr("abc_12"), }, - ID: String("1"), - Message: String("WebHookCommit"), + ID: Ptr("1"), + Message: Ptr("WebHookCommit"), Modified: []string{"abc", "efg", "erd"}, Removed: []string{"cmd", "rti", "duv"}, }, }, - Compare: String("compare"), - Created: Bool(true), - Forced: Bool(false), + Compare: Ptr("compare"), + Created: Ptr(true), + Forced: Ptr(false), HeadCommit: &WebHookCommit{ Added: []string{"1", "2", "3"}, Author: &WebHookAuthor{ - Email: String("abc@gmail.com"), - Name: String("abc"), - Login: String("abc_12"), + Email: Ptr("abc@gmail.com"), + Name: Ptr("abc"), + Login: Ptr("abc_12"), }, Committer: &WebHookAuthor{ - Email: String("abc@gmail.com"), - Name: String("abc"), - Login: String("abc_12"), + Email: Ptr("abc@gmail.com"), + Name: Ptr("abc"), + Login: Ptr("abc_12"), }, - ID: String("1"), - Message: String("WebHookCommit"), + ID: Ptr("1"), + Message: Ptr("WebHookCommit"), Modified: []string{"abc", "efg", "erd"}, Removed: []string{"cmd", "rti", "duv"}, }, Installation: &Installation{ - ID: Int64(12), + ID: Ptr(int64(12)), }, Organization: &Organization{ - ID: Int64(22), + ID: Ptr(int64(22)), }, Pusher: &CommitAuthor{ - Login: String("rd@yahoo.com"), + Login: Ptr("rd@yahoo.com"), }, Repo: &PushEventRepository{ - ID: Int64(321), - NodeID: String("node_321"), + ID: Ptr(int64(321)), + NodeID: Ptr("node_321"), }, Sender: &User{ - Login: String("st@gmail.com"), - ID: Int64(202), + Login: Ptr("st@gmail.com"), + ID: Ptr(int64(202)), }, } @@ -443,9 +443,9 @@ func TestBranchWebHookAuthor_Marshal(t *testing.T) { testJSONMarshal(t, &WebHookAuthor{}, "{}") v := &WebHookAuthor{ - Email: String("abc@gmail.com"), - Name: String("abc"), - Login: String("abc_12"), + Email: Ptr("abc@gmail.com"), + Name: Ptr("abc"), + Login: Ptr("abc_12"), } want := `{ @@ -464,17 +464,17 @@ func TestBranchWebHookCommit_Marshal(t *testing.T) { v := &WebHookCommit{ Added: []string{"1", "2", "3"}, Author: &WebHookAuthor{ - Email: String("abc@gmail.com"), - Name: String("abc"), - Login: String("abc_12"), + Email: Ptr("abc@gmail.com"), + Name: Ptr("abc"), + Login: Ptr("abc_12"), }, Committer: &WebHookAuthor{ - Email: String("abc@gmail.com"), - Name: String("abc"), - Login: String("abc_12"), + Email: Ptr("abc@gmail.com"), + Name: Ptr("abc"), + Login: Ptr("abc_12"), }, - ID: String("1"), - Message: String("WebHookCommit"), + ID: Ptr("1"), + Message: Ptr("WebHookCommit"), Modified: []string{"abc", "efg", "erd"}, Removed: []string{"cmd", "rti", "duv"}, } @@ -507,8 +507,8 @@ func TestBranchCreateHookRequest_Marshal(t *testing.T) { v := &createHookRequest{ Name: "abc", Events: []string{"1", "2", "3"}, - Active: Bool(true), - Config: &HookConfig{ContentType: String("json")}, + Active: Ptr(true), + Config: &HookConfig{ContentType: Ptr("json")}, } want := `{ @@ -530,18 +530,18 @@ func TestBranchHook_Marshal(t *testing.T) { v := &Hook{ CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - URL: String("url"), - ID: Int64(1), - Type: String("type"), - Name: String("name"), - TestURL: String("testurl"), - PingURL: String("pingurl"), + URL: Ptr("url"), + ID: Ptr(int64(1)), + Type: Ptr("type"), + Name: Ptr("name"), + TestURL: Ptr("testurl"), + PingURL: Ptr("pingurl"), LastResponse: map[string]interface{}{ "item": "item", }, - Config: &HookConfig{ContentType: String("json")}, + Config: &HookConfig{ContentType: Ptr("json")}, Events: []string{"1", "2", "3"}, - Active: Bool(true), + Active: Ptr(true), } want := `{ diff --git a/github/repos_invitations_test.go b/github/repos_invitations_test.go index b5030cac1dd..06ca3e8bed7 100644 --- a/github/repos_invitations_test.go +++ b/github/repos_invitations_test.go @@ -31,7 +31,7 @@ func TestRepositoriesService_ListInvitations(t *testing.T) { t.Errorf("Repositories.ListInvitations returned error: %v", err) } - want := []*RepositoryInvitation{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*RepositoryInvitation{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListInvitations = %+v, want %+v", got, want) } @@ -92,7 +92,7 @@ func TestRepositoriesService_UpdateInvitation(t *testing.T) { t.Errorf("Repositories.UpdateInvitation returned error: %v", err) } - want := &RepositoryInvitation{ID: Int64(1)} + want := &RepositoryInvitation{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.UpdateInvitation = %+v, want %+v", got, want) } @@ -117,26 +117,26 @@ func TestRepositoryInvitation_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryInvitation{}, "{}") r := &RepositoryInvitation{ - ID: Int64(1), + ID: Ptr(int64(1)), Repo: &Repository{ - ID: Int64(1), - Name: String("n"), - URL: String("u"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + URL: Ptr("u"), }, Invitee: &User{ - ID: Int64(1), - Name: String("n"), - URL: String("u"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + URL: Ptr("u"), }, Inviter: &User{ - ID: Int64(1), - Name: String("n"), - URL: String("u"), + ID: Ptr(int64(1)), + Name: Ptr("n"), + URL: Ptr("u"), }, - Permissions: String("p"), + Permissions: Ptr("p"), CreatedAt: &Timestamp{referenceTime}, - URL: String("u"), - HTMLURL: String("h"), + URL: Ptr("u"), + HTMLURL: Ptr("h"), } want := `{ diff --git a/github/repos_keys_test.go b/github/repos_keys_test.go index 8b726c1160c..af63857116c 100644 --- a/github/repos_keys_test.go +++ b/github/repos_keys_test.go @@ -32,7 +32,7 @@ func TestRepositoriesService_ListKeys(t *testing.T) { t.Errorf("Repositories.ListKeys returned error: %v", err) } - want := []*Key{{ID: Int64(1)}} + want := []*Key{{ID: Ptr(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Repositories.ListKeys returned %+v, want %+v", keys, want) } @@ -76,7 +76,7 @@ func TestRepositoriesService_GetKey(t *testing.T) { t.Errorf("Repositories.GetKey returned error: %v", err) } - want := &Key{ID: Int64(1)} + want := &Key{ID: Ptr(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Repositories.GetKey returned %+v, want %+v", key, want) } @@ -109,7 +109,7 @@ func TestRepositoriesService_CreateKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Key{Key: String("k"), Title: String("t")} + input := &Key{Key: Ptr("k"), Title: Ptr("t")} mux.HandleFunc("/repos/o/r/keys", func(w http.ResponseWriter, r *http.Request) { v := new(Key) @@ -129,7 +129,7 @@ func TestRepositoriesService_CreateKey(t *testing.T) { t.Errorf("Repositories.GetKey returned error: %v", err) } - want := &Key{ID: Int64(1)} + want := &Key{ID: Ptr(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Repositories.GetKey returned %+v, want %+v", key, want) } diff --git a/github/repos_merging_test.go b/github/repos_merging_test.go index 6b3adaa657d..21467d06442 100644 --- a/github/repos_merging_test.go +++ b/github/repos_merging_test.go @@ -20,9 +20,9 @@ func TestRepositoriesService_Merge(t *testing.T) { client, mux, _ := setup(t) input := &RepositoryMergeRequest{ - Base: String("b"), - Head: String("h"), - CommitMessage: String("c"), + Base: Ptr("b"), + Head: Ptr("h"), + CommitMessage: Ptr("c"), } mux.HandleFunc("/repos/o/r/merges", func(w http.ResponseWriter, r *http.Request) { @@ -43,7 +43,7 @@ func TestRepositoriesService_Merge(t *testing.T) { t.Errorf("Repositories.Merge returned error: %v", err) } - want := &RepositoryCommit{SHA: String("s")} + want := &RepositoryCommit{SHA: Ptr("s")} if !cmp.Equal(commit, want) { t.Errorf("Repositories.Merge returned %+v, want %+v", commit, want) } @@ -68,9 +68,9 @@ func TestRepositoryMergeRequest_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryMergeRequest{}, "{}") u := &RepositoryMergeRequest{ - Base: String("base"), - Head: String("head"), - CommitMessage: String("cm"), + Base: Ptr("base"), + Head: Ptr("head"), + CommitMessage: Ptr("cm"), } want := `{ @@ -87,7 +87,7 @@ func TestRepositoriesService_MergeUpstream(t *testing.T) { client, mux, _ := setup(t) input := &RepoMergeUpstreamRequest{ - Branch: String("b"), + Branch: Ptr("b"), } mux.HandleFunc("/repos/o/r/merge-upstream", func(w http.ResponseWriter, r *http.Request) { @@ -108,7 +108,7 @@ func TestRepositoriesService_MergeUpstream(t *testing.T) { t.Errorf("Repositories.MergeUpstream returned error: %v", err) } - want := &RepoMergeUpstreamResult{MergeType: String("m")} + want := &RepoMergeUpstreamResult{MergeType: Ptr("m")} if !cmp.Equal(result, want) { t.Errorf("Repositories.MergeUpstream returned %+v, want %+v", result, want) } @@ -133,9 +133,9 @@ func TestRepoMergeUpstreamResult_Marshal(t *testing.T) { testJSONMarshal(t, &RepoMergeUpstreamResult{}, "{}") u := &RepoMergeUpstreamResult{ - Message: String("message"), - MergeType: String("merge_type"), - BaseBranch: String("base_branch"), + Message: Ptr("message"), + MergeType: Ptr("merge_type"), + BaseBranch: Ptr("base_branch"), } want := `{ diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index fee52e6656f..3c139d99b2f 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -22,12 +22,12 @@ func TestRepositoriesService_EnablePagesLegacy(t *testing.T) { client, mux, _ := setup(t) input := &Pages{ - BuildType: String("legacy"), + BuildType: Ptr("legacy"), Source: &PagesSource{ - Branch: String("master"), - Path: String("/"), + Branch: Ptr("master"), + Path: Ptr("/"), }, - CNAME: String("www.my-domain.com"), // not passed along. + CNAME: Ptr("www.my-domain.com"), // not passed along. } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -36,7 +36,7 @@ func TestRepositoriesService_EnablePagesLegacy(t *testing.T) { testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) - want := &createPagesRequest{BuildType: String("legacy"), Source: &PagesSource{Branch: String("master"), Path: String("/")}} + want := &createPagesRequest{BuildType: Ptr("legacy"), Source: &PagesSource{Branch: Ptr("master"), Path: Ptr("/")}} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -50,7 +50,7 @@ func TestRepositoriesService_EnablePagesLegacy(t *testing.T) { t.Errorf("Repositories.EnablePages returned error: %v", err) } - want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), BuildType: String("legacy"), Source: &PagesSource{Branch: String("master"), Path: String("/")}} + 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("/")}} if !cmp.Equal(page, want) { t.Errorf("Repositories.EnablePages returned %v, want %v", page, want) @@ -76,8 +76,8 @@ func TestRepositoriesService_EnablePagesWorkflow(t *testing.T) { client, mux, _ := setup(t) input := &Pages{ - BuildType: String("workflow"), - CNAME: String("www.my-domain.com"), // not passed along. + BuildType: Ptr("workflow"), + CNAME: Ptr("www.my-domain.com"), // not passed along. } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -86,7 +86,7 @@ func TestRepositoriesService_EnablePagesWorkflow(t *testing.T) { testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) - want := &createPagesRequest{BuildType: String("workflow")} + want := &createPagesRequest{BuildType: Ptr("workflow")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -100,7 +100,7 @@ func TestRepositoriesService_EnablePagesWorkflow(t *testing.T) { t.Errorf("Repositories.EnablePages returned error: %v", err) } - want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), BuildType: String("workflow")} + want := &Pages{URL: Ptr("u"), Status: Ptr("s"), CNAME: Ptr("c"), Custom404: Ptr(false), HTMLURL: Ptr("h"), BuildType: Ptr("workflow")} if !cmp.Equal(page, want) { t.Errorf("Repositories.EnablePages returned %v, want %v", page, want) @@ -126,9 +126,9 @@ func TestRepositoriesService_UpdatePagesLegacy(t *testing.T) { client, mux, _ := setup(t) input := &PagesUpdate{ - CNAME: String("www.my-domain.com"), - BuildType: String("legacy"), - Source: &PagesSource{Branch: String("gh-pages")}, + CNAME: Ptr("www.my-domain.com"), + BuildType: Ptr("legacy"), + Source: &PagesSource{Branch: Ptr("gh-pages")}, } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -136,7 +136,7 @@ func TestRepositoriesService_UpdatePagesLegacy(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") - want := &PagesUpdate{CNAME: String("www.my-domain.com"), BuildType: String("legacy"), Source: &PagesSource{Branch: String("gh-pages")}} + want := &PagesUpdate{CNAME: Ptr("www.my-domain.com"), BuildType: Ptr("legacy"), Source: &PagesSource{Branch: Ptr("gh-pages")}} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -166,8 +166,8 @@ func TestRepositoriesService_UpdatePagesWorkflow(t *testing.T) { client, mux, _ := setup(t) input := &PagesUpdate{ - CNAME: String("www.my-domain.com"), - BuildType: String("workflow"), + CNAME: Ptr("www.my-domain.com"), + BuildType: Ptr("workflow"), } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -175,7 +175,7 @@ func TestRepositoriesService_UpdatePagesWorkflow(t *testing.T) { assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") - want := &PagesUpdate{CNAME: String("www.my-domain.com"), BuildType: String("workflow")} + want := &PagesUpdate{CNAME: Ptr("www.my-domain.com"), BuildType: Ptr("workflow")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -205,7 +205,7 @@ func TestRepositoriesService_UpdatePages_NullCNAME(t *testing.T) { client, mux, _ := setup(t) input := &PagesUpdate{ - Source: &PagesSource{Branch: String("gh-pages")}, + Source: &PagesSource{Branch: Ptr("gh-pages")}, } mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { @@ -270,7 +270,7 @@ func TestRepositoriesService_GetPagesInfo(t *testing.T) { t.Errorf("Repositories.GetPagesInfo returned error: %v", err) } - want := &Pages{URL: String("u"), Status: String("s"), CNAME: String("c"), Custom404: Bool(false), HTMLURL: String("h"), Public: Bool(true), HTTPSCertificate: &PagesHTTPSCertificate{State: String("approved"), Description: String("Certificate is approved"), Domains: []string{"developer.github.com"}, ExpiresAt: String("2021-05-22")}, HTTPSEnforced: Bool(true)} + 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)} if !cmp.Equal(page, want) { t.Errorf("Repositories.GetPagesInfo returned %+v, want %+v", page, want) } @@ -305,7 +305,7 @@ func TestRepositoriesService_ListPagesBuilds(t *testing.T) { t.Errorf("Repositories.ListPagesBuilds returned error: %v", err) } - want := []*PagesBuild{{URL: String("u"), Status: String("s"), Commit: String("c")}} + want := []*PagesBuild{{URL: Ptr("u"), Status: Ptr("s"), Commit: Ptr("c")}} if !cmp.Equal(pages, want) { t.Errorf("Repositories.ListPagesBuilds returned %+v, want %+v", pages, want) } @@ -359,7 +359,7 @@ func TestRepositoriesService_GetLatestPagesBuild(t *testing.T) { t.Errorf("Repositories.GetLatestPagesBuild returned error: %v", err) } - want := &PagesBuild{URL: String("u"), Status: String("s"), Commit: String("c")} + want := &PagesBuild{URL: Ptr("u"), Status: Ptr("s"), Commit: Ptr("c")} if !cmp.Equal(build, want) { t.Errorf("Repositories.GetLatestPagesBuild returned %+v, want %+v", build, want) } @@ -394,7 +394,7 @@ func TestRepositoriesService_GetPageBuild(t *testing.T) { t.Errorf("Repositories.GetPageBuild returned error: %v", err) } - want := &PagesBuild{URL: String("u"), Status: String("s"), Commit: String("c")} + want := &PagesBuild{URL: Ptr("u"), Status: Ptr("s"), Commit: Ptr("c")} if !cmp.Equal(build, want) { t.Errorf("Repositories.GetPageBuild returned %+v, want %+v", build, want) } @@ -429,7 +429,7 @@ func TestRepositoriesService_RequestPageBuild(t *testing.T) { t.Errorf("Repositories.RequestPageBuild returned error: %v", err) } - want := &PagesBuild{URL: String("u"), Status: String("s")} + want := &PagesBuild{URL: Ptr("u"), Status: Ptr("s")} if !cmp.Equal(build, want) { t.Errorf("Repositories.RequestPageBuild returned %+v, want %+v", build, want) } @@ -466,16 +466,16 @@ func TestRepositoriesService_GetPageHealthCheck(t *testing.T) { want := &PagesHealthCheckResponse{ Domain: &PagesDomain{ - Host: String("example.com"), - URI: String("http://example.com/"), - Nameservers: String("default"), - DNSResolves: Bool(true), + Host: Ptr("example.com"), + URI: Ptr("http://example.com/"), + Nameservers: Ptr("default"), + DNSResolves: Ptr(true), }, AltDomain: &PagesDomain{ - Host: String("www.example.com"), - URI: String("http://www.example.com/"), - Nameservers: String("default"), - DNSResolves: Bool(true), + Host: Ptr("www.example.com"), + URI: Ptr("http://www.example.com/"), + Nameservers: Ptr("default"), + DNSResolves: Ptr(true), }, } if !cmp.Equal(healthCheckResponse, want) { @@ -502,8 +502,8 @@ func TestPagesSource_Marshal(t *testing.T) { testJSONMarshal(t, &PagesSource{}, "{}") u := &PagesSource{ - Branch: String("branch"), - Path: String("path"), + Branch: Ptr("branch"), + Path: Ptr("path"), } want := `{ @@ -519,7 +519,7 @@ func TestPagesError_Marshal(t *testing.T) { testJSONMarshal(t, &PagesError{}, "{}") u := &PagesError{ - Message: String("message"), + Message: Ptr("message"), } want := `{ @@ -534,8 +534,8 @@ func TestPagesUpdate_Marshal(t *testing.T) { testJSONMarshal(t, &PagesUpdate{}, "{}") u := &PagesUpdate{ - CNAME: String("cname"), - Source: &PagesSource{Path: String("src")}, + CNAME: Ptr("cname"), + Source: &PagesSource{Path: Ptr("src")}, } want := `{ @@ -551,14 +551,14 @@ func TestPages_Marshal(t *testing.T) { testJSONMarshal(t, &Pages{}, "{}") u := &Pages{ - URL: String("url"), - Status: String("status"), - CNAME: String("cname"), - Custom404: Bool(false), - HTMLURL: String("hurl"), + URL: Ptr("url"), + Status: Ptr("status"), + CNAME: Ptr("cname"), + Custom404: Ptr(false), + HTMLURL: Ptr("hurl"), Source: &PagesSource{ - Branch: String("branch"), - Path: String("path"), + Branch: Ptr("branch"), + Path: Ptr("path"), }, } @@ -582,14 +582,14 @@ func TestPagesBuild_Marshal(t *testing.T) { testJSONMarshal(t, &PagesBuild{}, "{}") u := &PagesBuild{ - URL: String("url"), - Status: String("status"), + URL: Ptr("url"), + Status: Ptr("status"), Error: &PagesError{ - Message: String("message"), + Message: Ptr("message"), }, - Pusher: &User{ID: Int64(1)}, - Commit: String("commit"), - Duration: Int(1), + Pusher: &User{ID: Ptr(int64(1))}, + Commit: Ptr("commit"), + Duration: Ptr(1), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -618,40 +618,40 @@ func TestPagesHealthCheckResponse_Marshal(t *testing.T) { u := &PagesHealthCheckResponse{ Domain: &PagesDomain{ - Host: String("example.com"), - URI: String("http://example.com/"), - Nameservers: String("default"), - DNSResolves: Bool(true), - IsProxied: Bool(false), - IsCloudflareIP: Bool(false), - IsFastlyIP: Bool(false), - IsOldIPAddress: Bool(false), - IsARecord: Bool(true), - HasCNAMERecord: Bool(false), - HasMXRecordsPresent: Bool(false), - IsValidDomain: Bool(true), - IsApexDomain: Bool(true), - ShouldBeARecord: Bool(true), - IsCNAMEToGithubUserDomain: Bool(false), - IsCNAMEToPagesDotGithubDotCom: Bool(false), - IsCNAMEToFastly: Bool(false), - IsPointedToGithubPagesIP: Bool(true), - IsNonGithubPagesIPPresent: Bool(false), - IsPagesDomain: Bool(false), - IsServedByPages: Bool(true), - IsValid: Bool(true), - Reason: String("some reason"), - RespondsToHTTPS: Bool(true), - EnforcesHTTPS: Bool(true), - HTTPSError: String("some error"), - IsHTTPSEligible: Bool(true), - CAAError: String("some error"), + Host: Ptr("example.com"), + URI: Ptr("http://example.com/"), + Nameservers: Ptr("default"), + DNSResolves: Ptr(true), + IsProxied: Ptr(false), + IsCloudflareIP: Ptr(false), + IsFastlyIP: Ptr(false), + IsOldIPAddress: Ptr(false), + IsARecord: Ptr(true), + HasCNAMERecord: Ptr(false), + HasMXRecordsPresent: Ptr(false), + IsValidDomain: Ptr(true), + IsApexDomain: Ptr(true), + ShouldBeARecord: Ptr(true), + IsCNAMEToGithubUserDomain: Ptr(false), + IsCNAMEToPagesDotGithubDotCom: Ptr(false), + IsCNAMEToFastly: Ptr(false), + IsPointedToGithubPagesIP: Ptr(true), + IsNonGithubPagesIPPresent: Ptr(false), + IsPagesDomain: Ptr(false), + IsServedByPages: Ptr(true), + IsValid: Ptr(true), + Reason: Ptr("some reason"), + RespondsToHTTPS: Ptr(true), + EnforcesHTTPS: Ptr(true), + HTTPSError: Ptr("some error"), + IsHTTPSEligible: Ptr(true), + CAAError: Ptr("some error"), }, AltDomain: &PagesDomain{ - Host: String("www.example.com"), - URI: String("http://www.example.com/"), - Nameservers: String("default"), - DNSResolves: Bool(true), + Host: Ptr("www.example.com"), + URI: Ptr("http://www.example.com/"), + Nameservers: Ptr("default"), + DNSResolves: Ptr(true), }, } @@ -703,8 +703,8 @@ func TestCreatePagesRequest_Marshal(t *testing.T) { u := &createPagesRequest{ Source: &PagesSource{ - Branch: String("branch"), - Path: String("path"), + Branch: Ptr("branch"), + Path: Ptr("path"), }, } diff --git a/github/repos_prereceive_hooks_test.go b/github/repos_prereceive_hooks_test.go index 566b81b4676..c424c47a9fa 100644 --- a/github/repos_prereceive_hooks_test.go +++ b/github/repos_prereceive_hooks_test.go @@ -34,7 +34,7 @@ func TestRepositoriesService_ListPreReceiveHooks(t *testing.T) { t.Errorf("Repositories.ListHooks returned error: %v", err) } - want := []*PreReceiveHook{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*PreReceiveHook{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(hooks, want) { t.Errorf("Repositories.ListPreReceiveHooks returned %+v, want %+v", hooks, want) } @@ -79,7 +79,7 @@ func TestRepositoriesService_GetPreReceiveHook(t *testing.T) { t.Errorf("Repositories.GetPreReceiveHook returned error: %v", err) } - want := &PreReceiveHook{ID: Int64(1)} + want := &PreReceiveHook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.GetPreReceiveHook returned %+v, want %+v", hook, want) } @@ -132,7 +132,7 @@ func TestRepositoriesService_UpdatePreReceiveHook(t *testing.T) { t.Errorf("Repositories.UpdatePreReceiveHook returned error: %v", err) } - want := &PreReceiveHook{ID: Int64(1)} + want := &PreReceiveHook{ID: Ptr(int64(1))} if !cmp.Equal(hook, want) { t.Errorf("Repositories.UpdatePreReceiveHook returned %+v, want %+v", hook, want) } @@ -200,10 +200,10 @@ func TestPreReceiveHook_Marshal(t *testing.T) { testJSONMarshal(t, &PreReceiveHook{}, "{}") u := &PreReceiveHook{ - ID: Int64(1), - Name: String("name"), - Enforcement: String("e"), - ConfigURL: String("curl"), + ID: Ptr(int64(1)), + Name: Ptr("name"), + Enforcement: Ptr("e"), + ConfigURL: Ptr("curl"), } want := `{ diff --git a/github/repos_projects_test.go b/github/repos_projects_test.go index e419bb6b665..e81b93390fd 100644 --- a/github/repos_projects_test.go +++ b/github/repos_projects_test.go @@ -33,7 +33,7 @@ func TestRepositoriesService_ListProjects(t *testing.T) { t.Errorf("Repositories.ListProjects returned error: %v", err) } - want := []*Project{{ID: Int64(1)}} + want := []*Project{{ID: Ptr(int64(1))}} if !cmp.Equal(projects, want) { t.Errorf("Repositories.ListProjects returned %+v, want %+v", projects, want) } @@ -57,7 +57,7 @@ func TestRepositoriesService_CreateProject(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ProjectOptions{Name: String("Project Name"), Body: String("Project body.")} + input := &ProjectOptions{Name: Ptr("Project Name"), Body: Ptr("Project body.")} mux.HandleFunc("/repos/o/r/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -78,7 +78,7 @@ func TestRepositoriesService_CreateProject(t *testing.T) { t.Errorf("Repositories.CreateProject returned error: %v", err) } - want := &Project{ID: Int64(1)} + want := &Project{ID: Ptr(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Repositories.CreateProject returned %+v, want %+v", project, want) } diff --git a/github/repos_releases_test.go b/github/repos_releases_test.go index 1155a7a94cc..7c9b9e96bab 100644 --- a/github/repos_releases_test.go +++ b/github/repos_releases_test.go @@ -34,7 +34,7 @@ func TestRepositoriesService_ListReleases(t *testing.T) { if err != nil { t.Errorf("Repositories.ListReleases returned error: %v", err) } - want := []*RepositoryRelease{{ID: Int64(1)}} + want := []*RepositoryRelease{{ID: Ptr(int64(1))}} if !cmp.Equal(releases, want) { t.Errorf("Repositories.ListReleases returned %+v, want %+v", releases, want) } @@ -110,7 +110,7 @@ func TestRepositoriesService_GetRelease(t *testing.T) { t.Errorf("Repositories.GetRelease returned error: %v\n%v", err, resp.Body) } - want := &RepositoryRelease{ID: Int64(1), Author: &User{Login: String("l")}} + want := &RepositoryRelease{ID: Ptr(int64(1)), Author: &User{Login: Ptr("l")}} if !cmp.Equal(release, want) { t.Errorf("Repositories.GetRelease returned %+v, want %+v", release, want) } @@ -145,7 +145,7 @@ func TestRepositoriesService_GetLatestRelease(t *testing.T) { t.Errorf("Repositories.GetLatestRelease returned error: %v\n%v", err, resp.Body) } - want := &RepositoryRelease{ID: Int64(3)} + want := &RepositoryRelease{ID: Ptr(int64(3))} if !cmp.Equal(release, want) { t.Errorf("Repositories.GetLatestRelease returned %+v, want %+v", release, want) } @@ -180,7 +180,7 @@ func TestRepositoriesService_GetReleaseByTag(t *testing.T) { t.Errorf("Repositories.GetReleaseByTag returned error: %v\n%v", err, resp.Body) } - want := &RepositoryRelease{ID: Int64(13)} + want := &RepositoryRelease{ID: Ptr(int64(13))} if !cmp.Equal(release, want) { t.Errorf("Repositories.GetReleaseByTag returned %+v, want %+v", release, want) } @@ -205,22 +205,22 @@ func TestRepositoriesService_CreateRelease(t *testing.T) { client, mux, _ := setup(t) input := &RepositoryRelease{ - Name: String("v1.0"), - DiscussionCategoryName: String("General"), - GenerateReleaseNotes: Bool(true), + Name: Ptr("v1.0"), + DiscussionCategoryName: Ptr("General"), + GenerateReleaseNotes: Ptr(true), // Fields to be removed: - ID: Int64(2), + ID: Ptr(int64(2)), CreatedAt: &Timestamp{referenceTime}, PublishedAt: &Timestamp{referenceTime}, - URL: String("http://url/"), - HTMLURL: String("http://htmlurl/"), - AssetsURL: String("http://assetsurl/"), - Assets: []*ReleaseAsset{{ID: Int64(5)}}, - UploadURL: String("http://uploadurl/"), - ZipballURL: String("http://zipballurl/"), - TarballURL: String("http://tarballurl/"), - Author: &User{Name: String("octocat")}, - NodeID: String("nodeid"), + URL: Ptr("http://url/"), + HTMLURL: Ptr("http://htmlurl/"), + AssetsURL: Ptr("http://assetsurl/"), + Assets: []*ReleaseAsset{{ID: Ptr(int64(5))}}, + UploadURL: Ptr("http://uploadurl/"), + ZipballURL: Ptr("http://zipballurl/"), + TarballURL: Ptr("http://tarballurl/"), + Author: &User{Name: Ptr("octocat")}, + NodeID: Ptr("nodeid"), } mux.HandleFunc("/repos/o/r/releases", func(w http.ResponseWriter, r *http.Request) { @@ -229,9 +229,9 @@ func TestRepositoriesService_CreateRelease(t *testing.T) { testMethod(t, r, "POST") want := &repositoryReleaseRequest{ - Name: String("v1.0"), - DiscussionCategoryName: String("General"), - GenerateReleaseNotes: Bool(true), + Name: Ptr("v1.0"), + DiscussionCategoryName: Ptr("General"), + GenerateReleaseNotes: Ptr(true), } if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -245,7 +245,7 @@ func TestRepositoriesService_CreateRelease(t *testing.T) { t.Errorf("Repositories.CreateRelease returned error: %v", err) } - want := &RepositoryRelease{ID: Int64(1)} + want := &RepositoryRelease{ID: Ptr(int64(1))} if !cmp.Equal(release, want) { t.Errorf("Repositories.CreateRelease returned %+v, want %+v", release, want) } @@ -270,22 +270,22 @@ func TestRepositoriesService_EditRelease(t *testing.T) { client, mux, _ := setup(t) input := &RepositoryRelease{ - Name: String("n"), - DiscussionCategoryName: String("General"), + Name: Ptr("n"), + DiscussionCategoryName: Ptr("General"), // Fields to be removed: - GenerateReleaseNotes: Bool(true), - ID: Int64(2), + GenerateReleaseNotes: Ptr(true), + ID: Ptr(int64(2)), CreatedAt: &Timestamp{referenceTime}, PublishedAt: &Timestamp{referenceTime}, - URL: String("http://url/"), - HTMLURL: String("http://htmlurl/"), - AssetsURL: String("http://assetsurl/"), - Assets: []*ReleaseAsset{{ID: Int64(5)}}, - UploadURL: String("http://uploadurl/"), - ZipballURL: String("http://zipballurl/"), - TarballURL: String("http://tarballurl/"), - Author: &User{Name: String("octocat")}, - NodeID: String("nodeid"), + URL: Ptr("http://url/"), + HTMLURL: Ptr("http://htmlurl/"), + AssetsURL: Ptr("http://assetsurl/"), + Assets: []*ReleaseAsset{{ID: Ptr(int64(5))}}, + UploadURL: Ptr("http://uploadurl/"), + ZipballURL: Ptr("http://zipballurl/"), + TarballURL: Ptr("http://tarballurl/"), + Author: &User{Name: Ptr("octocat")}, + NodeID: Ptr("nodeid"), } mux.HandleFunc("/repos/o/r/releases/1", func(w http.ResponseWriter, r *http.Request) { @@ -294,8 +294,8 @@ func TestRepositoriesService_EditRelease(t *testing.T) { testMethod(t, r, "PATCH") want := &repositoryReleaseRequest{ - Name: String("n"), - DiscussionCategoryName: String("General"), + Name: Ptr("n"), + DiscussionCategoryName: Ptr("General"), } if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -308,7 +308,7 @@ func TestRepositoriesService_EditRelease(t *testing.T) { if err != nil { t.Errorf("Repositories.EditRelease returned error: %v", err) } - want := &RepositoryRelease{ID: Int64(1)} + want := &RepositoryRelease{ID: Ptr(int64(1))} if !cmp.Equal(release, want) { t.Errorf("Repositories.EditRelease returned = %+v, want %+v", release, want) } @@ -369,7 +369,7 @@ func TestRepositoriesService_ListReleaseAssets(t *testing.T) { if err != nil { t.Errorf("Repositories.ListReleaseAssets returned error: %v", err) } - want := []*ReleaseAsset{{ID: Int64(1)}} + want := []*ReleaseAsset{{ID: Ptr(int64(1))}} if !cmp.Equal(assets, want) { t.Errorf("Repositories.ListReleaseAssets returned %+v, want %+v", assets, want) } @@ -403,7 +403,7 @@ func TestRepositoriesService_GetReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.GetReleaseAsset returned error: %v", err) } - want := &ReleaseAsset{ID: Int64(1)} + want := &ReleaseAsset{ID: Ptr(int64(1))} if !cmp.Equal(asset, want) { t.Errorf("Repositories.GetReleaseAsset returned %+v, want %+v", asset, want) } @@ -572,7 +572,7 @@ func TestRepositoriesService_EditReleaseAsset(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &ReleaseAsset{Name: String("n")} + input := &ReleaseAsset{Name: Ptr("n")} mux.HandleFunc("/repos/o/r/releases/assets/1", func(w http.ResponseWriter, r *http.Request) { v := new(ReleaseAsset) @@ -590,7 +590,7 @@ func TestRepositoriesService_EditReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.EditReleaseAsset returned error: %v", err) } - want := &ReleaseAsset{ID: Int64(1)} + want := &ReleaseAsset{ID: Ptr(int64(1))} if !cmp.Equal(asset, want) { t.Errorf("Repositories.EditReleaseAsset returned = %+v, want %+v", asset, want) } @@ -713,7 +713,7 @@ func TestRepositoriesService_UploadReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.UploadReleaseAssert returned error: %v", err) } - want := &ReleaseAsset{ID: Int64(1)} + want := &ReleaseAsset{ID: Ptr(int64(1))} if !cmp.Equal(asset, want) { t.Errorf("Repositories.UploadReleaseAssert returned %+v, want %+v", asset, want) } @@ -731,14 +731,14 @@ func TestRepositoryReleaseRequest_Marshal(t *testing.T) { testJSONMarshal(t, &repositoryReleaseRequest{}, "{}") u := &repositoryReleaseRequest{ - TagName: String("tn"), - TargetCommitish: String("tc"), - Name: String("name"), - Body: String("body"), - Draft: Bool(false), - Prerelease: Bool(false), - MakeLatest: String("legacy"), - DiscussionCategoryName: String("dcn"), + TagName: Ptr("tn"), + TargetCommitish: Ptr("tc"), + Name: Ptr("name"), + Body: Ptr("body"), + Draft: Ptr(false), + Prerelease: Ptr(false), + MakeLatest: Ptr("legacy"), + DiscussionCategoryName: Ptr("dcn"), } want := `{ @@ -760,19 +760,19 @@ func TestReleaseAsset_Marshal(t *testing.T) { testJSONMarshal(t, &ReleaseAsset{}, "{}") u := &ReleaseAsset{ - ID: Int64(1), - URL: String("url"), - Name: String("name"), - Label: String("label"), - State: String("state"), - ContentType: String("ct"), - Size: Int(1), - DownloadCount: Int(1), + ID: Ptr(int64(1)), + URL: Ptr("url"), + Name: Ptr("name"), + Label: Ptr("label"), + State: Ptr("state"), + ContentType: Ptr("ct"), + Size: Ptr(1), + DownloadCount: Ptr(1), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - BrowserDownloadURL: String("bdu"), - Uploader: &User{ID: Int64(1)}, - NodeID: String("nid"), + BrowserDownloadURL: Ptr("bdu"), + Uploader: &User{ID: Ptr(int64(1))}, + NodeID: Ptr("nid"), } want := `{ @@ -801,26 +801,26 @@ func TestRepositoryRelease_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryRelease{}, "{}") u := &RepositoryRelease{ - TagName: String("tn"), - TargetCommitish: String("tc"), - Name: String("name"), - Body: String("body"), - Draft: Bool(false), - Prerelease: Bool(false), - MakeLatest: String("legacy"), - DiscussionCategoryName: String("dcn"), - ID: Int64(1), + TagName: Ptr("tn"), + TargetCommitish: Ptr("tc"), + Name: Ptr("name"), + Body: Ptr("body"), + Draft: Ptr(false), + Prerelease: Ptr(false), + MakeLatest: Ptr("legacy"), + DiscussionCategoryName: Ptr("dcn"), + ID: Ptr(int64(1)), CreatedAt: &Timestamp{referenceTime}, PublishedAt: &Timestamp{referenceTime}, - URL: String("url"), - HTMLURL: String("hurl"), - AssetsURL: String("aurl"), - Assets: []*ReleaseAsset{{ID: Int64(1)}}, - UploadURL: String("uurl"), - ZipballURL: String("zurl"), - TarballURL: String("turl"), - Author: &User{ID: Int64(1)}, - NodeID: String("nid"), + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + AssetsURL: Ptr("aurl"), + Assets: []*ReleaseAsset{{ID: Ptr(int64(1))}}, + UploadURL: Ptr("uurl"), + ZipballURL: Ptr("zurl"), + TarballURL: Ptr("turl"), + Author: &User{ID: Ptr(int64(1))}, + NodeID: Ptr("nid"), } want := `{ @@ -861,8 +861,8 @@ func TestGenerateNotesOptions_Marshal(t *testing.T) { u := &GenerateNotesOptions{ TagName: "tag_name", - PreviousTagName: String("previous_tag_name"), - TargetCommitish: String("target_commitish"), + PreviousTagName: Ptr("previous_tag_name"), + TargetCommitish: Ptr("target_commitish"), } want := `{ diff --git a/github/repos_rules_test.go b/github/repos_rules_test.go index 3f7f6721dbf..1597b36e110 100644 --- a/github/repos_rules_test.go +++ b/github/repos_rules_test.go @@ -269,11 +269,11 @@ func TestRepositoryRule_UnmarshalJSON(t *testing.T) { "Valid required_status_checks params": { data: `{"type":"required_status_checks","parameters":{"required_status_checks":[{"context":"test","integration_id":1}],"strict_required_status_checks_policy":true,"do_not_enforce_on_create":true}}`, want: NewRequiredStatusChecksRule(&RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: Bool(true), + DoNotEnforceOnCreate: Ptr(true), RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", - IntegrationID: Int64(1), + IntegrationID: Ptr(int64(1)), }, }, StrictRequiredStatusChecksPolicy: true, @@ -300,7 +300,7 @@ func TestRepositoryRule_UnmarshalJSON(t *testing.T) { RequiredWorkflows: []*RuleRequiredWorkflow{ { Path: ".github/workflows/test.yml", - RepositoryID: Int64(1), + RepositoryID: Ptr(int64(1)), }, }, }), @@ -541,18 +541,18 @@ func TestRepositoriesService_GetAllRulesets(t *testing.T) { want := []*Ruleset{ { - ID: Int64(42), + ID: Ptr(int64(42)), Name: "ruleset", - SourceType: String("Repository"), + SourceType: Ptr("Repository"), Source: "o/repo", Enforcement: "enabled", CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, { - ID: Int64(314), + ID: Ptr(int64(314)), Name: "Another ruleset", - SourceType: String("Repository"), + SourceType: Ptr("Repository"), Source: "o/repo", Enforcement: "enabled", CreatedAt: &Timestamp{referenceTime}, @@ -599,9 +599,9 @@ func TestRepositoriesService_CreateRuleset(t *testing.T) { } want := &Ruleset{ - ID: Int64(42), + ID: Ptr(int64(42)), Name: "ruleset", - SourceType: String("Repository"), + SourceType: Ptr("Repository"), Source: "o/repo", Enforcement: "enabled", } @@ -672,11 +672,11 @@ func TestRepositoriesService_CreateRulesetWithPushRules(t *testing.T) { } want := &Ruleset{ - ID: Int64(42), + ID: Ptr(int64(42)), Name: "ruleset", - SourceType: String("Repository"), + SourceType: Ptr("Repository"), Source: "o/repo", - Target: String("push"), + Target: Ptr("push"), Enforcement: "enabled", Rules: []*RepositoryRule{ NewFilePathRestrictionRule(&RuleFileParameters{ @@ -732,9 +732,9 @@ func TestRepositoriesService_GetRuleset(t *testing.T) { } want := &Ruleset{ - ID: Int64(42), + ID: Ptr(int64(42)), Name: "ruleset", - SourceType: String("Organization"), + SourceType: Ptr("Organization"), Source: "o", Enforcement: "enabled", CreatedAt: &Timestamp{referenceTime}, @@ -785,9 +785,9 @@ func TestRepositoriesService_UpdateRulesetNoBypassActor(t *testing.T) { } want := &Ruleset{ - ID: Int64(42), + ID: Ptr(int64(42)), Name: "ruleset", - SourceType: String("Repository"), + SourceType: Ptr("Repository"), Source: "o/repo", Enforcement: "enabled", } @@ -832,9 +832,9 @@ func TestRepositoriesService_UpdateRuleset(t *testing.T) { } want := &Ruleset{ - ID: Int64(42), + ID: Ptr(int64(42)), Name: "ruleset", - SourceType: String("Repository"), + SourceType: Ptr("Repository"), Source: "o/repo", Enforcement: "enabled", } diff --git a/github/repos_stats.go b/github/repos_stats.go index 898693f7864..a6ef9c0da43 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: Int(week[1]), - Deletions: Int(week[2]), + Additions: Ptr(week[1]), + Deletions: Ptr(week[2]), } stats = append(stats, stat) } @@ -231,9 +231,9 @@ func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo str continue } card := &PunchCard{ - Day: Int(result[0]), - Hour: Int(result[1]), - Commits: Int(result[2]), + Day: Ptr(result[0]), + Hour: Ptr(result[1]), + Commits: Ptr(result[2]), } cards = append(cards, card) } diff --git a/github/repos_stats_test.go b/github/repos_stats_test.go index d10cfc5d778..358e2705bab 100644 --- a/github/repos_stats_test.go +++ b/github/repos_stats_test.go @@ -52,16 +52,16 @@ func TestRepositoriesService_ListContributorsStats(t *testing.T) { want := []*ContributorStats{ { Author: &Contributor{ - ID: Int64(1), - NodeID: String("nodeid-1"), + ID: Ptr(int64(1)), + NodeID: Ptr("nodeid-1"), }, - Total: Int(135), + Total: Ptr(135), Weeks: []*WeeklyStats{ { Week: &Timestamp{time.Date(2013, time.May, 05, 00, 00, 00, 0, time.UTC).Local()}, - Additions: Int(6898), - Deletions: Int(77), - Commits: Int(10), + Additions: Ptr(6898), + Deletions: Ptr(77), + Commits: Ptr(10), }, }, }, @@ -113,7 +113,7 @@ func TestRepositoriesService_ListCommitActivity(t *testing.T) { want := []*WeeklyCommitActivity{ { Days: []int{0, 3, 26, 20, 39, 1, 0}, - Total: Int(89), + Total: Ptr(89), Week: &Timestamp{time.Date(2012, time.May, 06, 05, 00, 00, 0, time.UTC).Local()}, }, } @@ -155,8 +155,8 @@ func TestRepositoriesService_ListCodeFrequency(t *testing.T) { want := []*WeeklyStats{{ Week: &Timestamp{time.Date(2011, time.April, 17, 00, 00, 00, 0, time.UTC).Local()}, - Additions: Int(1124), - Deletions: Int(-435), + Additions: Ptr(1124), + Deletions: Ptr(-435), }} if !cmp.Equal(code, want) { @@ -264,9 +264,9 @@ func TestRepositoriesService_ListPunchCard(t *testing.T) { } want := []*PunchCard{ - {Day: Int(0), Hour: Int(0), Commits: Int(5)}, - {Day: Int(0), Hour: Int(1), Commits: Int(43)}, - {Day: Int(0), Hour: Int(2), Commits: Int(21)}, + {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)}, } if !cmp.Equal(card, want) { @@ -351,7 +351,7 @@ func TestWeeklyCommitActivity_Marshal(t *testing.T) { u := &WeeklyCommitActivity{ Days: []int{1}, - Total: Int(1), + Total: Ptr(1), Week: &Timestamp{referenceTime}, } @@ -372,9 +372,9 @@ func TestWeeklyStats_Marshal(t *testing.T) { u := &WeeklyStats{ Week: &Timestamp{referenceTime}, - Additions: Int(1), - Deletions: Int(1), - Commits: Int(1), + Additions: Ptr(1), + Deletions: Ptr(1), + Commits: Ptr(1), } want := `{ @@ -392,14 +392,14 @@ func TestContributorStats_Marshal(t *testing.T) { testJSONMarshal(t, &ContributorStats{}, "{}") u := &ContributorStats{ - Author: &Contributor{ID: Int64(1)}, - Total: Int(1), + Author: &Contributor{ID: Ptr(int64(1))}, + Total: Ptr(1), Weeks: []*WeeklyStats{ { Week: &Timestamp{referenceTime}, - Additions: Int(1), - Deletions: Int(1), - Commits: Int(1), + Additions: Ptr(1), + Deletions: Ptr(1), + Commits: Ptr(1), }, }, } diff --git a/github/repos_statuses_test.go b/github/repos_statuses_test.go index 4f4665d20c0..7cdc1186cc1 100644 --- a/github/repos_statuses_test.go +++ b/github/repos_statuses_test.go @@ -32,7 +32,7 @@ func TestRepositoriesService_ListStatuses(t *testing.T) { t.Errorf("Repositories.ListStatuses returned error: %v", err) } - want := []*RepoStatus{{ID: Int64(1)}} + want := []*RepoStatus{{ID: Ptr(int64(1))}} if !cmp.Equal(statuses, want) { t.Errorf("Repositories.ListStatuses returned %+v, want %+v", statuses, want) } @@ -65,7 +65,7 @@ func TestRepositoriesService_CreateStatus(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &RepoStatus{State: String("s"), TargetURL: String("t"), Description: String("d")} + input := &RepoStatus{State: Ptr("s"), TargetURL: Ptr("t"), Description: Ptr("d")} mux.HandleFunc("/repos/o/r/statuses/r", func(w http.ResponseWriter, r *http.Request) { v := new(RepoStatus) @@ -84,7 +84,7 @@ func TestRepositoriesService_CreateStatus(t *testing.T) { t.Errorf("Repositories.CreateStatus returned error: %v", err) } - want := &RepoStatus{ID: Int64(1)} + want := &RepoStatus{ID: Ptr(int64(1))} if !cmp.Equal(status, want) { t.Errorf("Repositories.CreateStatus returned %+v, want %+v", status, want) } @@ -130,7 +130,7 @@ func TestRepositoriesService_GetCombinedStatus(t *testing.T) { t.Errorf("Repositories.GetCombinedStatus returned error: %v", err) } - want := &CombinedStatus{State: String("success"), Statuses: []*RepoStatus{{ID: Int64(1)}}} + want := &CombinedStatus{State: Ptr("success"), Statuses: []*RepoStatus{{ID: Ptr(int64(1))}}} if !cmp.Equal(status, want) { t.Errorf("Repositories.GetCombinedStatus returned %+v, want %+v", status, want) } @@ -155,15 +155,15 @@ func TestRepoStatus_Marshal(t *testing.T) { testJSONMarshal(t, &RepoStatus{}, "{}") u := &RepoStatus{ - ID: Int64(1), - NodeID: String("nid"), - URL: String("url"), - State: String("state"), - TargetURL: String("turl"), - Description: String("desc"), - Context: String("ctx"), - AvatarURL: String("aurl"), - Creator: &User{ID: Int64(1)}, + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + URL: Ptr("url"), + State: Ptr("state"), + TargetURL: Ptr("turl"), + Description: Ptr("desc"), + Context: Ptr("ctx"), + AvatarURL: Ptr("aurl"), + Creator: &User{ID: Ptr(int64(1))}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -192,27 +192,27 @@ func TestCombinedStatus_Marshal(t *testing.T) { testJSONMarshal(t, &CombinedStatus{}, "{}") u := &CombinedStatus{ - State: String("state"), - Name: String("name"), - SHA: String("sha"), - TotalCount: Int(1), + State: Ptr("state"), + Name: Ptr("name"), + SHA: Ptr("sha"), + TotalCount: Ptr(1), Statuses: []*RepoStatus{ { - ID: Int64(1), - NodeID: String("nid"), - URL: String("url"), - State: String("state"), - TargetURL: String("turl"), - Description: String("desc"), - Context: String("ctx"), - AvatarURL: String("aurl"), - Creator: &User{ID: Int64(1)}, + ID: Ptr(int64(1)), + NodeID: Ptr("nid"), + URL: Ptr("url"), + State: Ptr("state"), + TargetURL: Ptr("turl"), + Description: Ptr("desc"), + Context: Ptr("ctx"), + AvatarURL: Ptr("aurl"), + Creator: &User{ID: Ptr(int64(1))}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, }, - CommitURL: String("curl"), - RepositoryURL: String("rurl"), + CommitURL: Ptr("curl"), + RepositoryURL: Ptr("rurl"), } want := `{ diff --git a/github/repos_tags_test.go b/github/repos_tags_test.go index c37050d69b2..5b05694f76a 100644 --- a/github/repos_tags_test.go +++ b/github/repos_tags_test.go @@ -31,7 +31,7 @@ func TestRepositoriesService_ListTagProtection(t *testing.T) { t.Errorf("Repositories.ListTagProtection returned error: %v", err) } - want := []*TagProtection{{ID: Int64(1), Pattern: String("tag1")}, {ID: Int64(2), Pattern: String("tag2")}} + want := []*TagProtection{{ID: Ptr(int64(1)), Pattern: Ptr("tag1")}, {ID: Ptr(int64(2)), Pattern: Ptr("tag2")}} if !cmp.Equal(tagProtections, want) { t.Errorf("Repositories.ListTagProtection returned %+v, want %+v", tagProtections, want) } @@ -85,7 +85,7 @@ func TestRepositoriesService_CreateTagProtection(t *testing.T) { t.Errorf("Repositories.CreateTagProtection returned error: %v", err) } - want := &TagProtection{ID: Int64(1), Pattern: String("tag*")} + want := &TagProtection{ID: Ptr(int64(1)), Pattern: Ptr("tag*")} if !cmp.Equal(got, want) { t.Errorf("Repositories.CreateTagProtection returned %+v, want %+v", got, want) } @@ -136,8 +136,8 @@ func TestTagProtection_Marshal(t *testing.T) { testJSONMarshal(t, &TagProtection{}, "{}") u := &TagProtection{ - ID: Int64(1), - Pattern: String("pattern"), + ID: Ptr(int64(1)), + Pattern: Ptr("pattern"), } want := `{ diff --git a/github/repos_test.go b/github/repos_test.go index f311488aa3f..90b00573702 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -34,7 +34,7 @@ func TestRepositoriesService_ListByAuthenticatedUser(t *testing.T) { t.Errorf("Repositories.List returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*Repository{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListByAuthenticatedUser returned %+v, want %+v", got, want) } @@ -75,7 +75,7 @@ func TestRepositoriesService_ListByUser(t *testing.T) { t.Errorf("Repositories.List returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(repos, want) { t.Errorf("Repositories.ListByUser returned %+v, want %+v", repos, want) } @@ -116,7 +116,7 @@ func TestRepositoriesService_ListByUser_type(t *testing.T) { t.Errorf("Repositories.ListByUser returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(repos, want) { t.Errorf("Repositories.ListByUser returned %+v, want %+v", repos, want) } @@ -156,7 +156,7 @@ func TestRepositoriesService_ListByOrg(t *testing.T) { t.Errorf("Repositories.ListByOrg returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListByOrg returned %+v, want %+v", got, want) } @@ -204,7 +204,7 @@ func TestRepositoriesService_ListAll(t *testing.T) { t.Errorf("Repositories.ListAll returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListAll returned %+v, want %+v", got, want) } @@ -224,8 +224,8 @@ func TestRepositoriesService_Create_user(t *testing.T) { client, mux, _ := setup(t) input := &Repository{ - Name: String("n"), - Archived: Bool(true), // not passed along. + Name: Ptr("n"), + Archived: Ptr(true), // not passed along. } wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} @@ -235,7 +235,7 @@ func TestRepositoriesService_Create_user(t *testing.T) { testMethod(t, r, "POST") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) - want := &createRepoRequest{Name: String("n")} + want := &createRepoRequest{Name: Ptr("n")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -249,7 +249,7 @@ func TestRepositoriesService_Create_user(t *testing.T) { t.Errorf("Repositories.Create returned error: %v", err) } - want := &Repository{ID: Int64(1)} + want := &Repository{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.Create returned %+v, want %+v", got, want) } @@ -274,8 +274,8 @@ func TestRepositoriesService_Create_org(t *testing.T) { client, mux, _ := setup(t) input := &Repository{ - Name: String("n"), - Archived: Bool(true), // not passed along. + Name: Ptr("n"), + Archived: Ptr(true), // not passed along. } wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} @@ -285,7 +285,7 @@ func TestRepositoriesService_Create_org(t *testing.T) { testMethod(t, r, "POST") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) - want := &createRepoRequest{Name: String("n")} + want := &createRepoRequest{Name: Ptr("n")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -299,7 +299,7 @@ func TestRepositoriesService_Create_org(t *testing.T) { t.Errorf("Repositories.Create returned error: %v", err) } - want := &Repository{ID: Int64(1)} + want := &Repository{ID: Ptr(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Repositories.Create returned %+v, want %+v", repo, want) } @@ -310,7 +310,7 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) { client, mux, _ := setup(t) templateRepoReq := &TemplateRepoRequest{ - Name: String("n"), + Name: Ptr("n"), } mux.HandleFunc("/repos/to/tr/generate", func(w http.ResponseWriter, r *http.Request) { @@ -319,7 +319,7 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) { testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeRepositoryTemplatePreview) - want := &TemplateRepoRequest{Name: String("n")} + want := &TemplateRepoRequest{Name: Ptr("n")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -333,7 +333,7 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) { t.Errorf("Repositories.CreateFromTemplate returned error: %v", err) } - want := &Repository{ID: Int64(1), Name: String("n")} + want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n")} if !cmp.Equal(got, want) { t.Errorf("Repositories.CreateFromTemplate returned %+v, want %+v", got, want) } @@ -370,7 +370,7 @@ func TestRepositoriesService_Get(t *testing.T) { t.Errorf("Repositories.Get returned error: %v", err) } - want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}, SecurityAndAnalysis: &SecurityAndAnalysis{AdvancedSecurity: &AdvancedSecurity{Status: String("enabled")}, SecretScanning: &SecretScanning{String("enabled")}, SecretScanningPushProtection: &SecretScanningPushProtection{String("enabled")}, DependabotSecurityUpdates: &DependabotSecurityUpdates{String("enabled")}, SecretScanningValidityChecks: &SecretScanningValidityChecks{String("enabled")}}} + 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")}}} if !cmp.Equal(got, want) { t.Errorf("Repositories.Get returned %+v, want %+v", got, want) } @@ -414,10 +414,10 @@ func TestRepositoriesService_GetCodeOfConduct(t *testing.T) { } want := &CodeOfConduct{ - Key: String("key"), - Name: String("name"), - URL: String("url"), - Body: String("body"), + Key: Ptr("key"), + Name: Ptr("name"), + URL: Ptr("url"), + Body: Ptr("body"), } if !cmp.Equal(got, want) { @@ -454,7 +454,7 @@ func TestRepositoriesService_GetByID(t *testing.T) { t.Fatalf("Repositories.GetByID returned error: %v", err) } - want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} + want := &Repository{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), Owner: &User{Login: Ptr("l")}, License: &License{Key: Ptr("mit")}} if !cmp.Equal(got, want) { t.Errorf("Repositories.GetByID returned %+v, want %+v", got, want) } @@ -495,7 +495,7 @@ func TestRepositoriesService_Edit(t *testing.T) { t.Errorf("Repositories.Edit returned error: %v", err) } - want := &Repository{ID: Int64(1)} + want := &Repository{ID: Ptr(int64(1))} if !cmp.Equal(got, want) { t.Errorf("Repositories.Edit returned %+v, want %+v", got, want) } @@ -680,8 +680,8 @@ func TestRepositoriesService_GetAutomatedSecurityFixes(t *testing.T) { } want := &AutomatedSecurityFixes{ - Enabled: Bool(true), - Paused: Bool(false), + Enabled: Ptr(true), + Paused: Ptr(false), } if !cmp.Equal(fixes, want) { t.Errorf("Repositories.GetAutomatedSecurityFixes returned #{fixes}, want #{want}") @@ -737,7 +737,7 @@ func TestRepositoriesService_ListContributors(t *testing.T) { t.Errorf("Repositories.ListContributors returned error: %v", err) } - want := []*Contributor{{Contributions: Int(42)}} + want := []*Contributor{{Contributions: Ptr(42)}} if !cmp.Equal(contributors, want) { t.Errorf("Repositories.ListContributors returned %+v, want %+v", contributors, want) } @@ -809,7 +809,7 @@ func TestRepositoriesService_ListTeams(t *testing.T) { t.Errorf("Repositories.ListTeams returned error: %v", err) } - want := []*Team{{ID: Int64(1)}} + want := []*Team{{ID: Ptr(int64(1))}} if !cmp.Equal(teams, want) { t.Errorf("Repositories.ListTeams returned %+v, want %+v", teams, want) } @@ -848,13 +848,13 @@ func TestRepositoriesService_ListTags(t *testing.T) { want := []*RepositoryTag{ { - Name: String("n"), + Name: Ptr("n"), Commit: &Commit{ - SHA: String("s"), - URL: String("u"), + SHA: Ptr("s"), + URL: Ptr("u"), }, - ZipballURL: String("z"), - TarballURL: String("t"), + ZipballURL: Ptr("z"), + TarballURL: Ptr("t"), }, } if !cmp.Equal(tags, want) { @@ -896,7 +896,7 @@ func TestRepositoriesService_ListBranches(t *testing.T) { t.Errorf("Repositories.ListBranches returned error: %v", err) } - want := []*Branch{{Name: String("master"), Commit: &RepositoryCommit{SHA: String("a57781"), URL: String("https://api.github.com/repos/o/r/commits/a57781")}}} + want := []*Branch{{Name: Ptr("master"), Commit: &RepositoryCommit{SHA: Ptr("a57781"), URL: Ptr("https://api.github.com/repos/o/r/commits/a57781")}}} if !cmp.Equal(branches, want) { t.Errorf("Repositories.ListBranches returned %+v, want %+v", branches, want) } @@ -941,14 +941,14 @@ func TestRepositoriesService_GetBranch(t *testing.T) { } want := &Branch{ - Name: String("n"), + Name: Ptr("n"), Commit: &RepositoryCommit{ - SHA: String("s"), + SHA: Ptr("s"), Commit: &Commit{ - Message: String("m"), + Message: Ptr("m"), }, }, - Protected: Bool(true), + Protected: Ptr(true), Protection: &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Contexts: &[]string{"c"}, @@ -1020,14 +1020,14 @@ func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t } want := &Branch{ - Name: String("n"), + Name: Ptr("n"), Commit: &RepositoryCommit{ - SHA: String("s"), + SHA: Ptr("s"), Commit: &Commit{ - Message: String("m"), + Message: Ptr("m"), }, }, - Protected: Bool(true), + Protected: Ptr(true), Protection: &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Contexts: &[]string{"c"}, @@ -1119,7 +1119,7 @@ func TestRepositoriesService_RenameBranch(t *testing.T) { t.Errorf("Repositories.RenameBranch returned error: %v", err) } - want := &Branch{Name: String("nn"), Protected: Bool(true)} + want := &Branch{Name: Ptr("nn"), Protected: Ptr(true)} if !cmp.Equal(got, want) { t.Errorf("Repositories.RenameBranch returned %+v, want %+v", got, want) } @@ -1237,13 +1237,13 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(3)}, + {Login: Ptr("u"), ID: Ptr(int64(3))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(4)}, + {Slug: Ptr("t"), ID: Ptr(int64(4))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(5)}, + {Slug: Ptr("a"), ID: Ptr(int64(5))}, }, }, RequireCodeOwnerReviews: true, @@ -1251,31 +1251,31 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { RequireLastPushApproval: false, }, EnforceAdmins: &AdminEnforcement{ - URL: String(test.enforceAdminsURLPath), + URL: Ptr(test.enforceAdminsURLPath), Enabled: true, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, RequiredConversationResolution: &RequiredConversationResolution{ Enabled: true, }, BlockCreations: &BlockCreations{ - Enabled: Bool(false), + Enabled: Ptr(false), }, LockBranch: &LockBranch{ - Enabled: Bool(false), + Enabled: Ptr(false), }, AllowForkSyncing: &AllowForkSyncing{ - Enabled: Bool(false), + Enabled: Ptr(false), }, } if !cmp.Equal(protection, want) { @@ -1367,15 +1367,15 @@ func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *test RequiredApprovingReviewCount: 1, }, EnforceAdmins: &AdminEnforcement{ - URL: String(test.enforceAdminsURLPath), + URL: Ptr(test.enforceAdminsURLPath), Enabled: true, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, }, } @@ -1464,9 +1464,9 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { Teams: []string{"t"}, Apps: []string{"a"}, }, - BlockCreations: Bool(true), - LockBranch: Bool(true), - AllowForkSyncing: Bool(true), + BlockCreations: Ptr(true), + LockBranch: Ptr(true), + AllowForkSyncing: Ptr(true), } mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { @@ -1551,47 +1551,47 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, + {Login: Ptr("uu"), ID: Ptr(int64(3))}, }, Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, + {Slug: Ptr("tt"), ID: Ptr(int64(4))}, }, Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, + {Slug: Ptr("aa"), ID: Ptr(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, + {Login: Ptr("uuu"), ID: Ptr(int64(10))}, }, Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, + {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, }, Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, + {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, BlockCreations: &BlockCreations{ - Enabled: Bool(true), + Enabled: Ptr(true), }, LockBranch: &LockBranch{ - Enabled: Bool(true), + Enabled: Ptr(true), }, AllowForkSyncing: &AllowForkSyncing{ - Enabled: Bool(true), + Enabled: Ptr(true), }, } if !cmp.Equal(protection, want) { @@ -1654,9 +1654,9 @@ func TestRepositoriesService_UpdateBranchProtection_EmptyContexts(t *testing.T) Teams: []string{"t"}, Apps: []string{"a"}, }, - BlockCreations: Bool(true), - LockBranch: Bool(true), - AllowForkSyncing: Bool(true), + BlockCreations: Ptr(true), + LockBranch: Ptr(true), + AllowForkSyncing: Ptr(true), } mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { @@ -1731,47 +1731,47 @@ func TestRepositoriesService_UpdateBranchProtection_EmptyContexts(t *testing.T) DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, + {Login: Ptr("uu"), ID: Ptr(int64(3))}, }, Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, + {Slug: Ptr("tt"), ID: Ptr(int64(4))}, }, Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, + {Slug: Ptr("aa"), ID: Ptr(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, + {Login: Ptr("uuu"), ID: Ptr(int64(10))}, }, Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, + {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, }, Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, + {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, BlockCreations: &BlockCreations{ - Enabled: Bool(true), + Enabled: Ptr(true), }, LockBranch: &LockBranch{ - Enabled: Bool(true), + Enabled: Ptr(true), }, AllowForkSyncing: &AllowForkSyncing{ - Enabled: Bool(true), + Enabled: Ptr(true), }, } if !cmp.Equal(protection, want) { @@ -1913,37 +1913,37 @@ func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, + {Login: Ptr("uu"), ID: Ptr(int64(3))}, }, Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, + {Slug: Ptr("tt"), ID: Ptr(int64(4))}, }, Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, + {Slug: Ptr("aa"), ID: Ptr(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, + {Login: Ptr("uuu"), ID: Ptr(int64(10))}, }, Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, + {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, }, Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, + {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, } @@ -2058,37 +2058,37 @@ func TestRepositoriesService_UpdateBranchProtection_EmptyChecks(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, + {Login: Ptr("uu"), ID: Ptr(int64(3))}, }, Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, + {Slug: Ptr("tt"), ID: Ptr(int64(4))}, }, Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, + {Slug: Ptr("aa"), ID: Ptr(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, + {Login: Ptr("uuu"), ID: Ptr(int64(10))}, }, Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, + {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, }, Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, + {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, } @@ -2202,37 +2202,37 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, + {Login: Ptr("uu"), ID: Ptr(int64(3))}, }, Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, + {Slug: Ptr("tt"), ID: Ptr(int64(4))}, }, Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, + {Slug: Ptr("aa"), ID: Ptr(int64(5))}, }, }, RequireCodeOwnerReviews: true, BypassPullRequestAllowances: &BypassPullRequestAllowances{ Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, + {Login: Ptr("uuu"), ID: Ptr(int64(10))}, }, Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, + {Slug: Ptr("ttt"), ID: Ptr(int64(20))}, }, Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, + {Slug: Ptr("aaa"), ID: Ptr(int64(30))}, }, }, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, } @@ -2261,7 +2261,7 @@ func TestRepositoriesService_UpdateBranchProtection_RequireLastPushApproval(t *t input := &ProtectionRequest{ RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ - RequireLastPushApproval: Bool(true), + RequireLastPushApproval: Ptr(true), }, } @@ -2364,14 +2364,14 @@ func TestRepositoriesService_License(t *testing.T) { } want := &RepositoryLicense{ - Name: String("LICENSE"), - Path: String("LICENSE"), + Name: Ptr("LICENSE"), + Path: Ptr("LICENSE"), License: &License{ - Name: String("MIT License"), - Key: String("mit"), - SPDXID: String("MIT"), - URL: String("https://api.github.com/licenses/mit"), - Featured: Bool(true), + Name: Ptr("MIT License"), + Key: Ptr("mit"), + SPDXID: Ptr("MIT"), + URL: Ptr("https://api.github.com/licenses/mit"), + Featured: Ptr(true), }, } @@ -2531,7 +2531,7 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Contexts(t *testing.T) { client, mux, _ := setup(t) input := &RequiredStatusChecksRequest{ - Strict: Bool(true), + Strict: Ptr(true), Contexts: []string{"continuous-integration"}, } @@ -2611,7 +2611,7 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Checks(t *testing.T) { appID := int64(123) noAppID := int64(-1) input := &RequiredStatusChecksRequest{ - Strict: Bool(true), + Strict: Ptr(true), Checks: []*RequiredStatusCheck{ { Context: "continuous-integration", @@ -2857,13 +2857,13 @@ func TestRepositoriesService_GetPullRequestReviewEnforcement(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, RequireCodeOwnerReviews: true, @@ -2947,13 +2947,13 @@ func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: &DismissalRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int64(1)}, + {Login: Ptr("u"), ID: Ptr(int64(1))}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, + {Slug: Ptr("t"), ID: Ptr(int64(2))}, }, Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, + {Slug: Ptr("a"), ID: Ptr(int64(3))}, }, }, RequireCodeOwnerReviews: true, @@ -3105,7 +3105,7 @@ func TestRepositoriesService_GetAdminEnforcement(t *testing.T) { } want := &AdminEnforcement{ - URL: String("/repos/o/r/branches/b/protection/enforce_admins"), + URL: Ptr("/repos/o/r/branches/b/protection/enforce_admins"), Enabled: true, } @@ -3158,7 +3158,7 @@ func TestRepositoriesService_AddAdminEnforcement(t *testing.T) { } want := &AdminEnforcement{ - URL: String("/repos/o/r/branches/b/protection/enforce_admins"), + URL: Ptr("/repos/o/r/branches/b/protection/enforce_admins"), Enabled: true, } if !cmp.Equal(enforcement, want) { @@ -3251,8 +3251,8 @@ func TestRepositoriesService_GetSignaturesProtectedBranch(t *testing.T) { } want := &SignaturesProtectedBranch{ - URL: String("/repos/o/r/branches/b/protection/required_signatures"), - Enabled: Bool(false), + URL: Ptr("/repos/o/r/branches/b/protection/required_signatures"), + Enabled: Ptr(false), } if !cmp.Equal(signature, want) { @@ -3305,8 +3305,8 @@ func TestRepositoriesService_RequireSignaturesOnProtectedBranch(t *testing.T) { } want := &SignaturesProtectedBranch{ - URL: String("/repos/o/r/branches/b/protection/required_signatures"), - Enabled: Bool(true), + URL: Ptr("/repos/o/r/branches/b/protection/required_signatures"), + Enabled: Ptr(true), } if !cmp.Equal(signature, want) { @@ -3405,7 +3405,7 @@ func TestPullRequestReviewsEnforcementRequest_MarshalJSON_nilDismissalRestirctio Teams: &[]string{}, Apps: &[]string{}, }, - RequireLastPushApproval: Bool(true), + RequireLastPushApproval: Ptr(true), } got, err = json.Marshal(req) @@ -3631,7 +3631,7 @@ func TestRepositoriesService_ReplaceAppRestrictions(t *testing.T) { t.Errorf("Repositories.ReplaceAppRestrictions returned error: %v", err) } want := []*App{ - {Name: String("octocat")}, + {Name: Ptr("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.ReplaceAppRestrictions returned %+v, want %+v", got, want) @@ -3683,7 +3683,7 @@ func TestRepositoriesService_AddAppRestrictions(t *testing.T) { t.Errorf("Repositories.AddAppRestrictions returned error: %v", err) } want := []*App{ - {Name: String("octocat")}, + {Name: Ptr("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.AddAppRestrictions returned %+v, want %+v", got, want) @@ -3826,7 +3826,7 @@ func TestRepositoriesService_ReplaceTeamRestrictions(t *testing.T) { t.Errorf("Repositories.ReplaceTeamRestrictions returned error: %v", err) } want := []*Team{ - {Name: String("octocat")}, + {Name: Ptr("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.ReplaceTeamRestrictions returned %+v, want %+v", got, want) @@ -3878,7 +3878,7 @@ func TestRepositoriesService_AddTeamRestrictions(t *testing.T) { t.Errorf("Repositories.AddTeamRestrictions returned error: %v", err) } want := []*Team{ - {Name: String("octocat")}, + {Name: Ptr("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.AddTeamRestrictions returned %+v, want %+v", got, want) @@ -4021,7 +4021,7 @@ func TestRepositoriesService_ReplaceUserRestrictions(t *testing.T) { t.Errorf("Repositories.ReplaceUserRestrictions returned error: %v", err) } want := []*User{ - {Name: String("octocat")}, + {Name: Ptr("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.ReplaceUserRestrictions returned %+v, want %+v", got, want) @@ -4073,7 +4073,7 @@ func TestRepositoriesService_AddUserRestrictions(t *testing.T) { t.Errorf("Repositories.AddUserRestrictions returned error: %v", err) } want := []*User{ - {Name: String("octocat")}, + {Name: Ptr("octocat")}, } if !cmp.Equal(got, want) { t.Errorf("Repositories.AddUserRestrictions returned %+v, want %+v", got, want) @@ -4148,7 +4148,7 @@ func TestRepositoriesService_Transfer(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TransferRequest{NewOwner: "a", NewName: String("b"), TeamID: []int64{123}} + input := TransferRequest{NewOwner: "a", NewName: Ptr("b"), TeamID: []int64{123}} mux.HandleFunc("/repos/o/r/transfer", func(w http.ResponseWriter, r *http.Request) { var v TransferRequest @@ -4168,7 +4168,7 @@ func TestRepositoriesService_Transfer(t *testing.T) { t.Errorf("Repositories.Transfer returned error: %v", err) } - want := &Repository{Owner: &User{Login: String("a")}} + want := &Repository{Owner: &User{Login: Ptr("a")}} if !cmp.Equal(got, want) { t.Errorf("Repositories.Transfer returned %+v, want %+v", got, want) } @@ -4245,7 +4245,7 @@ func TestRepositoriesService_Dispatch(t *testing.T) { t.Errorf("Repositories.Dispatch returned error: %v", err) } - want := &Repository{Owner: &User{Login: String("a")}} + want := &Repository{Owner: &User{Login: Ptr("a")}} if !cmp.Equal(got, want) { t.Errorf("Repositories.Dispatch returned %+v, want %+v", got, want) } @@ -4271,7 +4271,7 @@ func TestAdvancedSecurity_Marshal(t *testing.T) { testJSONMarshal(t, &AdvancedSecurity{}, "{}") u := &AdvancedSecurity{ - Status: String("status"), + Status: Ptr("status"), } want := `{ @@ -4286,7 +4286,7 @@ func TestAuthorizedActorsOnly_Marshal(t *testing.T) { testJSONMarshal(t, &AuthorizedActorsOnly{}, "{}") u := &AuthorizedActorsOnly{ - From: Bool(true), + From: Ptr(true), } want := `{ @@ -4322,7 +4322,7 @@ func TestTransferRequest_Marshal(t *testing.T) { u := &TransferRequest{ NewOwner: "testOwner", - NewName: String("testName"), + NewName: Ptr("testName"), TeamID: []int64{1, 2}, } @@ -4340,8 +4340,8 @@ func TestSignaturesProtectedBranch_Marshal(t *testing.T) { testJSONMarshal(t, &SignaturesProtectedBranch{}, "{}") u := &SignaturesProtectedBranch{ - URL: String("https://www.testURL.in"), - Enabled: Bool(false), + URL: Ptr("https://www.testURL.in"), + Enabled: Ptr(false), } want := `{ @@ -4352,8 +4352,8 @@ func TestSignaturesProtectedBranch_Marshal(t *testing.T) { testJSONMarshal(t, u, want) u2 := &SignaturesProtectedBranch{ - URL: String("testURL"), - Enabled: Bool(true), + URL: Ptr("testURL"), + Enabled: Ptr(true), } want2 := `{ @@ -4388,7 +4388,7 @@ func TestAdminEnforcement_Marshal(t *testing.T) { testJSONMarshal(t, &AdminEnforcement{}, "{}") u := &AdminEnforcement{ - URL: String("https://www.test-url.in"), + URL: Ptr("https://www.test-url.in"), Enabled: false, } @@ -4410,8 +4410,8 @@ func TestPullRequestReviewsEnforcementUpdate_Marshal(t *testing.T) { Teams: []string{"team1", "team2"}, Apps: []string{"app1", "app2"}, }, - DismissStaleReviews: Bool(false), - RequireCodeOwnerReviews: Bool(true), + DismissStaleReviews: Ptr(false), + RequireCodeOwnerReviews: Ptr(true), RequiredApprovingReviewCount: 2, } @@ -4435,7 +4435,7 @@ func TestRequiredStatusCheck_Marshal(t *testing.T) { u := &RequiredStatusCheck{ Context: "ctx", - AppID: Int64(1), + AppID: Ptr(int64(1)), } want := `{ @@ -4451,13 +4451,13 @@ func TestRepositoryTag_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoryTag{}, "{}") u := &RepositoryTag{ - Name: String("v0.1"), + Name: Ptr("v0.1"), Commit: &Commit{ - SHA: String("sha"), - URL: String("url"), + SHA: Ptr("sha"), + URL: Ptr("url"), }, - ZipballURL: String("zball"), - TarballURL: String("tball"), + ZipballURL: Ptr("zball"), + TarballURL: Ptr("tball"), } want := `{ @@ -4577,7 +4577,7 @@ func TestRepository_UnmarshalJSON(t *testing.T) { }, "Partial project": { data: []byte(`{"id":10270722,"name":"go-github","private":false,"owner":{"login":"google"},"created_at":"2013-05-24T16:42:58Z","license":{},"topics":["github"],"permissions":{"pull":true},"custom_properties":{},"organization":{"login":"google"}}`), - wantRepository: Repository{ID: Int64(10270722), Name: String("go-github"), Private: Bool(false), Owner: &User{Login: String("google")}, CreatedAt: &Timestamp{time.Date(2013, 5, 24, 16, 42, 58, 0, time.UTC)}, License: &License{}, Topics: []string{"github"}, Permissions: map[string]bool{"pull": true}, CustomProperties: map[string]interface{}{}, Organization: &Organization{Login: String("google")}}, + wantRepository: Repository{ID: Ptr(int64(10270722)), Name: Ptr("go-github"), Private: Ptr(false), Owner: &User{Login: Ptr("google")}, CreatedAt: &Timestamp{time.Date(2013, 5, 24, 16, 42, 58, 0, time.UTC)}, License: &License{}, Topics: []string{"github"}, Permissions: map[string]bool{"pull": true}, CustomProperties: map[string]interface{}{}, Organization: &Organization{Login: Ptr("google")}}, wantErr: false, }, "With custom properties": { diff --git a/github/repos_traffic_test.go b/github/repos_traffic_test.go index 8f9cdba2364..e1374d8c461 100644 --- a/github/repos_traffic_test.go +++ b/github/repos_traffic_test.go @@ -34,9 +34,9 @@ func TestRepositoriesService_ListTrafficReferrers(t *testing.T) { } want := []*TrafficReferrer{{ - Referrer: String("Google"), - Count: Int(4), - Uniques: Int(3), + Referrer: Ptr("Google"), + Count: Ptr(4), + Uniques: Ptr(3), }} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListTrafficReferrers returned %+v, want %+v", got, want) @@ -77,10 +77,10 @@ func TestRepositoriesService_ListTrafficPaths(t *testing.T) { } want := []*TrafficPath{{ - Path: String("/github/hubot"), - Title: String("github/hubot: A customizable life embetterment robot."), - Count: Int(3542), - Uniques: Int(2225), + Path: Ptr("/github/hubot"), + Title: Ptr("github/hubot: A customizable life embetterment robot."), + Count: Ptr(3542), + Uniques: Ptr(2225), }} if !cmp.Equal(got, want) { t.Errorf("Repositories.ListTrafficPaths returned %+v, want %+v", got, want) @@ -125,11 +125,11 @@ func TestRepositoriesService_ListTrafficViews(t *testing.T) { want := &TrafficViews{ Views: []*TrafficData{{ Timestamp: &Timestamp{time.Date(2016, time.May, 31, 16, 0, 0, 0, time.UTC)}, - Count: Int(7), - Uniques: Int(6), + Count: Ptr(7), + Uniques: Ptr(6), }}, - Count: Int(7), - Uniques: Int(6), + Count: Ptr(7), + Uniques: Ptr(6), } if !cmp.Equal(got, want) { @@ -175,11 +175,11 @@ func TestRepositoriesService_ListTrafficClones(t *testing.T) { want := &TrafficClones{ Clones: []*TrafficData{{ Timestamp: &Timestamp{time.Date(2016, time.May, 31, 16, 0, 0, 0, time.UTC)}, - Count: Int(7), - Uniques: Int(6), + Count: Ptr(7), + Uniques: Ptr(6), }}, - Count: Int(7), - Uniques: Int(6), + Count: Ptr(7), + Uniques: Ptr(6), } if !cmp.Equal(got, want) { @@ -206,9 +206,9 @@ func TestTrafficReferrer_Marshal(t *testing.T) { testJSONMarshal(t, &TrafficReferrer{}, "{}") u := &TrafficReferrer{ - Referrer: String("referrer"), - Count: Int(0), - Uniques: Int(0), + Referrer: Ptr("referrer"), + Count: Ptr(0), + Uniques: Ptr(0), } want := `{ @@ -227,11 +227,11 @@ func TestTrafficViews_Marshal(t *testing.T) { u := &TrafficViews{ Views: []*TrafficData{{ Timestamp: &Timestamp{time.Date(2016, time.May, 31, 16, 0, 0, 0, time.UTC)}, - Count: Int(7), - Uniques: Int(6), + Count: Ptr(7), + Uniques: Ptr(6), }}, - Count: Int(0), - Uniques: Int(0), + Count: Ptr(0), + Uniques: Ptr(0), } want := `{ @@ -254,11 +254,11 @@ func TestTrafficClones_Marshal(t *testing.T) { u := &TrafficClones{ Clones: []*TrafficData{{ Timestamp: &Timestamp{time.Date(2021, time.October, 29, 16, 0, 0, 0, time.UTC)}, - Count: Int(1), - Uniques: Int(1), + Count: Ptr(1), + Uniques: Ptr(1), }}, - Count: Int(0), - Uniques: Int(0), + Count: Ptr(0), + Uniques: Ptr(0), } want := `{ @@ -279,10 +279,10 @@ func TestTrafficPath_Marshal(t *testing.T) { testJSONMarshal(t, &TrafficPath{}, "{}") u := &TrafficPath{ - Path: String("test/path"), - Title: String("test"), - Count: Int(2), - Uniques: Int(3), + Path: Ptr("test/path"), + Title: Ptr("test"), + Count: Ptr(2), + Uniques: Ptr(3), } want := `{ @@ -301,8 +301,8 @@ func TestTrafficData_Marshal(t *testing.T) { u := &TrafficData{ Timestamp: &Timestamp{time.Date(2016, time.May, 31, 16, 0, 0, 0, time.UTC)}, - Count: Int(7), - Uniques: Int(6), + Count: Ptr(7), + Uniques: Ptr(6), } want := `{ diff --git a/github/scim_test.go b/github/scim_test.go index 3777135c9a6..a6c806cb574 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -71,35 +71,35 @@ func TestSCIMService_ListSCIMProvisionedIdentities(t *testing.T) { date := Timestamp{time.Date(2018, time.February, 13, 15, 5, 24, 0, time.UTC)} want := SCIMProvisionedIdentities{ Schemas: []string{"urn:ietf:params:scim:api:messages:2.0:ListResponse"}, - TotalResults: Int(1), - ItemsPerPage: Int(1), - StartIndex: Int(1), + TotalResults: Ptr(1), + ItemsPerPage: Ptr(1), + StartIndex: Ptr(1), Resources: []*SCIMUserAttributes{ { - ID: String("5fc0c238-1112-11e8-8e45-920c87bdbd75"), + ID: Ptr("5fc0c238-1112-11e8-8e45-920c87bdbd75"), Meta: &SCIMMeta{ - ResourceType: String("User"), + ResourceType: Ptr("User"), Created: &date, LastModified: &date, - Location: String("https://api.github.com/scim/v2/organizations/octo-org/Users/5fc0c238-1112-11e8-8e45-920c87bdbd75"), + Location: Ptr("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: String("Mona Octocat"), + Formatted: Ptr("Mona Octocat"), }, - DisplayName: String("Mona Octocat"), + DisplayName: Ptr("Mona Octocat"), Emails: []*SCIMUserEmail{ { Value: "octocat@github.com", - Primary: Bool(true), + Primary: Ptr(true), }, }, Schemas: []string{"urn:ietf:params:scim:schemas:core:2.0:User"}, - ExternalID: String("00u1dhhb1fkIGP7RL1d8"), + ExternalID: Ptr("00u1dhhb1fkIGP7RL1d8"), Groups: nil, - Active: Bool(true), + Active: Ptr(true), }, }, } @@ -150,7 +150,7 @@ func TestSCIMService_ProvisionAndInviteSCIMUser(t *testing.T) { } want := &SCIMUserAttributes{ - ID: String("1234567890"), + ID: Ptr("1234567890"), UserName: "userName", } if !cmp.Equal(user, want) { @@ -219,33 +219,33 @@ func TestSCIMService_GetSCIMProvisioningInfoForUser(t *testing.T) { date := Timestamp{time.Date(2017, time.March, 9, 16, 11, 13, 0, time.UTC)} want := SCIMUserAttributes{ - ID: String("edefdfedf-050c-11e7-8d32"), + ID: Ptr("edefdfedf-050c-11e7-8d32"), Meta: &SCIMMeta{ - ResourceType: String("User"), + ResourceType: Ptr("User"), Created: &date, LastModified: &date, - Location: String("https://api.github.com/scim/v2/organizations/octo-org/Users/edefdfedf-050c-11e7-8d32"), + Location: Ptr("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: String("Mona Octocat"), + Formatted: Ptr("Mona Octocat"), }, - DisplayName: String("Mona Octocat"), + DisplayName: Ptr("Mona Octocat"), Emails: []*SCIMUserEmail{ { Value: "mona.octocat@okta.example.com", - Primary: Bool(true), + Primary: Ptr(true), }, { Value: "mona@octocat.github.com", }, }, Schemas: []string{"urn:ietf:params:scim:schemas:core:2.0:User"}, - ExternalID: String("a7d0f98382"), + ExternalID: Ptr("a7d0f98382"), Groups: nil, - Active: Bool(true), + Active: Ptr(true), } if !cmp.Equal(user, &want) { @@ -367,20 +367,20 @@ func TestSCIMUserAttributes_Marshal(t *testing.T) { Name: SCIMUserName{ GivenName: "Name1", FamilyName: "Fname", - Formatted: String("formatted name"), + Formatted: Ptr("formatted name"), }, - DisplayName: String("Name"), + DisplayName: Ptr("Name"), Emails: []*SCIMUserEmail{ { Value: "value", - Primary: Bool(false), - Type: String("type"), + Primary: Ptr(false), + Type: Ptr("type"), }, }, Schemas: []string{"schema1"}, - ExternalID: String("id"), + ExternalID: Ptr("id"), Groups: []string{"group1"}, - Active: Bool(true), + Active: Ptr(true), } want := `{ @@ -411,7 +411,7 @@ func TestUpdateAttributeForSCIMUserOperations_Marshal(t *testing.T) { u := &UpdateAttributeForSCIMUserOperations{ Op: "TestOp", - Path: String("path"), + Path: Ptr("path"), } want := `{ @@ -430,7 +430,7 @@ func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) { Schemas: []string{"test", "schema"}, Operations: UpdateAttributeForSCIMUserOperations{ Op: "TestOp", - Path: String("path"), + Path: Ptr("path"), }, } @@ -461,8 +461,8 @@ func TestListSCIMProvisionedIdentitiesOptions_addOptions(t *testing.T) { t, url, &ListSCIMProvisionedIdentitiesOptions{ - StartIndex: Int(1), - Count: Int(10), + StartIndex: Ptr(1), + Count: Ptr(10), }, fmt.Sprintf("%s?count=10&startIndex=1", url), ) @@ -471,9 +471,9 @@ func TestListSCIMProvisionedIdentitiesOptions_addOptions(t *testing.T) { t, url, &ListSCIMProvisionedIdentitiesOptions{ - StartIndex: Int(1), - Count: Int(10), - Filter: String("test"), + StartIndex: Ptr(1), + Count: Ptr(10), + Filter: Ptr("test"), }, fmt.Sprintf("%s?count=10&filter=test&startIndex=1", url), ) @@ -488,7 +488,7 @@ func TestSCIMUserName_Marshal(t *testing.T) { u := &SCIMUserName{ GivenName: "Name1", FamilyName: "Fname", - Formatted: String("formatted name"), + Formatted: Ptr("formatted name"), } want := `{ @@ -504,8 +504,8 @@ func TestSCIMMeta_Marshal(t *testing.T) { testJSONMarshal(t, &SCIMMeta{}, `{}`) u := &SCIMMeta{ - ResourceType: String("test"), - Location: String("test"), + ResourceType: Ptr("test"), + Location: Ptr("test"), } want := `{ @@ -522,29 +522,29 @@ func TestSCIMProvisionedIdentities_Marshal(t *testing.T) { u := &SCIMProvisionedIdentities{ Schemas: []string{"test", "schema"}, - TotalResults: Int(1), - ItemsPerPage: Int(2), - StartIndex: Int(1), + TotalResults: Ptr(1), + ItemsPerPage: Ptr(2), + StartIndex: Ptr(1), Resources: []*SCIMUserAttributes{ { UserName: "SCIM", Name: SCIMUserName{ GivenName: "scim", FamilyName: "test", - Formatted: String("SCIM"), + Formatted: Ptr("SCIM"), }, - DisplayName: String("Test SCIM"), + DisplayName: Ptr("Test SCIM"), Emails: []*SCIMUserEmail{ { Value: "test", - Primary: Bool(true), - Type: String("test"), + Primary: Ptr(true), + Type: Ptr("test"), }, }, Schemas: []string{"schema1"}, - ExternalID: String("id"), + ExternalID: Ptr("id"), Groups: []string{"group1"}, - Active: Bool(true), + Active: Ptr(true), }, }, } diff --git a/github/search_test.go b/github/search_test.go index f55a531e1e3..d9fcb66c5bf 100644 --- a/github/search_test.go +++ b/github/search_test.go @@ -40,9 +40,9 @@ func TestSearchService_Repositories(t *testing.T) { } want := &RepositoriesSearchResult{ - Total: Int(4), - IncompleteResults: Bool(false), - Repositories: []*Repository{{ID: Int64(1)}, {ID: Int64(2)}}, + Total: Ptr(4), + IncompleteResults: Ptr(false), + Repositories: []*Repository{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Repositories returned %+v, want %+v", result, want) @@ -123,17 +123,17 @@ func TestSearchService_RepositoriesTextMatch(t *testing.T) { } wantedRepoResult := &Repository{ - Name: String("gopher1"), + Name: Ptr("gopher1"), TextMatches: []*TextMatch{{ - Fragment: String("I'm afraid my friend what you have found\nIs a gopher who lives to feed"), - Matches: []*Match{{Text: String("gopher"), Indices: []int{14, 21}}}, + 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}}}, }, }, } want := &RepositoriesSearchResult{ - Total: Int(1), - IncompleteResults: Bool(false), + Total: Ptr(1), + IncompleteResults: Ptr(false), Repositories: []*Repository{wantedRepoResult}, } if !cmp.Equal(result, want) { @@ -164,9 +164,9 @@ func TestSearchService_Topics(t *testing.T) { } want := &TopicsSearchResult{ - Total: Int(4), - IncompleteResults: Bool(false), - Topics: []*TopicResult{{Name: String("blah")}, {Name: String("blahblah")}}, + Total: Ptr(4), + IncompleteResults: Ptr(false), + Topics: []*TopicResult{{Name: Ptr("blah")}, {Name: Ptr("blahblah")}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Topics returned %+v, want %+v", result, want) @@ -209,9 +209,9 @@ func TestSearchService_Commits(t *testing.T) { } want := &CommitsSearchResult{ - Total: Int(4), - IncompleteResults: Bool(false), - Commits: []*CommitResult{{SHA: String("random_hash1")}, {SHA: String("random_hash2")}}, + Total: Ptr(4), + IncompleteResults: Ptr(false), + Commits: []*CommitResult{{SHA: Ptr("random_hash1")}, {SHA: Ptr("random_hash2")}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Commits returned %+v, want %+v", result, want) @@ -256,9 +256,9 @@ func TestSearchService_Issues(t *testing.T) { } want := &IssuesSearchResult{ - Total: Int(4), - IncompleteResults: Bool(true), - Issues: []*Issue{{Number: Int(1)}, {Number: Int(2)}}, + Total: Ptr(4), + IncompleteResults: Ptr(true), + Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues returned %+v, want %+v", result, want) @@ -307,9 +307,9 @@ func TestSearchService_Issues_withQualifiersNoOpts(t *testing.T) { } want := &IssuesSearchResult{ - Total: Int(4), - IncompleteResults: Bool(true), - Issues: []*Issue{{Number: Int(1)}, {Number: Int(2)}}, + Total: Ptr(4), + IncompleteResults: Ptr(true), + Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues returned %+v, want %+v", result, want) @@ -346,9 +346,9 @@ func TestSearchService_Issues_withQualifiersAndOpts(t *testing.T) { } want := &IssuesSearchResult{ - Total: Int(4), - IncompleteResults: Bool(true), - Issues: []*Issue{{Number: Int(1)}, {Number: Int(2)}}, + Total: Ptr(4), + IncompleteResults: Ptr(true), + Issues: []*Issue{{Number: Ptr(1)}, {Number: Ptr(2)}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Issues returned %+v, want %+v", result, want) @@ -380,9 +380,9 @@ func TestSearchService_Users(t *testing.T) { } want := &UsersSearchResult{ - Total: Int(4), - IncompleteResults: Bool(false), - Users: []*User{{ID: Int64(1)}, {ID: Int64(2)}}, + Total: Ptr(4), + IncompleteResults: Ptr(false), + Users: []*User{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Users returned %+v, want %+v", result, want) @@ -427,9 +427,9 @@ func TestSearchService_Code(t *testing.T) { } want := &CodeSearchResult{ - Total: Int(4), - IncompleteResults: Bool(false), - CodeResults: []*CodeResult{{Name: String("1")}, {Name: String("2")}}, + Total: Ptr(4), + IncompleteResults: Ptr(false), + CodeResults: []*CodeResult{{Name: Ptr("1")}, {Name: Ptr("2")}}, } if !cmp.Equal(result, want) { t.Errorf("Search.Code returned %+v, want %+v", result, want) @@ -493,17 +493,17 @@ func TestSearchService_CodeTextMatch(t *testing.T) { } wantedCodeResult := &CodeResult{ - Name: String("gopher1"), + Name: Ptr("gopher1"), TextMatches: []*TextMatch{{ - Fragment: String("I'm afraid my friend what you have found\nIs a gopher who lives to feed"), - Matches: []*Match{{Text: String("gopher"), Indices: []int{14, 21}}}, + 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}}}, }, }, } want := &CodeSearchResult{ - Total: Int(1), - IncompleteResults: Bool(false), + Total: Ptr(1), + IncompleteResults: Ptr(false), CodeResults: []*CodeResult{wantedCodeResult}, } if !cmp.Equal(result, want) { @@ -537,11 +537,11 @@ func TestSearchService_Labels(t *testing.T) { } want := &LabelsSearchResult{ - Total: Int(4), - IncompleteResults: Bool(false), + Total: Ptr(4), + IncompleteResults: Ptr(false), Labels: []*LabelResult{ - {ID: Int64(1234), Name: String("bug"), Description: String("some text")}, - {ID: Int64(4567), Name: String("feature")}, + {ID: Ptr(int64(1234)), Name: Ptr("bug"), Description: Ptr("some text")}, + {ID: Ptr(int64(4567)), Name: Ptr("feature")}, }, } if !cmp.Equal(result, want) { @@ -567,7 +567,7 @@ func TestMatch_Marshal(t *testing.T) { testJSONMarshal(t, &Match{}, "{}") u := &Match{ - Text: String("txt"), + Text: Ptr("txt"), Indices: []int{1}, } @@ -584,13 +584,13 @@ func TestTextMatch_Marshal(t *testing.T) { testJSONMarshal(t, &TextMatch{}, "{}") u := &TextMatch{ - ObjectURL: String("ourl"), - ObjectType: String("otype"), - Property: String("prop"), - Fragment: String("fragment"), + ObjectURL: Ptr("ourl"), + ObjectType: Ptr("otype"), + Property: Ptr("prop"), + Fragment: Ptr("fragment"), Matches: []*Match{ { - Text: String("txt"), + Text: Ptr("txt"), Indices: []int{1}, }, }, @@ -615,15 +615,15 @@ func TestTopicResult_Marshal(t *testing.T) { testJSONMarshal(t, &TopicResult{}, "{}") u := &TopicResult{ - Name: String("name"), - DisplayName: String("displayName"), - ShortDescription: String("shortDescription"), - Description: String("description"), - CreatedBy: String("createdBy"), - UpdatedAt: String("2021-10-26"), - Featured: Bool(false), - Curated: Bool(true), - Score: Float64(99.9), + Name: Ptr("name"), + DisplayName: Ptr("displayName"), + ShortDescription: Ptr("shortDescription"), + Description: Ptr("description"), + CreatedBy: Ptr("createdBy"), + UpdatedAt: Ptr("2021-10-26"), + Featured: Ptr(false), + Curated: Ptr(true), + Score: Ptr(99.9), } want := `{ @@ -646,9 +646,9 @@ func TestRepositoriesSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, &RepositoriesSearchResult{}, "{}") u := &RepositoriesSearchResult{ - Total: Int(0), - IncompleteResults: Bool(true), - Repositories: []*Repository{{ID: Int64(1)}}, + Total: Ptr(0), + IncompleteResults: Ptr(true), + Repositories: []*Repository{{ID: Ptr(int64(1))}}, } want := `{ @@ -665,10 +665,10 @@ func TestCommitsSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, &CommitsSearchResult{}, "{}") c := &CommitsSearchResult{ - Total: Int(0), - IncompleteResults: Bool(true), + Total: Ptr(0), + IncompleteResults: Ptr(true), Commits: []*CommitResult{{ - SHA: String("s"), + SHA: Ptr("s"), }}, } @@ -686,20 +686,20 @@ func TestTopicsSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, &TopicsSearchResult{}, "{}") u := &TopicsSearchResult{ - Total: Int(2), - IncompleteResults: Bool(false), + Total: Ptr(2), + IncompleteResults: Ptr(false), Topics: []*TopicResult{ { - Name: String("t1"), - DisplayName: String("tt"), - ShortDescription: String("t desc"), - Description: String("desc"), - CreatedBy: String("mi"), + Name: Ptr("t1"), + DisplayName: Ptr("tt"), + ShortDescription: Ptr("t desc"), + Description: Ptr("desc"), + CreatedBy: Ptr("mi"), CreatedAt: &Timestamp{referenceTime}, - UpdatedAt: String("2006-01-02T15:04:05Z"), - Featured: Bool(true), - Curated: Bool(true), - Score: Float64(123), + UpdatedAt: Ptr("2006-01-02T15:04:05Z"), + Featured: Ptr(true), + Curated: Ptr(true), + Score: Ptr(123.0), }, }, } @@ -731,13 +731,13 @@ func TestLabelResult_Marshal(t *testing.T) { testJSONMarshal(t, &LabelResult{}, "{}") u := &LabelResult{ - ID: Int64(11), - URL: String("url"), - Name: String("label"), - Color: String("green"), - Default: Bool(true), - Description: String("desc"), - Score: Float64(123), + ID: Ptr(int64(11)), + URL: Ptr("url"), + Name: Ptr("label"), + Color: Ptr("green"), + Default: Ptr(true), + Description: Ptr("desc"), + Score: Ptr(123.0), } want := `{ @@ -782,39 +782,39 @@ func TestIssuesSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, &IssuesSearchResult{}, "{}") u := &IssuesSearchResult{ - Total: Int(48), - IncompleteResults: Bool(false), + Total: Ptr(48), + IncompleteResults: Ptr(false), Issues: []*Issue{ { - ID: Int64(1), - Number: Int(1), - State: String("s"), - Locked: Bool(false), - Title: String("title"), - Body: String("body"), - AuthorAssociation: String("aa"), - User: &User{ID: Int64(1)}, - Labels: []*Label{{ID: Int64(1)}}, - Assignee: &User{ID: Int64(1)}, - Comments: Int(1), + ID: Ptr(int64(1)), + Number: Ptr(1), + State: Ptr("s"), + Locked: Ptr(false), + Title: Ptr("title"), + Body: Ptr("body"), + AuthorAssociation: Ptr("aa"), + User: &User{ID: Ptr(int64(1))}, + Labels: []*Label{{ID: Ptr(int64(1))}}, + Assignee: &User{ID: Ptr(int64(1))}, + Comments: Ptr(1), ClosedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - ClosedBy: &User{ID: Int64(1)}, - URL: String("url"), - HTMLURL: String("hurl"), - CommentsURL: String("curl"), - EventsURL: String("eurl"), - LabelsURL: String("lurl"), - RepositoryURL: String("rurl"), - Milestone: &Milestone{ID: Int64(1)}, - PullRequestLinks: &PullRequestLinks{URL: String("url")}, - Repository: &Repository{ID: Int64(1)}, - Reactions: &Reactions{TotalCount: Int(1)}, - Assignees: []*User{{ID: Int64(1)}}, - NodeID: String("nid"), - TextMatches: []*TextMatch{{ObjectURL: String("ourl")}}, - ActiveLockReason: String("alr"), + ClosedBy: &User{ID: Ptr(int64(1))}, + URL: Ptr("url"), + HTMLURL: Ptr("hurl"), + CommentsURL: Ptr("curl"), + EventsURL: Ptr("eurl"), + LabelsURL: Ptr("lurl"), + RepositoryURL: Ptr("rurl"), + Milestone: &Milestone{ID: Ptr(int64(1))}, + PullRequestLinks: &PullRequestLinks{URL: Ptr("url")}, + Repository: &Repository{ID: Ptr(int64(1))}, + Reactions: &Reactions{TotalCount: Ptr(1)}, + Assignees: []*User{{ID: Ptr(int64(1))}}, + NodeID: Ptr("nid"), + TextMatches: []*TextMatch{{ObjectURL: Ptr("ourl")}}, + ActiveLockReason: Ptr("alr"), }, }, } @@ -891,17 +891,17 @@ func TestLabelsSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, &LabelsSearchResult{}, "{}") u := &LabelsSearchResult{ - Total: Int(5), - IncompleteResults: Bool(false), + Total: Ptr(5), + IncompleteResults: Ptr(false), Labels: []*LabelResult{ { - ID: Int64(1), - URL: String("https://www.test-url.com"), - Name: String("test name"), - Color: String("green"), - Default: Bool(true), - Description: String("testDescription"), - Score: Float64(1), + ID: Ptr(int64(1)), + URL: Ptr("https://www.test-url.com"), + Name: Ptr("test name"), + Color: Ptr("green"), + Default: Ptr(true), + Description: Ptr("testDescription"), + Score: Ptr(1.0), }, }, } @@ -930,15 +930,15 @@ func TestCommitResult_Marshal(t *testing.T) { testJSONMarshal(t, &CommitResult{}, "{}") c := &CommitResult{ - SHA: String("test"), - HTMLURL: String("hurl"), - CommentsURL: String("curl"), - URL: String("url"), - Repository: &Repository{ID: Int64(1)}, - Score: Float64(123), - Commit: &Commit{SHA: String("test")}, - Author: &User{ID: Int64(1)}, - Committer: &User{ID: Int64(1)}, + SHA: Ptr("test"), + HTMLURL: Ptr("hurl"), + CommentsURL: Ptr("curl"), + URL: Ptr("url"), + Repository: &Repository{ID: Ptr(int64(1))}, + Score: Ptr(123.0), + Commit: &Commit{SHA: Ptr("test")}, + Author: &User{ID: Ptr(int64(1))}, + Committer: &User{ID: Ptr(int64(1))}, Parents: []*Commit{}, } @@ -970,16 +970,16 @@ func TestUsersSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, &UsersSearchResult{}, "{}") u := &UsersSearchResult{ - Total: Int(2), - IncompleteResults: Bool(false), + Total: Ptr(2), + IncompleteResults: Ptr(false), Users: []*User{{ - Login: String("loginTest"), - ID: Int64(1), - NodeID: String("NodeTest"), - AvatarURL: String("AvatarURLTest"), - HTMLURL: String("Hurl"), - GravatarID: String("gravatarIDTest"), - Name: String("nameTest"), + Login: Ptr("loginTest"), + ID: Ptr(int64(1)), + NodeID: Ptr("NodeTest"), + AvatarURL: Ptr("AvatarURLTest"), + HTMLURL: Ptr("Hurl"), + GravatarID: Ptr("gravatarIDTest"), + Name: Ptr("nameTest"), }}, } @@ -1007,9 +1007,9 @@ func TestCodeSearchResult_Marshal(t *testing.T) { testJSONMarshal(t, &CodeSearchResult{}, "{}") u := &CodeSearchResult{ - Total: Int(4), - IncompleteResults: Bool(false), - CodeResults: []*CodeResult{{Name: String("n")}}, + Total: Ptr(4), + IncompleteResults: Ptr(false), + CodeResults: []*CodeResult{{Name: Ptr("n")}}, } want := `{ diff --git a/github/secret_scanning_test.go b/github/secret_scanning_test.go index 6bb57ffe1dd..8350b8fc47f 100644 --- a/github/secret_scanning_test.go +++ b/github/secret_scanning_test.go @@ -55,21 +55,21 @@ func TestSecretScanningService_ListAlertsForEnterprise(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := []*SecretScanningAlert{ { - Number: Int(1), + Number: Ptr(1), CreatedAt: &date, - URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: String("open"), + 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"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: String("mailchimp_api_key"), - Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: Ptr("mailchimp_api_key"), + Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), Repository: &Repository{ - ID: Int64(1), - URL: String("url"), - Name: String("n"), + ID: Ptr(int64(1)), + URL: Ptr("url"), + Name: Ptr("n"), }, }, } @@ -125,17 +125,17 @@ func TestSecretScanningService_ListAlertsForOrg(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := []*SecretScanningAlert{ { - Number: Int(1), + Number: Ptr(1), CreatedAt: &date, - URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: String("open"), + 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"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: String("mailchimp_api_key"), - Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: Ptr("mailchimp_api_key"), + Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), }, } @@ -192,17 +192,17 @@ func TestSecretScanningService_ListAlertsForOrgListOptions(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := []*SecretScanningAlert{ { - Number: Int(1), + Number: Ptr(1), CreatedAt: &date, - URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: String("open"), + 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"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: String("mailchimp_api_key"), - Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: Ptr("mailchimp_api_key"), + Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), }, } @@ -257,17 +257,17 @@ func TestSecretScanningService_ListAlertsForRepo(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := []*SecretScanningAlert{ { - Number: Int(1), + Number: Ptr(1), CreatedAt: &date, - URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: String("open"), + 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"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: String("mailchimp_api_key"), - Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: Ptr("mailchimp_api_key"), + Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), }, } @@ -319,17 +319,17 @@ func TestSecretScanningService_GetAlert(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := &SecretScanningAlert{ - Number: Int(1), + Number: Ptr(1), CreatedAt: &date, - URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: String("open"), + 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"), Resolution: nil, ResolvedAt: nil, ResolvedBy: nil, - SecretType: String("mailchimp_api_key"), - Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: Ptr("mailchimp_api_key"), + Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), } if !cmp.Equal(alert, want) { @@ -359,7 +359,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { v := new(SecretScanningAlertUpdateOptions) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - want := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")} + want := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: Ptr("used_in_tests")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -381,7 +381,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { }) ctx := context.Background() - opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")} + opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: Ptr("used_in_tests")} alert, _, err := client.SecretScanning.UpdateAlert(ctx, "o", "r", 1, opts) if err != nil { @@ -390,17 +390,17 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := &SecretScanningAlert{ - Number: Int(1), + Number: Ptr(1), CreatedAt: &date, - URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"), - HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"), - LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"), - State: String("resolved"), - Resolution: String("used_in_tests"), + 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"), ResolvedAt: &date, ResolvedBy: nil, - SecretType: String("mailchimp_api_key"), - Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), + SecretType: Ptr("mailchimp_api_key"), + Secret: Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"), } if !cmp.Equal(alert, want) { @@ -454,17 +454,17 @@ func TestSecretScanningService_ListLocationsForAlert(t *testing.T) { want := []*SecretScanningAlertLocation{ { - Type: String("commit"), + Type: Ptr("commit"), Details: &SecretScanningAlertLocationDetails{ - Path: String("/example/secrets.txt"), - Startline: Int(1), - EndLine: Int(1), - StartColumn: Int(1), - EndColumn: Int(64), - BlobSHA: String("af5626b4a114abcb82d63db7c8082c3c4756e51b"), - BlobURL: String("https://api.github.com/repos/o/r/git/blobs/af5626b4a114abcb82d63db7c8082c3c4756e51b"), - CommitSHA: String("f14d7debf9775f957cf4f1e8176da0786431f72b"), - CommitURL: String("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), + 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"), }, }, } @@ -491,22 +491,22 @@ func TestSecretScanningAlert_Marshal(t *testing.T) { testJSONMarshal(t, &SecretScanningAlert{}, `{}`) u := &SecretScanningAlert{ - Number: Int(1), + Number: Ptr(1), CreatedAt: &Timestamp{referenceTime}, - URL: String("https://api.github.com/teams/2/discussions/3/comments"), - HTMLURL: String("https://api.github.com/teams/2/discussions/3/comments"), - LocationsURL: String("https://api.github.com/teams/2/discussions/3/comments"), - State: String("test_state"), - Resolution: String("test_resolution"), + URL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), + HTMLURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), + LocationsURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), + State: Ptr("test_state"), + Resolution: Ptr("test_resolution"), ResolvedAt: &Timestamp{referenceTime}, ResolvedBy: &User{ - Login: String("test"), - ID: Int64(10), - NodeID: String("A123"), - AvatarURL: String("https://api.github.com/teams/2/discussions/3/comments"), + Login: Ptr("test"), + ID: Ptr(int64(10)), + NodeID: Ptr("A123"), + AvatarURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), }, - SecretType: String("test"), - Secret: String("test"), + SecretType: Ptr("test"), + Secret: Ptr("test"), } want := `{ @@ -536,17 +536,17 @@ func TestSecretScanningAlertLocation_Marshal(t *testing.T) { testJSONMarshal(t, &SecretScanningAlertLocation{}, `{}`) u := &SecretScanningAlertLocation{ - Type: String("test"), + Type: Ptr("test"), Details: &SecretScanningAlertLocationDetails{ - Path: String("test_path"), - Startline: Int(10), - EndLine: Int(20), - StartColumn: Int(30), - EndColumn: Int(40), - BlobSHA: String("test_sha"), - BlobURL: String("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), - CommitSHA: String("test_sha"), - CommitURL: String("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), + Path: Ptr("test_path"), + Startline: Ptr(10), + EndLine: Ptr(20), + StartColumn: Ptr(30), + EndColumn: Ptr(40), + BlobSHA: Ptr("test_sha"), + BlobURL: Ptr("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), + CommitSHA: Ptr("test_sha"), + CommitURL: Ptr("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), }, } @@ -573,15 +573,15 @@ func TestSecretScanningAlertLocationDetails_Marshal(t *testing.T) { testJSONMarshal(t, &SecretScanningAlertLocationDetails{}, `{}`) u := &SecretScanningAlertLocationDetails{ - Path: String("test_path"), - Startline: Int(10), - EndLine: Int(20), - StartColumn: Int(30), - EndColumn: Int(40), - BlobSHA: String("test_sha"), - BlobURL: String("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), - CommitSHA: String("test_sha"), - CommitURL: String("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), + Path: Ptr("test_path"), + Startline: Ptr(10), + EndLine: Ptr(20), + StartColumn: Ptr(30), + EndColumn: Ptr(40), + BlobSHA: Ptr("test_sha"), + BlobURL: Ptr("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), + CommitSHA: Ptr("test_sha"), + CommitURL: Ptr("https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b"), } want := `{ @@ -605,7 +605,7 @@ func TestSecretScanningAlertUpdateOptions_Marshal(t *testing.T) { u := &SecretScanningAlertUpdateOptions{ State: "open", - Resolution: String("false_positive"), + Resolution: Ptr("false_positive"), } want := `{ diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index 8f5e1263570..ff421db49d9 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -172,49 +172,49 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork(t *testing.T) { } want := &Repository{ - ID: Int64(1), - NodeID: String("R_kgDPP3c6pQ"), + ID: Ptr(int64(1)), + NodeID: Ptr("R_kgDPP3c6pQ"), Owner: &User{ - Login: String("owner"), - ID: Int64(2), - NodeID: String("MDQ6VXFGcjYyMjcyMTQw"), - AvatarURL: String("https://avatars.githubusercontent.com/u/111111?v=4"), - HTMLURL: String("https://github.com/xxxxx"), - GravatarID: String(""), - Type: String("User"), - SiteAdmin: Bool(false), - URL: String("https://api.github.com/users/owner"), - EventsURL: String("https://api.github.com/users/owner/events{/privacy}"), - FollowingURL: String("https://api.github.com/users/owner/following{/other_user}"), - FollowersURL: String("https://api.github.com/users/owner/followers"), - GistsURL: String("https://api.github.com/users/owner/gists{/gist_id}"), - OrganizationsURL: String("https://api.github.com/users/owner/orgs"), - ReceivedEventsURL: String("https://api.github.com/users/owner/received_events"), - ReposURL: String("https://api.github.com/users/owner/repos"), - StarredURL: String("https://api.github.com/users/owner/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/owner/subscriptions"), + 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"), }, - Name: String("repo-ghsa-xxxx-xxxx-xxxx"), - FullName: String("owner/repo-ghsa-xxxx-xxxx-xxxx"), - DefaultBranch: String("master"), + Name: Ptr("repo-ghsa-xxxx-xxxx-xxxx"), + FullName: Ptr("owner/repo-ghsa-xxxx-xxxx-xxxx"), + DefaultBranch: Ptr("master"), CreatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 41, 0, time.UTC)}, PushedAt: &Timestamp{time.Date(2023, time.December, 3, 11, 27, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 42, 0, time.UTC)}, - HTMLURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - CloneURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - GitURL: String("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SSHURL: String("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SVNURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - Fork: Bool(false), - ForksCount: Int(0), - NetworkCount: Int(0), - OpenIssuesCount: Int(0), - OpenIssues: Int(0), - StargazersCount: Int(0), - SubscribersCount: Int(0), - WatchersCount: Int(0), - Watchers: Int(0), - Size: Int(0), + 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), Permissions: map[string]bool{ "admin": true, "maintain": true, @@ -222,55 +222,55 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork(t *testing.T) { "push": true, "triage": true, }, - AllowForking: Bool(true), - WebCommitSignoffRequired: Bool(false), - Archived: Bool(false), - Disabled: Bool(false), - Private: Bool(true), - HasIssues: Bool(false), - HasWiki: Bool(false), - HasPages: Bool(false), - HasProjects: Bool(false), - HasDownloads: Bool(false), - HasDiscussions: Bool(false), - IsTemplate: Bool(false), - URL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), - ArchiveURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), - AssigneesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), - BlobsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), - BranchesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), - CollaboratorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), - CommentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), - CommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), - CompareURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), - ContentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), - ContributorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), - DeploymentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), - DownloadsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), - EventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), - ForksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), - GitCommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), - GitRefsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), - GitTagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), - HooksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), - IssueCommentURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), - IssueEventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), - IssuesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), - KeysURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), - LabelsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), - LanguagesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), - MergesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), - MilestonesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), - NotificationsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), - PullsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), - ReleasesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), - StargazersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), - StatusesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), - SubscribersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), - SubscriptionURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), - TagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), - TeamsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), - Visibility: String("private"), + 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"), } if !cmp.Equal(fork, want) { t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned %+v, want %+v", fork, want) @@ -408,49 +408,49 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork_deferred(t *testin } want := &Repository{ - ID: Int64(1), - NodeID: String("R_kgDPP3c6pQ"), + ID: Ptr(int64(1)), + NodeID: Ptr("R_kgDPP3c6pQ"), Owner: &User{ - Login: String("owner"), - ID: Int64(2), - NodeID: String("MDQ6VXFGcjYyMjcyMTQw"), - AvatarURL: String("https://avatars.githubusercontent.com/u/111111?v=4"), - HTMLURL: String("https://github.com/xxxxx"), - GravatarID: String(""), - Type: String("User"), - SiteAdmin: Bool(false), - URL: String("https://api.github.com/users/owner"), - EventsURL: String("https://api.github.com/users/owner/events{/privacy}"), - FollowingURL: String("https://api.github.com/users/owner/following{/other_user}"), - FollowersURL: String("https://api.github.com/users/owner/followers"), - GistsURL: String("https://api.github.com/users/owner/gists{/gist_id}"), - OrganizationsURL: String("https://api.github.com/users/owner/orgs"), - ReceivedEventsURL: String("https://api.github.com/users/owner/received_events"), - ReposURL: String("https://api.github.com/users/owner/repos"), - StarredURL: String("https://api.github.com/users/owner/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/owner/subscriptions"), + 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"), }, - Name: String("repo-ghsa-xxxx-xxxx-xxxx"), - FullName: String("owner/repo-ghsa-xxxx-xxxx-xxxx"), - DefaultBranch: String("master"), + Name: Ptr("repo-ghsa-xxxx-xxxx-xxxx"), + FullName: Ptr("owner/repo-ghsa-xxxx-xxxx-xxxx"), + DefaultBranch: Ptr("master"), CreatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 41, 0, time.UTC)}, PushedAt: &Timestamp{time.Date(2023, time.December, 3, 11, 27, 8, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 42, 0, time.UTC)}, - HTMLURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - CloneURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - GitURL: String("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SSHURL: String("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), - SVNURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), - Fork: Bool(false), - ForksCount: Int(0), - NetworkCount: Int(0), - OpenIssuesCount: Int(0), - OpenIssues: Int(0), - StargazersCount: Int(0), - SubscribersCount: Int(0), - WatchersCount: Int(0), - Watchers: Int(0), - Size: Int(0), + 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), Permissions: map[string]bool{ "admin": true, "maintain": true, @@ -458,55 +458,55 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork_deferred(t *testin "push": true, "triage": true, }, - AllowForking: Bool(true), - WebCommitSignoffRequired: Bool(false), - Archived: Bool(false), - Disabled: Bool(false), - Private: Bool(true), - HasIssues: Bool(false), - HasWiki: Bool(false), - HasPages: Bool(false), - HasProjects: Bool(false), - HasDownloads: Bool(false), - HasDiscussions: Bool(false), - IsTemplate: Bool(false), - URL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), - ArchiveURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), - AssigneesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), - BlobsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), - BranchesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), - CollaboratorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), - CommentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), - CommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), - CompareURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), - ContentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), - ContributorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), - DeploymentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), - DownloadsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), - EventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), - ForksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), - GitCommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), - GitRefsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), - GitTagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), - HooksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), - IssueCommentURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), - IssueEventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), - IssuesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), - KeysURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), - LabelsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), - LanguagesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), - MergesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), - MilestonesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), - NotificationsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), - PullsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), - ReleasesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), - StargazersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), - StatusesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), - SubscribersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), - SubscriptionURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), - TagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), - TeamsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), - Visibility: String("private"), + 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"), } if !cmp.Equal(fork, want) { t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned %+v, want %+v", fork, want) @@ -628,8 +628,8 @@ func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg(t *tes want := []*SecurityAdvisory{ { - GHSAID: String("GHSA-abcd-1234-efgh"), - CVEID: String("CVE-2050-00000"), + GHSAID: Ptr("GHSA-abcd-1234-efgh"), + CVEID: Ptr("CVE-2050-00000"), }, } if !cmp.Equal(advisories, want) { @@ -759,8 +759,8 @@ func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories(t *testing.T want := []*SecurityAdvisory{ { - GHSAID: String("GHSA-abcd-1234-efgh"), - CVEID: String("CVE-2050-00000"), + GHSAID: Ptr("GHSA-abcd-1234-efgh"), + CVEID: Ptr("CVE-2050-00000"), }, } if !cmp.Equal(advisories, want) { @@ -871,7 +871,7 @@ func TestListGlobalSecurityAdvisories(t *testing.T) { }) ctx := context.Background() - opts := &ListGlobalSecurityAdvisoriesOptions{CVEID: String("CVE-xoxo-1234")} + opts := &ListGlobalSecurityAdvisoriesOptions{CVEID: Ptr("CVE-xoxo-1234")} advisories, _, err := client.SecurityAdvisories.ListGlobalSecurityAdvisories(ctx, opts) if err != nil { @@ -881,36 +881,36 @@ func TestListGlobalSecurityAdvisories(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := []*GlobalSecurityAdvisory{ { - ID: Int64(1), + ID: Ptr(int64(1)), SecurityAdvisory: SecurityAdvisory{ - GHSAID: String("GHSA-xoxo-1234-xoxo"), - CVEID: String("CVE-xoxo-1234"), - URL: String("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), - HTMLURL: String("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), - Severity: String("high"), - Summary: String("Heartbleed security advisory"), - Description: String("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + 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."), Identifiers: []*AdvisoryIdentifier{ { - Type: String("GHSA"), - Value: String("GHSA-xoxo-1234-xoxo"), + Type: Ptr("GHSA"), + Value: Ptr("GHSA-xoxo-1234-xoxo"), }, { - Type: String("CVE"), - Value: String("CVE-xoxo-1234"), + Type: Ptr("CVE"), + Value: Ptr("CVE-xoxo-1234"), }, }, PublishedAt: &date, UpdatedAt: &date, WithdrawnAt: nil, CVSS: &AdvisoryCVSS{ - VectorString: String("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), - Score: Float64(7.6), + 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), }, CWEs: []*AdvisoryCWEs{ { - CWEID: String("CWE-400"), - Name: String("Uncontrolled Resource Consumption"), + CWEID: Ptr("CWE-400"), + Name: Ptr("Uncontrolled Resource Consumption"), }, }, }, @@ -918,42 +918,42 @@ func TestListGlobalSecurityAdvisories(t *testing.T) { Vulnerabilities: []*GlobalSecurityVulnerability{ { Package: &VulnerabilityPackage{ - Ecosystem: String("npm"), - Name: String("a-package"), + Ecosystem: Ptr("npm"), + Name: Ptr("a-package"), }, - FirstPatchedVersion: String("1.0.3"), - VulnerableVersionRange: String("<=1.0.2"), + FirstPatchedVersion: Ptr("1.0.3"), + VulnerableVersionRange: Ptr("<=1.0.2"), VulnerableFunctions: []string{"a_function"}, }, }, - RepositoryAdvisoryURL: String("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), - Type: String("reviewed"), - SourceCodeLocation: String("https://github.com/project/a-package"), + 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"), GithubReviewedAt: &date, NVDPublishedAt: &date, Credits: []*Credit{ { User: &User{ - Login: String("user"), - ID: Int64(1), - NodeID: String("12="), - AvatarURL: String("a"), - GravatarID: String(""), - URL: String("a"), - HTMLURL: String("b"), - FollowersURL: String("b"), - FollowingURL: String("c"), - GistsURL: String("d"), - StarredURL: String("e"), - SubscriptionsURL: String("f"), - OrganizationsURL: String("g"), - ReposURL: String("h"), - EventsURL: String("i"), - ReceivedEventsURL: String("j"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, - Type: String("analyst"), + Type: Ptr("analyst"), }, }, }, @@ -1062,42 +1062,42 @@ func TestGetGlobalSecurityAdvisories(t *testing.T) { date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} want := &GlobalSecurityAdvisory{ - ID: Int64(1), + ID: Ptr(int64(1)), SecurityAdvisory: SecurityAdvisory{ - GHSAID: String("GHSA-xoxo-1234-xoxo"), - CVEID: String("CVE-xoxo-1234"), - URL: String("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), - HTMLURL: String("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), - Severity: String("high"), - Summary: String("Heartbleed security advisory"), - Description: String("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + 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."), Identifiers: []*AdvisoryIdentifier{ { - Type: String("GHSA"), - Value: String("GHSA-xoxo-1234-xoxo"), + Type: Ptr("GHSA"), + Value: Ptr("GHSA-xoxo-1234-xoxo"), }, { - Type: String("CVE"), - Value: String("CVE-xoxo-1234"), + Type: Ptr("CVE"), + Value: Ptr("CVE-xoxo-1234"), }, }, PublishedAt: &date, UpdatedAt: &date, WithdrawnAt: nil, CVSS: &AdvisoryCVSS{ - VectorString: String("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), - Score: Float64(7.6), + 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), }, CWEs: []*AdvisoryCWEs{ { - CWEID: String("CWE-400"), - Name: String("Uncontrolled Resource Consumption"), + CWEID: Ptr("CWE-400"), + Name: Ptr("Uncontrolled Resource Consumption"), }, }, }, - RepositoryAdvisoryURL: String("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), - Type: String("reviewed"), - SourceCodeLocation: String("https://github.com/project/a-package"), + 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"), References: []string{"https://nvd.nist.gov/vuln/detail/CVE-xoxo-1234"}, GithubReviewedAt: &date, NVDPublishedAt: &date, @@ -1105,37 +1105,37 @@ func TestGetGlobalSecurityAdvisories(t *testing.T) { Vulnerabilities: []*GlobalSecurityVulnerability{ { Package: &VulnerabilityPackage{ - Ecosystem: String("npm"), - Name: String("a-package"), + Ecosystem: Ptr("npm"), + Name: Ptr("a-package"), }, - FirstPatchedVersion: String("1.0.3"), - VulnerableVersionRange: String("<=1.0.2"), + FirstPatchedVersion: Ptr("1.0.3"), + VulnerableVersionRange: Ptr("<=1.0.2"), VulnerableFunctions: []string{"a_function"}, }, }, Credits: []*Credit{ { User: &User{ - Login: String("user"), - ID: Int64(1), - NodeID: String("12="), - AvatarURL: String("a"), - GravatarID: String(""), - URL: String("a"), - HTMLURL: String("b"), - FollowersURL: String("b"), - FollowingURL: String("c"), - GistsURL: String("d"), - StarredURL: String("e"), - SubscriptionsURL: String("f"), - OrganizationsURL: String("g"), - ReposURL: String("h"), - EventsURL: String("i"), - ReceivedEventsURL: String("j"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, - Type: String("analyst"), + Type: Ptr("analyst"), }, }, } @@ -1165,7 +1165,7 @@ func TestSecurityAdvisorySubmission_Marshal(t *testing.T) { testJSONMarshal(t, &SecurityAdvisorySubmission{}, `{}`) u := &SecurityAdvisorySubmission{ - Accepted: Bool(true), + Accepted: Ptr(true), } w := `{ @@ -1180,8 +1180,8 @@ func TestRepoAdvisoryCredit_Marshal(t *testing.T) { testJSONMarshal(t, &RepoAdvisoryCredit{}, `{}`) u := &RepoAdvisoryCredit{ - Login: String("l"), - Type: String("t"), + Login: Ptr("l"), + Type: Ptr("t"), } w := `{ @@ -1198,67 +1198,67 @@ func TestRepoAdvisoryCreditDetailed_Marshal(t *testing.T) { testDate := &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)} u := &RepoAdvisoryCreditDetailed{ - Type: String("t"), - State: String("s"), + Type: Ptr("t"), + State: Ptr("s"), User: &User{ - Name: String("u"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(false), - Bio: String("bio"), - TwitterUsername: String("tu"), - PublicRepos: Int(1), - PublicGists: Int(1), - Followers: Int(2), - Following: Int(2), + Name: Ptr("u"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(false), + Bio: Ptr("bio"), + TwitterUsername: Ptr("tu"), + PublicRepos: Ptr(1), + PublicGists: Ptr(1), + Followers: Ptr(2), + Following: Ptr(2), CreatedAt: testDate, UpdatedAt: testDate, SuspendedAt: testDate, - Type: String("type"), - SiteAdmin: Bool(false), - TotalPrivateRepos: Int64(10), - OwnedPrivateRepos: Int64(10), - PrivateGists: Int(10), - DiskUsage: Int(10), - Collaborators: Int(10), - TwoFactorAuthentication: Bool(true), + Type: Ptr("type"), + SiteAdmin: Ptr(false), + TotalPrivateRepos: Ptr(int64(10)), + OwnedPrivateRepos: Ptr(int64(10)), + PrivateGists: Ptr(10), + DiskUsage: Ptr(10), + Collaborators: Ptr(10), + TwoFactorAuthentication: Ptr(true), Plan: &Plan{ - Name: String("p"), - Space: Int(2), - Collaborators: Int(2), - PrivateRepos: Int64(2), - Seats: Int(2), - FilledSeats: Int(1), + Name: Ptr("p"), + Space: Ptr(2), + Collaborators: Ptr(2), + PrivateRepos: Ptr(int64(2)), + Seats: Ptr(2), + FilledSeats: Ptr(1), }, - LdapDn: String("l"), - URL: String("url"), - EventsURL: String("e"), - FollowingURL: String("f"), - FollowersURL: String("f"), - GistsURL: String("g"), - OrganizationsURL: String("o"), - ReceivedEventsURL: String("r"), - ReposURL: String("rep"), - StarredURL: String("star"), - SubscriptionsURL: String("sub"), + LdapDn: Ptr("l"), + URL: Ptr("url"), + EventsURL: Ptr("e"), + FollowingURL: Ptr("f"), + FollowersURL: Ptr("f"), + GistsURL: Ptr("g"), + OrganizationsURL: Ptr("o"), + ReceivedEventsURL: Ptr("r"), + ReposURL: Ptr("rep"), + StarredURL: Ptr("star"), + SubscriptionsURL: Ptr("sub"), TextMatches: []*TextMatch{ { - ObjectURL: String("u"), - ObjectType: String("t"), - Property: String("p"), - Fragment: String("f"), + ObjectURL: Ptr("u"), + ObjectType: Ptr("t"), + Property: Ptr("p"), + Fragment: Ptr("f"), Matches: []*Match{ { - Text: String("t"), + Text: Ptr("t"), Indices: []int{1, 2}, }, }, }, }, Permissions: map[string]bool{"p1": true}, - RoleName: String("r"), + RoleName: Ptr("r"), }, } @@ -1338,66 +1338,66 @@ func TestCredit_Marshal(t *testing.T) { testDate := &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)} u := &Credit{ - Type: String("t"), + Type: Ptr("t"), User: &User{ - Name: String("u"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(false), - Bio: String("bio"), - TwitterUsername: String("tu"), - PublicRepos: Int(1), - PublicGists: Int(1), - Followers: Int(2), - Following: Int(2), + Name: Ptr("u"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(false), + Bio: Ptr("bio"), + TwitterUsername: Ptr("tu"), + PublicRepos: Ptr(1), + PublicGists: Ptr(1), + Followers: Ptr(2), + Following: Ptr(2), CreatedAt: testDate, UpdatedAt: testDate, SuspendedAt: testDate, - Type: String("type"), - SiteAdmin: Bool(false), - TotalPrivateRepos: Int64(10), - OwnedPrivateRepos: Int64(10), - PrivateGists: Int(10), - DiskUsage: Int(10), - Collaborators: Int(10), - TwoFactorAuthentication: Bool(true), + Type: Ptr("type"), + SiteAdmin: Ptr(false), + TotalPrivateRepos: Ptr(int64(10)), + OwnedPrivateRepos: Ptr(int64(10)), + PrivateGists: Ptr(10), + DiskUsage: Ptr(10), + Collaborators: Ptr(10), + TwoFactorAuthentication: Ptr(true), Plan: &Plan{ - Name: String("p"), - Space: Int(2), - Collaborators: Int(2), - PrivateRepos: Int64(2), - Seats: Int(2), - FilledSeats: Int(1), + Name: Ptr("p"), + Space: Ptr(2), + Collaborators: Ptr(2), + PrivateRepos: Ptr(int64(2)), + Seats: Ptr(2), + FilledSeats: Ptr(1), }, - LdapDn: String("l"), - URL: String("url"), - EventsURL: String("e"), - FollowingURL: String("f"), - FollowersURL: String("f"), - GistsURL: String("g"), - OrganizationsURL: String("o"), - ReceivedEventsURL: String("r"), - ReposURL: String("rep"), - StarredURL: String("star"), - SubscriptionsURL: String("sub"), + LdapDn: Ptr("l"), + URL: Ptr("url"), + EventsURL: Ptr("e"), + FollowingURL: Ptr("f"), + FollowersURL: Ptr("f"), + GistsURL: Ptr("g"), + OrganizationsURL: Ptr("o"), + ReceivedEventsURL: Ptr("r"), + ReposURL: Ptr("rep"), + StarredURL: Ptr("star"), + SubscriptionsURL: Ptr("sub"), TextMatches: []*TextMatch{ { - ObjectURL: String("u"), - ObjectType: String("t"), - Property: String("p"), - Fragment: String("f"), + ObjectURL: Ptr("u"), + ObjectType: Ptr("t"), + Property: Ptr("p"), + Fragment: Ptr("f"), Matches: []*Match{ { - Text: String("t"), + Text: Ptr("t"), Indices: []int{1, 2}, }, }, }, }, Permissions: map[string]bool{"p1": true}, - RoleName: String("r"), + RoleName: Ptr("r"), }, } @@ -1476,19 +1476,19 @@ func TestGlobalSecurityAdvisory_Marshal(t *testing.T) { testDate := &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)} u := &GlobalSecurityAdvisory{ - ID: Int64(1), - RepositoryAdvisoryURL: String("r"), - Type: String("t"), - SourceCodeLocation: String("s"), + ID: Ptr(int64(1)), + RepositoryAdvisoryURL: Ptr("r"), + Type: Ptr("t"), + SourceCodeLocation: Ptr("s"), References: []string{"r"}, Vulnerabilities: []*GlobalSecurityVulnerability{ { Package: &VulnerabilityPackage{ - Ecosystem: String("npm"), - Name: String("a-package"), + Ecosystem: Ptr("npm"), + Name: Ptr("a-package"), }, - FirstPatchedVersion: String("1.0.3"), - VulnerableVersionRange: String("<=1.0.2"), + FirstPatchedVersion: Ptr("1.0.3"), + VulnerableVersionRange: Ptr("<=1.0.2"), VulnerableFunctions: []string{"a_function"}, }, }, @@ -1496,98 +1496,98 @@ func TestGlobalSecurityAdvisory_Marshal(t *testing.T) { NVDPublishedAt: testDate, Credits: []*Credit{ { - Type: String("t"), + Type: Ptr("t"), User: &User{ - Name: String("u"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(false), - Bio: String("bio"), - TwitterUsername: String("tu"), - PublicRepos: Int(1), - PublicGists: Int(1), - Followers: Int(2), - Following: Int(2), + Name: Ptr("u"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(false), + Bio: Ptr("bio"), + TwitterUsername: Ptr("tu"), + PublicRepos: Ptr(1), + PublicGists: Ptr(1), + Followers: Ptr(2), + Following: Ptr(2), CreatedAt: testDate, UpdatedAt: testDate, SuspendedAt: testDate, - Type: String("type"), - SiteAdmin: Bool(false), - TotalPrivateRepos: Int64(10), - OwnedPrivateRepos: Int64(10), - PrivateGists: Int(10), - DiskUsage: Int(10), - Collaborators: Int(10), - TwoFactorAuthentication: Bool(true), + Type: Ptr("type"), + SiteAdmin: Ptr(false), + TotalPrivateRepos: Ptr(int64(10)), + OwnedPrivateRepos: Ptr(int64(10)), + PrivateGists: Ptr(10), + DiskUsage: Ptr(10), + Collaborators: Ptr(10), + TwoFactorAuthentication: Ptr(true), Plan: &Plan{ - Name: String("p"), - Space: Int(2), - Collaborators: Int(2), - PrivateRepos: Int64(2), - Seats: Int(2), - FilledSeats: Int(1), + Name: Ptr("p"), + Space: Ptr(2), + Collaborators: Ptr(2), + PrivateRepos: Ptr(int64(2)), + Seats: Ptr(2), + FilledSeats: Ptr(1), }, - LdapDn: String("l"), - URL: String("url"), - EventsURL: String("e"), - FollowingURL: String("f"), - FollowersURL: String("f"), - GistsURL: String("g"), - OrganizationsURL: String("o"), - ReceivedEventsURL: String("r"), - ReposURL: String("rep"), - StarredURL: String("star"), - SubscriptionsURL: String("sub"), + LdapDn: Ptr("l"), + URL: Ptr("url"), + EventsURL: Ptr("e"), + FollowingURL: Ptr("f"), + FollowersURL: Ptr("f"), + GistsURL: Ptr("g"), + OrganizationsURL: Ptr("o"), + ReceivedEventsURL: Ptr("r"), + ReposURL: Ptr("rep"), + StarredURL: Ptr("star"), + SubscriptionsURL: Ptr("sub"), TextMatches: []*TextMatch{ { - ObjectURL: String("u"), - ObjectType: String("t"), - Property: String("p"), - Fragment: String("f"), + ObjectURL: Ptr("u"), + ObjectType: Ptr("t"), + Property: Ptr("p"), + Fragment: Ptr("f"), Matches: []*Match{ { - Text: String("t"), + Text: Ptr("t"), Indices: []int{1, 2}, }, }, }, }, Permissions: map[string]bool{"p1": true}, - RoleName: String("r"), + RoleName: Ptr("r"), }, }, }, SecurityAdvisory: SecurityAdvisory{ - GHSAID: String("GHSA-xoxo-1234-xoxo"), - CVEID: String("CVE-xoxo-1234"), - URL: String("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), - HTMLURL: String("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), - Severity: String("high"), - Summary: String("Heartbleed security advisory"), - Description: String("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + 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."), Identifiers: []*AdvisoryIdentifier{ { - Type: String("GHSA"), - Value: String("GHSA-xoxo-1234-xoxo"), + Type: Ptr("GHSA"), + Value: Ptr("GHSA-xoxo-1234-xoxo"), }, { - Type: String("CVE"), - Value: String("CVE-xoxo-1234"), + Type: Ptr("CVE"), + Value: Ptr("CVE-xoxo-1234"), }, }, PublishedAt: testDate, UpdatedAt: testDate, WithdrawnAt: nil, CVSS: &AdvisoryCVSS{ - VectorString: String("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), - Score: Float64(7.6), + 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), }, CWEs: []*AdvisoryCWEs{ { - CWEID: String("CWE-400"), - Name: String("Uncontrolled Resource Consumption"), + CWEID: Ptr("CWE-400"), + Name: Ptr("Uncontrolled Resource Consumption"), }, }, }, diff --git a/github/strings_test.go b/github/strings_test.go index 79ec1fa3c22..4d53f21aac6 100644 --- a/github/strings_test.go +++ b/github/strings_test.go @@ -45,11 +45,11 @@ func TestStringify(t *testing.T) { // pointers {nilPointer, ``}, - {String("foo"), `"foo"`}, - {Int(123), `123`}, - {Bool(false), `false`}, + {Ptr("foo"), `"foo"`}, + {Ptr(123), `123`}, + {Ptr(false), `false`}, { - []*string{String("a"), String("b")}, + []*string{Ptr("a"), Ptr("b")}, `["a" "b"]`, }, @@ -63,11 +63,11 @@ func TestStringify(t *testing.T) { `github.Timestamp{2006-01-02 15:04:05 +0000 UTC}`, }, { - User{ID: Int64(123), Name: String("n")}, + User{ID: Ptr(int64(123)), Name: Ptr("n")}, `github.User{ID:123, Name:"n"}`, }, { - Repository{Owner: &User{ID: Int64(123)}}, + Repository{Owner: &User{ID: Ptr(int64(123))}}, `github.Repository{Owner:github.User{ID:123}}`, }, } @@ -91,47 +91,47 @@ func TestString(t *testing.T) { in interface{} out string }{ - {CodeResult{Name: String("n")}, `github.CodeResult{Name:"n"}`}, - {CommitAuthor{Name: String("n")}, `github.CommitAuthor{Name:"n"}`}, - {CommitFile{SHA: String("s")}, `github.CommitFile{SHA:"s"}`}, - {CommitStats{Total: Int(1)}, `github.CommitStats{Total:1}`}, - {CommitsComparison{TotalCommits: Int(1)}, `github.CommitsComparison{TotalCommits:1}`}, - {Commit{SHA: String("s")}, `github.Commit{SHA:"s"}`}, - {Event{ID: String("1")}, `github.Event{ID:"1"}`}, - {GistComment{ID: Int64(1)}, `github.GistComment{ID:1}`}, - {GistFile{Size: Int(1)}, `github.GistFile{Size:1}`}, - {Gist{ID: String("1")}, `github.Gist{ID:"1"}`}, - {GitObject{SHA: String("s")}, `github.GitObject{SHA:"s"}`}, - {Gitignore{Name: String("n")}, `github.Gitignore{Name:"n"}`}, - {Hook{ID: Int64(1)}, `github.Hook{ID:1}`}, - {IssueComment{ID: Int64(1)}, `github.IssueComment{ID:1}`}, - {Issue{Number: Int(1)}, `github.Issue{Number:1}`}, - {Key{ID: Int64(1)}, `github.Key{ID:1}`}, - {Label{ID: Int64(1), Name: String("l")}, `github.Label{ID:1, Name:"l"}`}, - {Organization{ID: Int64(1)}, `github.Organization{ID:1}`}, - {PullRequestComment{ID: Int64(1)}, `github.PullRequestComment{ID:1}`}, - {PullRequest{Number: Int(1)}, `github.PullRequest{Number:1}`}, - {PullRequestReview{ID: Int64(1)}, `github.PullRequestReview{ID:1}`}, - {DraftReviewComment{Position: Int(1)}, `github.DraftReviewComment{Position:1}`}, - {PullRequestReviewRequest{Body: String("r")}, `github.PullRequestReviewRequest{Body:"r"}`}, - {PullRequestReviewDismissalRequest{Message: String("r")}, `github.PullRequestReviewDismissalRequest{Message:"r"}`}, - {HeadCommit{SHA: String("s")}, `github.HeadCommit{SHA:"s"}`}, - {PushEvent{PushID: Int64(1)}, `github.PushEvent{PushID:1}`}, - {Reference{Ref: String("r")}, `github.Reference{Ref:"r"}`}, - {ReleaseAsset{ID: Int64(1)}, `github.ReleaseAsset{ID:1}`}, - {RepoStatus{ID: Int64(1)}, `github.RepoStatus{ID:1}`}, - {RepositoryComment{ID: Int64(1)}, `github.RepositoryComment{ID:1}`}, - {RepositoryCommit{SHA: String("s")}, `github.RepositoryCommit{SHA:"s"}`}, - {RepositoryContent{Name: String("n")}, `github.RepositoryContent{Name:"n"}`}, - {RepositoryRelease{ID: Int64(1)}, `github.RepositoryRelease{ID:1}`}, - {Repository{ID: Int64(1)}, `github.Repository{ID:1}`}, - {Team{ID: Int64(1)}, `github.Team{ID:1}`}, - {TreeEntry{SHA: String("s")}, `github.TreeEntry{SHA:"s"}`}, - {Tree{SHA: String("s")}, `github.Tree{SHA:"s"}`}, - {User{ID: Int64(1)}, `github.User{ID:1}`}, - {WebHookAuthor{Name: String("n")}, `github.CommitAuthor{Name:"n"}`}, - {WebHookCommit{ID: String("1")}, `github.HeadCommit{ID:"1"}`}, - {WebHookPayload{Ref: String("r")}, `github.PushEvent{Ref:"r"}`}, + {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}`}, + {Key{ID: Ptr(int64(1))}, `github.Key{ID:1}`}, + {Label{ID: Ptr(int64(1)), Name: Ptr("l")}, `github.Label{ID:1, Name:"l"}`}, + {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"}`}, + {PullRequestReviewDismissalRequest{Message: Ptr("r")}, `github.PullRequestReviewDismissalRequest{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"}`}, + {RepositoryRelease{ID: Ptr(int64(1))}, `github.RepositoryRelease{ID:1}`}, + {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"}`}, } for i, tt := range tests { diff --git a/github/teams_discussion_comments_test.go b/github/teams_discussion_comments_test.go index 8c09568178e..e8173abcd5a 100644 --- a/github/teams_discussion_comments_test.go +++ b/github/teams_discussion_comments_test.go @@ -83,35 +83,35 @@ func TestTeamsService_ListComments(t *testing.T) { want := []*DiscussionComment{ { Author: &User{ - Login: String("author"), - ID: Int64(0), - AvatarURL: String("https://avatars1.githubusercontent.com/u/0?v=4"), - GravatarID: String(""), - URL: String("https://api.github.com/users/author"), - HTMLURL: String("https://github.com/author"), - FollowersURL: String("https://api.github.com/users/author/followers"), - FollowingURL: String("https://api.github.com/users/author/following{/other_user}"), - GistsURL: String("https://api.github.com/users/author/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/author/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/author/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/author/orgs"), - ReposURL: String("https://api.github.com/users/author/repos"), - EventsURL: String("https://api.github.com/users/author/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/author/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, - Body: String("comment"), - BodyHTML: String("

comment

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

comment

"), + BodyVersion: Ptr("version"), CreatedAt: &Timestamp{time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)}, LastEditedAt: nil, - DiscussionURL: String("https://api.github.com/teams/2/discussions/3"), - HTMLURL: String("https://github.com/orgs/1/teams/2/discussions/3/comments/4"), - NodeID: String("node"), - Number: Int(4), + 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), UpdatedAt: &Timestamp{time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)}, - URL: String("https://api.github.com/teams/2/discussions/3/comments/4"), + URL: Ptr("https://api.github.com/teams/2/discussions/3/comments/4"), }, } @@ -183,7 +183,7 @@ func TestTeamsService_GetComment(t *testing.T) { testMethod(t, r, "GET") fmt.Fprint(w, `{"number":4}`) } - want := &DiscussionComment{Number: Int(4)} + want := &DiscussionComment{Number: Ptr(4)} e := tdcEndpointByID("1", "2", "3", "4") mux.HandleFunc(e, handlerFunc) @@ -243,7 +243,7 @@ func TestTeamsService_CreateComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := DiscussionComment{Body: String("c")} + input := DiscussionComment{Body: Ptr("c")} handlerFunc := func(w http.ResponseWriter, r *http.Request) { v := new(DiscussionComment) @@ -256,7 +256,7 @@ func TestTeamsService_CreateComment(t *testing.T) { fmt.Fprint(w, `{"number":4}`) } - want := &DiscussionComment{Number: Int(4)} + want := &DiscussionComment{Number: Ptr(4)} e := tdcEndpointByID("1", "2", "3", "") mux.HandleFunc(e, handlerFunc) @@ -316,7 +316,7 @@ func TestTeamsService_EditComment(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := DiscussionComment{Body: String("e")} + input := DiscussionComment{Body: Ptr("e")} handlerFunc := func(w http.ResponseWriter, r *http.Request) { v := new(DiscussionComment) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) @@ -328,7 +328,7 @@ func TestTeamsService_EditComment(t *testing.T) { fmt.Fprint(w, `{"number":4}`) } - want := &DiscussionComment{Number: Int(4)} + want := &DiscussionComment{Number: Ptr(4)} e := tdcEndpointByID("1", "2", "3", "4") mux.HandleFunc(e, handlerFunc) @@ -438,28 +438,28 @@ func TestDiscussionComment_Marshal(t *testing.T) { u := &DiscussionComment{ Author: &User{}, - Body: String("body"), - BodyHTML: String("body html"), - BodyVersion: String("body version"), + Body: Ptr("body"), + BodyHTML: Ptr("body html"), + BodyVersion: Ptr("body version"), CreatedAt: &Timestamp{referenceTime}, LastEditedAt: &Timestamp{referenceTime}, - DiscussionURL: String("url"), - HTMLURL: String("html url"), - NodeID: String("node"), - Number: Int(1), + DiscussionURL: Ptr("url"), + HTMLURL: Ptr("html url"), + NodeID: Ptr("node"), + Number: Ptr(1), UpdatedAt: &Timestamp{referenceTime}, - URL: String("url"), + URL: Ptr("url"), Reactions: &Reactions{ - TotalCount: Int(10), - PlusOne: Int(1), - MinusOne: Int(1), - Laugh: Int(1), - Confused: Int(1), - Heart: Int(2), - Hooray: Int(5), - Rocket: Int(3), - Eyes: Int(9), - URL: String("url"), + TotalCount: Ptr(10), + PlusOne: Ptr(1), + MinusOne: Ptr(1), + Laugh: Ptr(1), + Confused: Ptr(1), + Heart: Ptr(2), + Hooray: Ptr(5), + Rocket: Ptr(3), + Eyes: Ptr(9), + URL: Ptr("url"), }, } diff --git a/github/teams_discussions_test.go b/github/teams_discussions_test.go index 3033a84da25..236382e0227 100644 --- a/github/teams_discussions_test.go +++ b/github/teams_discussions_test.go @@ -76,40 +76,40 @@ func TestTeamsService_ListDiscussionsByID(t *testing.T) { want := []*TeamDiscussion{ { Author: &User{ - Login: String("author"), - ID: Int64(0), - AvatarURL: String("https://avatars1.githubusercontent.com/u/0?v=4"), - GravatarID: String(""), - URL: String("https://api.github.com/users/author"), - HTMLURL: String("https://github.com/author"), - FollowersURL: String("https://api.github.com/users/author/followers"), - FollowingURL: String("https://api.github.com/users/author/following{/other_user}"), - GistsURL: String("https://api.github.com/users/author/gists{/gist_id}"), - StarredURL: String("https://api.github.com/users/author/starred{/owner}{/repo}"), - SubscriptionsURL: String("https://api.github.com/users/author/subscriptions"), - OrganizationsURL: String("https://api.github.com/users/author/orgs"), - ReposURL: String("https://api.github.com/users/author/repos"), - EventsURL: String("https://api.github.com/users/author/events{/privacy}"), - ReceivedEventsURL: String("https://api.github.com/users/author/received_events"), - Type: String("User"), - SiteAdmin: Bool(false), + 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), }, - Body: String("test"), - BodyHTML: String("

test

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

test

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

test

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

test

"), + BodyVersion: Ptr("version"), + CommentsCount: Ptr(1), + CommentsURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), CreatedAt: &Timestamp{time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)}, LastEditedAt: nil, - HTMLURL: String("https://github.com/orgs/1/teams/2/discussions/3"), - NodeID: String("node"), - Number: Int(3), - Pinned: Bool(false), - Private: Bool(false), - TeamURL: String("https://api.github.com/teams/2"), - Title: String("test"), + 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"), UpdatedAt: &Timestamp{time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)}, - URL: String("https://api.github.com/teams/2/discussions/3"), + URL: Ptr("https://api.github.com/teams/2/discussions/3"), }, } if !cmp.Equal(discussions, want) { @@ -261,7 +261,7 @@ func TestTeamsService_GetDiscussionByID(t *testing.T) { t.Errorf("Teams.GetDiscussionByID returned error: %v", err) } - want := &TeamDiscussion{Number: Int(3)} + want := &TeamDiscussion{Number: Ptr(3)} if !cmp.Equal(discussion, want) { t.Errorf("Teams.GetDiscussionByID returned %+v, want %+v", discussion, want) } @@ -296,7 +296,7 @@ func TestTeamsService_GetDiscussionBySlug(t *testing.T) { t.Errorf("Teams.GetDiscussionBySlug returned error: %v", err) } - want := &TeamDiscussion{Number: Int(3)} + want := &TeamDiscussion{Number: Ptr(3)} if !cmp.Equal(discussion, want) { t.Errorf("Teams.GetDiscussionBySlug returned %+v, want %+v", discussion, want) } @@ -320,7 +320,7 @@ func TestTeamsService_CreateDiscussionByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: String("c_t"), Body: String("c_b")} + input := TeamDiscussion{Title: Ptr("c_t"), Body: Ptr("c_b")} mux.HandleFunc("/organizations/1/team/2/discussions", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) @@ -340,7 +340,7 @@ func TestTeamsService_CreateDiscussionByID(t *testing.T) { t.Errorf("Teams.CreateDiscussionByID returned error: %v", err) } - want := &TeamDiscussion{Number: Int(3)} + want := &TeamDiscussion{Number: Ptr(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.CreateDiscussionByID returned %+v, want %+v", comment, want) } @@ -364,7 +364,7 @@ func TestTeamsService_CreateDiscussionBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: String("c_t"), Body: String("c_b")} + input := TeamDiscussion{Title: Ptr("c_t"), Body: Ptr("c_b")} mux.HandleFunc("/orgs/o/teams/s/discussions", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) @@ -384,7 +384,7 @@ func TestTeamsService_CreateDiscussionBySlug(t *testing.T) { t.Errorf("Teams.CreateDiscussionBySlug returned error: %v", err) } - want := &TeamDiscussion{Number: Int(3)} + want := &TeamDiscussion{Number: Ptr(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.CreateDiscussionBySlug returned %+v, want %+v", comment, want) } @@ -408,7 +408,7 @@ func TestTeamsService_EditDiscussionByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: String("e_t"), Body: String("e_b")} + input := TeamDiscussion{Title: Ptr("e_t"), Body: Ptr("e_b")} mux.HandleFunc("/organizations/1/team/2/discussions/3", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) @@ -428,7 +428,7 @@ func TestTeamsService_EditDiscussionByID(t *testing.T) { t.Errorf("Teams.EditDiscussionByID returned error: %v", err) } - want := &TeamDiscussion{Number: Int(3)} + want := &TeamDiscussion{Number: Ptr(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.EditDiscussionByID returned %+v, want %+v", comment, want) } @@ -452,7 +452,7 @@ func TestTeamsService_EditDiscussionBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := TeamDiscussion{Title: String("e_t"), Body: String("e_b")} + input := TeamDiscussion{Title: Ptr("e_t"), Body: Ptr("e_b")} mux.HandleFunc("/orgs/o/teams/s/discussions/3", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) @@ -472,7 +472,7 @@ func TestTeamsService_EditDiscussionBySlug(t *testing.T) { t.Errorf("Teams.EditDiscussionBySlug returned error: %v", err) } - want := &TeamDiscussion{Number: Int(3)} + want := &TeamDiscussion{Number: Ptr(3)} if !cmp.Equal(comment, want) { t.Errorf("Teams.EditDiscussionBySlug returned %+v, want %+v", comment, want) } @@ -548,41 +548,41 @@ func TestTeamDiscussion_Marshal(t *testing.T) { u := &TeamDiscussion{ Author: &User{ - Login: String("author"), - ID: Int64(0), - URL: String("https://api.github.com/users/author"), - AvatarURL: String("https://avatars1.githubusercontent.com/u/0?v=4"), - GravatarID: String(""), + Login: Ptr("author"), + ID: Ptr(int64(0)), + URL: Ptr("https://api.github.com/users/author"), + AvatarURL: Ptr("https://avatars1.githubusercontent.com/u/0?v=4"), + GravatarID: Ptr(""), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - Body: String("test"), - BodyHTML: String("

test

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

test

"), + BodyVersion: Ptr("version"), + CommentsCount: Ptr(1), + CommentsURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), CreatedAt: &Timestamp{referenceTime}, LastEditedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://api.github.com/teams/2/discussions/3/comments"), - NodeID: String("A123"), - Number: Int(10), - Pinned: Bool(true), - Private: Bool(false), - TeamURL: String("https://api.github.com/teams/2/discussions/3/comments"), - Title: String("Test"), + HTMLURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), + NodeID: Ptr("A123"), + Number: Ptr(10), + Pinned: Ptr(true), + Private: Ptr(false), + TeamURL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), + Title: Ptr("Test"), UpdatedAt: &Timestamp{referenceTime}, - URL: String("https://api.github.com/teams/2/discussions/3/comments"), + URL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), Reactions: &Reactions{ - TotalCount: Int(1), - PlusOne: Int(2), - MinusOne: Int(-3), - Laugh: Int(4), - Confused: Int(5), - Heart: Int(6), - Hooray: Int(7), - Rocket: Int(8), - Eyes: Int(9), - URL: String("https://api.github.com/teams/2/discussions/3/comments"), + TotalCount: Ptr(1), + PlusOne: Ptr(2), + MinusOne: Ptr(-3), + Laugh: Ptr(4), + Confused: Ptr(5), + Heart: Ptr(6), + Hooray: Ptr(7), + Rocket: Ptr(8), + Eyes: Ptr(9), + URL: Ptr("https://api.github.com/teams/2/discussions/3/comments"), }, } diff --git a/github/teams_members_test.go b/github/teams_members_test.go index 1af751285ad..4cd41d4fc2a 100644 --- a/github/teams_members_test.go +++ b/github/teams_members_test.go @@ -32,7 +32,7 @@ func TestTeamsService__ListTeamMembersByID(t *testing.T) { t.Errorf("Teams.ListTeamMembersByID returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamMembersByID returned %+v, want %+v", members, want) } @@ -107,7 +107,7 @@ func TestTeamsService__ListTeamMembersBySlug(t *testing.T) { t.Errorf("Teams.ListTeamMembersBySlug returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamMembersBySlug returned %+v, want %+v", members, want) } @@ -189,7 +189,7 @@ func TestTeamsService__GetTeamMembershipByID(t *testing.T) { t.Errorf("Teams.GetTeamMembershipByID returned error: %v", err) } - want := &Membership{URL: String("u"), State: String("active")} + want := &Membership{URL: Ptr("u"), State: Ptr("active")} if !cmp.Equal(membership, want) { t.Errorf("Teams.GetTeamMembershipByID returned %+v, want %+v", membership, want) } @@ -260,7 +260,7 @@ func TestTeamsService__GetTeamMembershipBySlug(t *testing.T) { t.Errorf("Teams.GetTeamMembershipBySlug returned error: %v", err) } - want := &Membership{URL: String("u"), State: String("active")} + want := &Membership{URL: Ptr("u"), State: Ptr("active")} if !cmp.Equal(membership, want) { t.Errorf("Teams.GetTeamMembershipBySlug returned %+v, want %+v", membership, want) } @@ -349,7 +349,7 @@ func TestTeamsService__AddTeamMembershipByID(t *testing.T) { t.Errorf("Teams.AddTeamMembershipByID returned error: %v", err) } - want := &Membership{URL: String("u"), State: String("pending")} + want := &Membership{URL: Ptr("u"), State: Ptr("pending")} if !cmp.Equal(membership, want) { t.Errorf("Teams.AddTeamMembershipByID returned %+v, want %+v", membership, want) } @@ -438,7 +438,7 @@ func TestTeamsService__AddTeamMembershipBySlug(t *testing.T) { t.Errorf("Teams.AddTeamMembershipBySlug returned error: %v", err) } - want := &Membership{URL: String("u"), State: String("pending")} + want := &Membership{URL: Ptr("u"), State: Ptr("pending")} if !cmp.Equal(membership, want) { t.Errorf("Teams.AddTeamMembershipBySlug returned %+v, want %+v", membership, want) } @@ -648,7 +648,7 @@ func TestTeamsService__ListPendingTeamInvitationsByID(t *testing.T) { t.Errorf("Teams.ListPendingTeamInvitationsByID returned error: %v", err) } - want := []*Invitation{{ID: Int64(1)}} + want := []*Invitation{{ID: Ptr(int64(1))}} if !cmp.Equal(invitations, want) { t.Errorf("Teams.ListPendingTeamInvitationsByID returned %+v, want %+v", invitations, want) } @@ -723,7 +723,7 @@ func TestTeamsService__ListPendingTeamInvitationsBySlug(t *testing.T) { t.Errorf("Teams.ListPendingTeamInvitationsByID returned error: %v", err) } - want := []*Invitation{{ID: Int64(1)}} + want := []*Invitation{{ID: Ptr(int64(1))}} if !cmp.Equal(invitations, want) { t.Errorf("Teams.ListPendingTeamInvitationsByID returned %+v, want %+v", invitations, want) } diff --git a/github/teams_test.go b/github/teams_test.go index 110925c1226..34c5b2026b4 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -34,7 +34,7 @@ func TestTeamsService_ListTeams(t *testing.T) { t.Errorf("Teams.ListTeams returned error: %v", err) } - want := []*Team{{ID: Int64(1)}} + want := []*Team{{ID: Ptr(int64(1))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListTeams returned %+v, want %+v", teams, want) } @@ -78,7 +78,7 @@ func TestTeamsService_GetTeamByID(t *testing.T) { t.Errorf("Teams.GetTeamByID returned error: %v", err) } - want := &Team{ID: Int64(1), Name: String("n"), Description: String("d"), URL: String("u"), Slug: String("s"), Permission: String("p"), LDAPDN: String("cn=n,ou=groups,dc=example,dc=com")} + 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")} if !cmp.Equal(team, want) { t.Errorf("Teams.GetTeamByID returned %+v, want %+v", team, want) } @@ -135,7 +135,7 @@ func TestTeamsService_GetTeamBySlug(t *testing.T) { t.Errorf("Teams.GetTeamBySlug returned error: %v", err) } - want := &Team{ID: Int64(1), Name: String("n"), Description: String("d"), URL: String("u"), Slug: String("s"), Permission: String("p"), LDAPDN: String("cn=n,ou=groups,dc=example,dc=com")} + 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")} if !cmp.Equal(team, want) { t.Errorf("Teams.GetTeamBySlug returned %+v, want %+v", team, want) } @@ -190,7 +190,7 @@ func TestTeamsService_CreateTeam(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := NewTeam{Name: "n", Privacy: String("closed"), RepoNames: []string{"r"}} + input := NewTeam{Name: "n", Privacy: Ptr("closed"), RepoNames: []string{"r"}} mux.HandleFunc("/orgs/o/teams", func(w http.ResponseWriter, r *http.Request) { v := new(NewTeam) @@ -210,7 +210,7 @@ func TestTeamsService_CreateTeam(t *testing.T) { t.Errorf("Teams.CreateTeam returned error: %v", err) } - want := &Team{ID: Int64(1)} + want := &Team{ID: Ptr(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.CreateTeam returned %+v, want %+v", team, want) } @@ -243,7 +243,7 @@ func TestTeamsService_EditTeamByID(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := NewTeam{Name: "n", Privacy: String("closed")} + input := NewTeam{Name: "n", Privacy: Ptr("closed")} mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) { v := new(NewTeam) @@ -263,7 +263,7 @@ func TestTeamsService_EditTeamByID(t *testing.T) { t.Errorf("Teams.EditTeamByID returned error: %v", err) } - want := &Team{ID: Int64(1)} + want := &Team{ID: Ptr(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.EditTeamByID returned %+v, want %+v", team, want) } @@ -287,7 +287,7 @@ func TestTeamsService_EditTeamByID_RemoveParent(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := NewTeam{Name: "n", NotificationSetting: String("notifications_enabled"), Privacy: String("closed")} + input := NewTeam{Name: "n", NotificationSetting: Ptr("notifications_enabled"), Privacy: Ptr("closed")} var body string mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) { @@ -313,7 +313,7 @@ func TestTeamsService_EditTeamByID_RemoveParent(t *testing.T) { t.Errorf("Teams.EditTeamByID returned error: %v", err) } - want := &Team{ID: Int64(1)} + want := &Team{ID: Ptr(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.EditTeamByID returned %+v, want %+v", team, want) } @@ -327,7 +327,7 @@ func TestTeamsService_EditTeamBySlug(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := NewTeam{Name: "n", Privacy: String("closed")} + input := NewTeam{Name: "n", Privacy: Ptr("closed")} mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { v := new(NewTeam) @@ -347,7 +347,7 @@ func TestTeamsService_EditTeamBySlug(t *testing.T) { t.Errorf("Teams.EditTeamBySlug returned error: %v", err) } - want := &Team{ID: Int64(1)} + want := &Team{ID: Ptr(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.EditTeamBySlug returned %+v, want %+v", team, want) } @@ -371,7 +371,7 @@ func TestTeamsService_EditTeamBySlug_RemoveParent(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := NewTeam{Name: "n", NotificationSetting: String("notifications_disabled"), Privacy: String("closed")} + input := NewTeam{Name: "n", NotificationSetting: Ptr("notifications_disabled"), Privacy: Ptr("closed")} var body string mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { @@ -397,7 +397,7 @@ func TestTeamsService_EditTeamBySlug_RemoveParent(t *testing.T) { t.Errorf("Teams.EditTeam returned error: %v", err) } - want := &Team{ID: Int64(1)} + want := &Team{ID: Ptr(int64(1))} if !cmp.Equal(team, want) { t.Errorf("Teams.EditTeam returned %+v, want %+v", team, want) } @@ -474,7 +474,7 @@ func TestTeamsService_ListChildTeamsByParentID(t *testing.T) { t.Errorf("Teams.ListChildTeamsByParentID returned error: %v", err) } - want := []*Team{{ID: Int64(2)}} + want := []*Team{{ID: Ptr(int64(2))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListChildTeamsByParentID returned %+v, want %+v", teams, want) } @@ -511,7 +511,7 @@ func TestTeamsService_ListChildTeamsByParentSlug(t *testing.T) { t.Errorf("Teams.ListChildTeamsByParentSlug returned error: %v", err) } - want := []*Team{{ID: Int64(2)}} + want := []*Team{{ID: Ptr(int64(2))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListChildTeamsByParentSlug returned %+v, want %+v", teams, want) } @@ -549,7 +549,7 @@ func TestTeamsService_ListTeamReposByID(t *testing.T) { t.Errorf("Teams.ListTeamReposByID returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamReposByID returned %+v, want %+v", members, want) } @@ -587,7 +587,7 @@ func TestTeamsService_ListTeamReposBySlug(t *testing.T) { t.Errorf("Teams.ListTeamReposBySlug returned error: %v", err) } - want := []*Repository{{ID: Int64(1)}} + want := []*Repository{{ID: Ptr(int64(1))}} if !cmp.Equal(members, want) { t.Errorf("Teams.ListTeamReposBySlug returned %+v, want %+v", members, want) } @@ -623,7 +623,7 @@ func TestTeamsService_IsTeamRepoByID_true(t *testing.T) { t.Errorf("Teams.IsTeamRepoByID returned error: %v", err) } - want := &Repository{ID: Int64(1)} + want := &Repository{ID: Ptr(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Teams.IsTeamRepoByID returned %+v, want %+v", repo, want) } @@ -659,7 +659,7 @@ func TestTeamsService_IsTeamRepoBySlug_true(t *testing.T) { t.Errorf("Teams.IsTeamRepoBySlug returned error: %v", err) } - want := &Repository{ID: Int64(1)} + want := &Repository{ID: Ptr(int64(1))} if !cmp.Equal(repo, want) { t.Errorf("Teams.IsTeamRepoBySlug returned %+v, want %+v", repo, want) } @@ -992,7 +992,7 @@ func TestTeamsService_ListUserTeams(t *testing.T) { t.Errorf("Teams.ListUserTeams returned error: %v", err) } - want := []*Team{{ID: Int64(1)}} + want := []*Team{{ID: Ptr(int64(1))}} if !cmp.Equal(teams, want) { t.Errorf("Teams.ListUserTeams returned %+v, want %+v", teams, want) } @@ -1023,7 +1023,7 @@ func TestTeamsService_ListProjectsByID(t *testing.T) { t.Errorf("Teams.ListTeamProjectsByID returned error: %v", err) } - want := []*Project{{ID: Int64(1)}} + want := []*Project{{ID: Ptr(int64(1))}} if !cmp.Equal(projects, want) { t.Errorf("Teams.ListTeamProjectsByID returned %+v, want %+v", projects, want) } @@ -1059,7 +1059,7 @@ func TestTeamsService_ListProjectsBySlug(t *testing.T) { t.Errorf("Teams.ListTeamProjectsBySlug returned error: %v", err) } - want := []*Project{{ID: Int64(1)}} + want := []*Project{{ID: Ptr(int64(1))}} if !cmp.Equal(projects, want) { t.Errorf("Teams.ListTeamProjectsBySlug returned %+v, want %+v", projects, want) } @@ -1095,7 +1095,7 @@ func TestTeamsService_ReviewProjectsByID(t *testing.T) { t.Errorf("Teams.ReviewTeamProjectsByID returned error: %v", err) } - want := &Project{ID: Int64(1)} + want := &Project{ID: Ptr(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Teams.ReviewTeamProjectsByID returned %+v, want %+v", project, want) } @@ -1131,7 +1131,7 @@ func TestTeamsService_ReviewProjectsBySlug(t *testing.T) { t.Errorf("Teams.ReviewTeamProjectsBySlug returned error: %v", err) } - want := &Project{ID: Int64(1)} + want := &Project{ID: Ptr(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Teams.ReviewTeamProjectsBySlug returned %+v, want %+v", project, want) } @@ -1156,7 +1156,7 @@ func TestTeamsService_AddTeamProjectByID(t *testing.T) { client, mux, _ := setup(t) opt := &TeamProjectOptions{ - Permission: String("admin"), + Permission: Ptr("admin"), } mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) { @@ -1194,7 +1194,7 @@ func TestTeamsService_AddTeamProjectBySlug(t *testing.T) { client, mux, _ := setup(t) opt := &TeamProjectOptions{ - Permission: String("admin"), + Permission: Ptr("admin"), } mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) { @@ -1307,9 +1307,9 @@ func TestTeamsService_ListIDPGroupsInOrganization(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("1"), - GroupName: String("n"), - GroupDescription: String("d"), + GroupID: Ptr("1"), + GroupName: Ptr("n"), + GroupDescription: Ptr("d"), }, }, } @@ -1350,9 +1350,9 @@ func TestTeamsService_ListIDPGroupsForTeamByID(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("1"), - GroupName: String("n"), - GroupDescription: String("d"), + GroupID: Ptr("1"), + GroupName: Ptr("n"), + GroupDescription: Ptr("d"), }, }, } @@ -1393,9 +1393,9 @@ func TestTeamsService_ListIDPGroupsForTeamBySlug(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("1"), - GroupName: String("n"), - GroupDescription: String("d"), + GroupID: Ptr("1"), + GroupName: Ptr("n"), + GroupDescription: Ptr("d"), }, }, } @@ -1430,9 +1430,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsByID(t *testing.T) { input := IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("1"), - GroupName: String("n"), - GroupDescription: String("d"), + GroupID: Ptr("1"), + GroupName: Ptr("n"), + GroupDescription: Ptr("d"), }, }, } @@ -1446,9 +1446,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsByID(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("1"), - GroupName: String("n"), - GroupDescription: String("d"), + GroupID: Ptr("1"), + GroupName: Ptr("n"), + GroupDescription: Ptr("d"), }, }, } @@ -1483,9 +1483,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsBySlug(t *testing.T) { input := IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("1"), - GroupName: String("n"), - GroupDescription: String("d"), + GroupID: Ptr("1"), + GroupName: Ptr("n"), + GroupDescription: Ptr("d"), }, }, } @@ -1499,9 +1499,9 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsBySlug(t *testing.T) { want := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("1"), - GroupName: String("n"), - GroupDescription: String("d"), + GroupID: Ptr("1"), + GroupName: Ptr("n"), + GroupDescription: Ptr("d"), }, }, } @@ -1583,14 +1583,14 @@ func TestNewTeam_Marshal(t *testing.T) { u := &NewTeam{ Name: "n", - Description: String("d"), + Description: Ptr("d"), Maintainers: []string{"m1", "m2"}, RepoNames: []string{"repo1", "repo2"}, - NotificationSetting: String("notifications_enabled"), - ParentTeamID: Int64(1), - Permission: String("perm"), - Privacy: String("p"), - LDAPDN: String("l"), + NotificationSetting: Ptr("notifications_enabled"), + ParentTeamID: Ptr(int64(1)), + Permission: Ptr("perm"), + Privacy: Ptr("p"), + LDAPDN: Ptr("l"), } want := `{ @@ -1613,43 +1613,43 @@ func TestTeams_Marshal(t *testing.T) { testJSONMarshal(t, &Team{}, "{}") u := &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), - MembersURL: String("m"), - RepositoriesURL: String("r"), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), + MembersURL: Ptr("m"), + RepositoriesURL: Ptr("r"), Organization: &Organization{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - AvatarURL: String("a"), - HTMLURL: String("h"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), + 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"), }, Parent: &Team{ - ID: Int64(1), - NodeID: String("n"), - Name: String("n"), - Description: String("d"), - URL: String("u"), - Slug: String("s"), - Permission: String("p"), - Privacy: String("p"), - MembersCount: Int(1), - ReposCount: Int(1), + ID: Ptr(int64(1)), + NodeID: Ptr("n"), + Name: Ptr("n"), + Description: Ptr("d"), + URL: Ptr("u"), + Slug: Ptr("s"), + Permission: Ptr("p"), + Privacy: Ptr("p"), + MembersCount: Ptr(1), + ReposCount: Ptr(1), }, - LDAPDN: String("l"), + LDAPDN: Ptr("l"), } want := `{ @@ -1700,14 +1700,14 @@ func TestInvitation_Marshal(t *testing.T) { testJSONMarshal(t, &Invitation{}, "{}") u := &Invitation{ - ID: Int64(1), - NodeID: String("test node"), - Login: String("login123"), - Email: String("go@github.com"), - Role: String("developer"), + ID: Ptr(int64(1)), + NodeID: Ptr("test node"), + Login: Ptr("login123"), + Email: Ptr("go@github.com"), + Role: Ptr("developer"), CreatedAt: &Timestamp{referenceTime}, - TeamCount: Int(99), - InvitationTeamURL: String("url"), + TeamCount: Ptr(99), + InvitationTeamURL: Ptr("url"), } want := `{ @@ -1729,9 +1729,9 @@ func TestIDPGroup_Marshal(t *testing.T) { testJSONMarshal(t, &IDPGroup{}, "{}") u := &IDPGroup{ - GroupID: String("abc1"), - GroupName: String("test group"), - GroupDescription: String("test group description"), + GroupID: Ptr("abc1"), + GroupName: Ptr("test group"), + GroupDescription: Ptr("test group description"), } want := `{ @@ -1787,31 +1787,31 @@ func TestTeamsService_GetExternalGroup(t *testing.T) { } want := &ExternalGroup{ - GroupID: Int64(123), - GroupName: String("Octocat admins"), + GroupID: Ptr(int64(123)), + GroupName: Ptr("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, Teams: []*ExternalGroupTeam{ { - TeamID: Int64(1), - TeamName: String("team-test"), + TeamID: Ptr(int64(1)), + TeamName: Ptr("team-test"), }, { - TeamID: Int64(2), - TeamName: String("team-test2"), + TeamID: Ptr(int64(2)), + TeamName: Ptr("team-test2"), }, }, Members: []*ExternalGroupMember{ { - MemberID: Int64(1), - MemberLogin: String("mona-lisa_eocsaxrs"), - MemberName: String("Mona Lisa"), - MemberEmail: String("mona_lisa@github.com"), + MemberID: Ptr(int64(1)), + MemberLogin: Ptr("mona-lisa_eocsaxrs"), + MemberName: Ptr("Mona Lisa"), + MemberEmail: Ptr("mona_lisa@github.com"), }, { - MemberID: Int64(2), - MemberLogin: String("octo-lisa_eocsaxrs"), - MemberName: String("Octo Lisa"), - MemberEmail: String("octo_lisa@github.com"), + MemberID: Ptr(int64(2)), + MemberLogin: Ptr("octo-lisa_eocsaxrs"), + MemberName: Ptr("Octo Lisa"), + MemberEmail: Ptr("octo_lisa@github.com"), }, }, } @@ -1875,7 +1875,7 @@ func TestTeamsService_ListExternalGroups(t *testing.T) { ctx := context.Background() opts := &ListExternalGroupsOptions{ - DisplayName: String("Octocat"), + DisplayName: Ptr("Octocat"), } list, _, err := client.Teams.ListExternalGroups(ctx, "o", opts) if err != nil { @@ -1885,8 +1885,8 @@ func TestTeamsService_ListExternalGroups(t *testing.T) { want := &ExternalGroupList{ Groups: []*ExternalGroup{ { - GroupID: Int64(123), - GroupName: String("Octocat admins"), + GroupID: Ptr(int64(123)), + GroupName: Ptr("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, }, }, @@ -1958,8 +1958,8 @@ func TestTeamsService_ListExternalGroupsForTeamBySlug(t *testing.T) { want := &ExternalGroupList{ Groups: []*ExternalGroup{ { - GroupID: Int64(123), - GroupName: String("Octocat admins"), + GroupID: Ptr(int64(123)), + GroupName: Ptr("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, }, }, @@ -2044,7 +2044,7 @@ func TestTeamsService_UpdateConnectedExternalGroup(t *testing.T) { ctx := context.Background() body := &ExternalGroup{ - GroupID: Int64(123), + GroupID: Ptr(int64(123)), } externalGroup, _, err := client.Teams.UpdateConnectedExternalGroup(ctx, "o", "t", body) if err != nil { @@ -2052,31 +2052,31 @@ func TestTeamsService_UpdateConnectedExternalGroup(t *testing.T) { } want := &ExternalGroup{ - GroupID: Int64(123), - GroupName: String("Octocat admins"), + GroupID: Ptr(int64(123)), + GroupName: Ptr("Octocat admins"), UpdatedAt: &Timestamp{Time: referenceTime}, Teams: []*ExternalGroupTeam{ { - TeamID: Int64(1), - TeamName: String("team-test"), + TeamID: Ptr(int64(1)), + TeamName: Ptr("team-test"), }, { - TeamID: Int64(2), - TeamName: String("team-test2"), + TeamID: Ptr(int64(2)), + TeamName: Ptr("team-test2"), }, }, Members: []*ExternalGroupMember{ { - MemberID: Int64(1), - MemberLogin: String("mona-lisa_eocsaxrs"), - MemberName: String("Mona Lisa"), - MemberEmail: String("mona_lisa@github.com"), + MemberID: Ptr(int64(1)), + MemberLogin: Ptr("mona-lisa_eocsaxrs"), + MemberName: Ptr("Mona Lisa"), + MemberEmail: Ptr("mona_lisa@github.com"), }, { - MemberID: Int64(2), - MemberLogin: String("octo-lisa_eocsaxrs"), - MemberName: String("Octo Lisa"), - MemberEmail: String("octo_lisa@github.com"), + MemberID: Ptr(int64(2)), + MemberLogin: Ptr("octo-lisa_eocsaxrs"), + MemberName: Ptr("Octo Lisa"), + MemberEmail: Ptr("octo_lisa@github.com"), }, }, } @@ -2110,7 +2110,7 @@ func TestTeamsService_UpdateConnectedExternalGroup_notFound(t *testing.T) { ctx := context.Background() body := &ExternalGroup{ - GroupID: Int64(123), + GroupID: Ptr(int64(123)), } eg, resp, err := client.Teams.UpdateConnectedExternalGroup(ctx, "o", "t", body) if err == nil { @@ -2176,14 +2176,14 @@ func TestIDPGroupList_Marshal(t *testing.T) { u := &IDPGroupList{ Groups: []*IDPGroup{ { - GroupID: String("abc1"), - GroupName: String("test group"), - GroupDescription: String("test group description"), + GroupID: Ptr("abc1"), + GroupName: Ptr("test group"), + GroupDescription: Ptr("test group description"), }, { - GroupID: String("abc2"), - GroupName: String("test group2"), - GroupDescription: String("test group description2"), + GroupID: Ptr("abc2"), + GroupName: Ptr("test group2"), + GroupDescription: Ptr("test group description2"), }, }, } @@ -2211,10 +2211,10 @@ func TestExternalGroupMember_Marshal(t *testing.T) { testJSONMarshal(t, &ExternalGroupMember{}, "{}") u := &ExternalGroupMember{ - MemberID: Int64(1), - MemberLogin: String("test member"), - MemberName: String("test member name"), - MemberEmail: String("test member email"), + MemberID: Ptr(int64(1)), + MemberLogin: Ptr("test member"), + MemberName: Ptr("test member name"), + MemberEmail: Ptr("test member email"), } want := `{ @@ -2232,25 +2232,25 @@ func TestExternalGroup_Marshal(t *testing.T) { testJSONMarshal(t, &ExternalGroup{}, "{}") u := &ExternalGroup{ - GroupID: Int64(123), - GroupName: String("group1"), + GroupID: Ptr(int64(123)), + GroupName: Ptr("group1"), UpdatedAt: &Timestamp{referenceTime}, Teams: []*ExternalGroupTeam{ { - TeamID: Int64(1), - TeamName: String("team-test"), + TeamID: Ptr(int64(1)), + TeamName: Ptr("team-test"), }, { - TeamID: Int64(2), - TeamName: String("team-test2"), + TeamID: Ptr(int64(2)), + TeamName: Ptr("team-test2"), }, }, Members: []*ExternalGroupMember{ { - MemberID: Int64(1), - MemberLogin: String("test"), - MemberName: String("test"), - MemberEmail: String("test@github.com"), + MemberID: Ptr(int64(1)), + MemberLogin: Ptr("test"), + MemberName: Ptr("test"), + MemberEmail: Ptr("test@github.com"), }, }, } @@ -2287,8 +2287,8 @@ func TestExternalGroupTeam_Marshal(t *testing.T) { testJSONMarshal(t, &ExternalGroupTeam{}, "{}") u := &ExternalGroupTeam{ - TeamID: Int64(123), - TeamName: String("test"), + TeamID: Ptr(int64(123)), + TeamName: Ptr("test"), } want := `{ @@ -2304,7 +2304,7 @@ func TestListExternalGroupsOptions_Marshal(t *testing.T) { testJSONMarshal(t, &ListExternalGroupsOptions{}, "{}") u := &ListExternalGroupsOptions{ - DisplayName: String("test"), + DisplayName: Ptr("test"), ListOptions: ListOptions{ Page: 1, PerPage: 2, diff --git a/github/users_administration_test.go b/github/users_administration_test.go index 52270dadc62..8ddf0865335 100644 --- a/github/users_administration_test.go +++ b/github/users_administration_test.go @@ -96,7 +96,7 @@ func TestUsersServiceReason_Suspend(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &UserSuspendOptions{Reason: String("test")} + input := &UserSuspendOptions{Reason: Ptr("test")} mux.HandleFunc("/users/u/suspended", func(w http.ResponseWriter, r *http.Request) { v := new(UserSuspendOptions) @@ -148,7 +148,7 @@ func TestUserSuspendOptions_Marshal(t *testing.T) { testJSONMarshal(t, &UserSuspendOptions{}, "{}") u := &UserSuspendOptions{ - Reason: String("reason"), + Reason: Ptr("reason"), } want := `{ diff --git a/github/users_blocking_test.go b/github/users_blocking_test.go index ca7fd97da5b..e9625cc27ff 100644 --- a/github/users_blocking_test.go +++ b/github/users_blocking_test.go @@ -34,7 +34,7 @@ func TestUsersService_ListBlockedUsers(t *testing.T) { t.Errorf("Users.ListBlockedUsers returned error: %v", err) } - want := []*User{{Login: String("octocat")}} + want := []*User{{Login: Ptr("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 bf3a403526f..6c1c73f3ef9 100644 --- a/github/users_emails_test.go +++ b/github/users_emails_test.go @@ -36,7 +36,7 @@ func TestUsersService_ListEmails(t *testing.T) { t.Errorf("Users.ListEmails returned error: %v", err) } - want := []*UserEmail{{Email: String("user@example.com"), Verified: Bool(false), Primary: Bool(true)}} + want := []*UserEmail{{Email: Ptr("user@example.com"), Verified: Ptr(false), Primary: Ptr(true)}} if !cmp.Equal(emails, want) { t.Errorf("Users.ListEmails returned %+v, want %+v", emails, want) } @@ -76,8 +76,8 @@ func TestUsersService_AddEmails(t *testing.T) { } want := []*UserEmail{ - {Email: String("old@example.com")}, - {Email: String("new@example.com")}, + {Email: Ptr("old@example.com")}, + {Email: Ptr("new@example.com")}, } if !cmp.Equal(emails, want) { t.Errorf("Users.AddEmails returned %+v, want %+v", emails, want) @@ -126,10 +126,10 @@ func TestUserEmail_Marshal(t *testing.T) { testJSONMarshal(t, &UserEmail{}, "{}") u := &UserEmail{ - Email: String("qwe@qwe.qwe"), - Primary: Bool(false), - Verified: Bool(true), - Visibility: String("yes"), + Email: Ptr("qwe@qwe.qwe"), + Primary: Ptr(false), + Verified: Ptr(true), + Visibility: Ptr("yes"), } want := `{ @@ -146,7 +146,7 @@ func TestUsersService_SetEmailVisibility(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &UserEmail{Visibility: String("private")} + input := &UserEmail{Visibility: Ptr("private")} mux.HandleFunc("/user/email/visibility", func(w http.ResponseWriter, r *http.Request) { v := new(UserEmail) @@ -171,7 +171,7 @@ func TestUsersService_SetEmailVisibility(t *testing.T) { t.Errorf("Users.SetEmailVisibility returned error: %v", err) } - want := []*UserEmail{{Email: String("user@example.com"), Verified: Bool(false), Primary: Bool(true), Visibility: String("private")}} + want := []*UserEmail{{Email: Ptr("user@example.com"), Verified: Ptr(false), Primary: Ptr(true), Visibility: Ptr("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 790739512b4..1ffe5d7c70e 100644 --- a/github/users_followers_test.go +++ b/github/users_followers_test.go @@ -31,7 +31,7 @@ func TestUsersService_ListFollowers_authenticatedUser(t *testing.T) { t.Errorf("Users.ListFollowers returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListFollowers returned %+v, want %+v", users, want) } @@ -66,7 +66,7 @@ func TestUsersService_ListFollowers_specifiedUser(t *testing.T) { t.Errorf("Users.ListFollowers returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListFollowers returned %+v, want %+v", users, want) } @@ -112,7 +112,7 @@ func TestUsersService_ListFollowing_authenticatedUser(t *testing.T) { t.Errorf("Users.ListFollowing returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(int64(1))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListFollowing returned %+v, want %+v", users, want) } @@ -147,7 +147,7 @@ func TestUsersService_ListFollowing_specifiedUser(t *testing.T) { t.Errorf("Users.ListFollowing returned error: %v", err) } - want := []*User{{ID: Int64(1)}} + want := []*User{{ID: Ptr(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 1d04f758e17..585ea4c6dbd 100644 --- a/github/users_gpg_keys_test.go +++ b/github/users_gpg_keys_test.go @@ -32,7 +32,7 @@ func TestUsersService_ListGPGKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListGPGKeys returned error: %v", err) } - want := []*GPGKey{{ID: Int64(1), PrimaryKeyID: Int64(2)}} + want := []*GPGKey{{ID: Ptr(int64(1)), PrimaryKeyID: Ptr(int64(2))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListGPGKeys = %+v, want %+v", keys, want) } @@ -67,7 +67,7 @@ func TestUsersService_ListGPGKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListGPGKeys returned error: %v", err) } - want := []*GPGKey{{ID: Int64(1), PrimaryKeyID: Int64(2)}} + want := []*GPGKey{{ID: Ptr(int64(1)), PrimaryKeyID: Ptr(int64(2))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListGPGKeys = %+v, want %+v", keys, want) } @@ -97,7 +97,7 @@ func TestUsersService_GetGPGKey(t *testing.T) { t.Errorf("Users.GetGPGKey returned error: %v", err) } - want := &GPGKey{ID: Int64(1)} + want := &GPGKey{ID: Ptr(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.GetGPGKey = %+v, want %+v", key, want) } @@ -150,7 +150,7 @@ mQINBFcEd9kBEACo54TDbGhKlXKWMvJgecEUKPPcv7XdnpKdGb3LRw5MvFwT0V0f t.Errorf("Users.GetGPGKey returned error: %v", err) } - want := &GPGKey{ID: Int64(1)} + want := &GPGKey{ID: Ptr(int64(1))} if !cmp.Equal(gpgKey, want) { t.Errorf("Users.GetGPGKey = %+v, want %+v", gpgKey, want) } @@ -195,8 +195,8 @@ func TestGPGEmail_Marshal(t *testing.T) { testJSONMarshal(t, &GPGEmail{}, "{}") u := &GPGEmail{ - Email: String("email@abc.com"), - Verified: Bool(false), + Email: Ptr("email@abc.com"), + Verified: Ptr(false), } want := `{ @@ -214,24 +214,24 @@ func TestGPGKey_Marshal(t *testing.T) { ti := &Timestamp{} g := &GPGKey{ - ID: Int64(1), - PrimaryKeyID: Int64(1), - KeyID: String("someKeyID"), - RawKey: String("someRawKeyID"), - PublicKey: String("somePublicKey"), + ID: Ptr(int64(1)), + PrimaryKeyID: Ptr(int64(1)), + KeyID: Ptr("someKeyID"), + RawKey: Ptr("someRawKeyID"), + PublicKey: Ptr("somePublicKey"), Emails: []*GPGEmail{ { - Email: String("someEmail"), - Verified: Bool(true), + Email: Ptr("someEmail"), + Verified: Ptr(true), }, }, Subkeys: []*GPGKey{ {}, }, - CanSign: Bool(true), - CanEncryptComms: Bool(true), - CanEncryptStorage: Bool(true), - CanCertify: Bool(true), + CanSign: Ptr(true), + CanEncryptComms: Ptr(true), + CanEncryptStorage: Ptr(true), + CanCertify: Ptr(true), CreatedAt: ti, ExpiresAt: ti, } diff --git a/github/users_keys_test.go b/github/users_keys_test.go index 15553f52f35..59167a34778 100644 --- a/github/users_keys_test.go +++ b/github/users_keys_test.go @@ -32,7 +32,7 @@ func TestUsersService_ListKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListKeys returned error: %v", err) } - want := []*Key{{ID: Int64(1)}} + want := []*Key{{ID: Ptr(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListKeys returned %+v, want %+v", keys, want) } @@ -67,7 +67,7 @@ func TestUsersService_ListKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListKeys returned error: %v", err) } - want := []*Key{{ID: Int64(1)}} + want := []*Key{{ID: Ptr(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListKeys returned %+v, want %+v", keys, want) } @@ -97,7 +97,7 @@ func TestUsersService_GetKey(t *testing.T) { t.Errorf("Users.GetKey returned error: %v", err) } - want := &Key{ID: Int64(1)} + want := &Key{ID: Ptr(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.GetKey returned %+v, want %+v", key, want) } @@ -121,7 +121,7 @@ func TestUsersService_CreateKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Key{Key: String("k"), Title: String("t")} + input := &Key{Key: Ptr("k"), Title: Ptr("t")} mux.HandleFunc("/user/keys", func(w http.ResponseWriter, r *http.Request) { v := new(Key) @@ -141,7 +141,7 @@ func TestUsersService_CreateKey(t *testing.T) { t.Errorf("Users.CreateKey returned error: %v", err) } - want := &Key{ID: Int64(1)} + want := &Key{ID: Ptr(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.CreateKey returned %+v, want %+v", key, want) } @@ -186,12 +186,12 @@ func TestKey_Marshal(t *testing.T) { testJSONMarshal(t, &Key{}, "{}") u := &Key{ - ID: Int64(1), - Key: String("abc"), - URL: String("url"), - Title: String("title"), - ReadOnly: Bool(true), - Verified: Bool(true), + ID: Ptr(int64(1)), + Key: Ptr("abc"), + URL: Ptr("url"), + Title: Ptr("title"), + ReadOnly: Ptr(true), + Verified: Ptr(true), CreatedAt: &Timestamp{referenceTime}, } diff --git a/github/users_packages_test.go b/github/users_packages_test.go index 2b34b51c6eb..3d1cffff569 100644 --- a/github/users_packages_test.go +++ b/github/users_packages_test.go @@ -35,19 +35,19 @@ func TestUsersService_Authenticated_ListPackages(t *testing.T) { }) ctx := context.Background() - packages, _, err := client.Users.ListPackages(ctx, "", &PackageListOptions{PackageType: String("container"), Visibility: String("private")}) + packages, _, err := client.Users.ListPackages(ctx, "", &PackageListOptions{PackageType: Ptr("container"), Visibility: Ptr("private")}) if err != nil { t.Errorf("Users.Authenticated_ListPackages returned error: %v", err) } want := []*Package{{ - ID: Int64(197), - Name: String("hello_docker"), - PackageType: String("container"), - VersionCount: Int64(1), - Visibility: String("private"), - URL: String("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }} @@ -91,19 +91,19 @@ func TestUsersService_specifiedUser_ListPackages(t *testing.T) { }) ctx := context.Background() - packages, _, err := client.Users.ListPackages(ctx, "u", &PackageListOptions{PackageType: String("container"), Visibility: String("public")}) + packages, _, err := client.Users.ListPackages(ctx, "u", &PackageListOptions{PackageType: Ptr("container"), Visibility: Ptr("public")}) if err != nil { t.Errorf("Users.specifiedUser_ListPackages returned error: %v", err) } want := []*Package{{ - ID: Int64(197), - Name: String("hello_docker"), - PackageType: String("container"), - VersionCount: Int64(1), - Visibility: String("public"), - URL: String("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }} @@ -152,13 +152,13 @@ func TestUsersService_specifiedUser_GetPackage(t *testing.T) { } want := &Package{ - ID: Int64(197), - Name: String("hello_docker"), - PackageType: String("container"), - VersionCount: Int64(1), - Visibility: String("private"), - URL: String("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -207,13 +207,13 @@ func TestUsersService_Authenticated_GetPackage(t *testing.T) { } want := &Package{ - ID: Int64(197), - Name: String("hello_docker"), - PackageType: String("container"), - VersionCount: Int64(1), - Visibility: String("private"), - URL: String("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -364,7 +364,7 @@ func TestUsersService_Authenticated_ListPackagesVersions(t *testing.T) { ctx := context.Background() opts := &PackageListOptions{ - String("internal"), String("container"), String("deleted"), ListOptions{Page: 1, PerPage: 2}, + Ptr("internal"), Ptr("container"), Ptr("deleted"), ListOptions{Page: 1, PerPage: 2}, } packages, _, err := client.Users.PackageGetAllVersions(ctx, "", "container", "hello_docker", opts) if err != nil { @@ -372,15 +372,15 @@ func TestUsersService_Authenticated_ListPackagesVersions(t *testing.T) { } want := []*PackageVersion{{ - ID: Int64(45763), - Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: &PackageMetadata{ - PackageType: String("container"), + PackageType: Ptr("container"), Container: &PackageContainerMetadata{ Tags: []string{"latest"}, }, @@ -433,7 +433,7 @@ func TestUsersService_specifiedUser_ListPackagesVersions(t *testing.T) { ctx := context.Background() opts := &PackageListOptions{ - String("internal"), String("container"), String("deleted"), ListOptions{Page: 1, PerPage: 2}, + Ptr("internal"), Ptr("container"), Ptr("deleted"), ListOptions{Page: 1, PerPage: 2}, } packages, _, err := client.Users.PackageGetAllVersions(ctx, "u", "container", "hello_docker", opts) if err != nil { @@ -441,15 +441,15 @@ func TestUsersService_specifiedUser_ListPackagesVersions(t *testing.T) { } want := []*PackageVersion{{ - ID: Int64(45763), - Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: &PackageMetadata{ - PackageType: String("container"), + PackageType: Ptr("container"), Container: &PackageContainerMetadata{ Tags: []string{"latest"}, }, @@ -507,15 +507,15 @@ func TestUsersService_Authenticated_PackageGetVersion(t *testing.T) { } want := &PackageVersion{ - ID: Int64(45763), - Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: &PackageMetadata{ - PackageType: String("container"), + PackageType: Ptr("container"), Container: &PackageContainerMetadata{ Tags: []string{"latest"}, }, @@ -573,15 +573,15 @@ func TestUsersService_specifiedUser_PackageGetVersion(t *testing.T) { } want := &PackageVersion{ - ID: Int64(45763), - Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello_docker"), + 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"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: Ptr("https://github.com/users/octocat/packages/container/hello_docker/45763"), Metadata: &PackageMetadata{ - PackageType: String("container"), + PackageType: Ptr("container"), Container: &PackageContainerMetadata{ Tags: []string{"latest"}, }, diff --git a/github/users_projects_test.go b/github/users_projects_test.go index 8514301d1f5..215dc3ec98f 100644 --- a/github/users_projects_test.go +++ b/github/users_projects_test.go @@ -33,7 +33,7 @@ func TestUsersService_ListProjects(t *testing.T) { t.Errorf("Users.ListProjects returned error: %v", err) } - want := []*Project{{ID: Int64(1)}} + want := []*Project{{ID: Ptr(int64(1))}} if !cmp.Equal(projects, want) { t.Errorf("Users.ListProjects returned %+v, want %+v", projects, want) } @@ -57,7 +57,7 @@ func TestUsersService_CreateProject(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &CreateUserProjectOptions{Name: "Project Name", Body: String("Project body.")} + input := &CreateUserProjectOptions{Name: "Project Name", Body: Ptr("Project body.")} mux.HandleFunc("/user/projects", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") @@ -78,7 +78,7 @@ func TestUsersService_CreateProject(t *testing.T) { t.Errorf("Users.CreateProject returned error: %v", err) } - want := &Project{ID: Int64(1)} + want := &Project{ID: Ptr(int64(1))} if !cmp.Equal(project, want) { t.Errorf("Users.CreateProject returned %+v, want %+v", project, want) } @@ -99,7 +99,7 @@ func TestCreateUserProjectOptions_Marshal(t *testing.T) { c := CreateUserProjectOptions{ Name: "SomeProject", - Body: String("SomeProjectBody"), + Body: Ptr("SomeProjectBody"), } want := `{ diff --git a/github/users_ssh_signing_keys_test.go b/github/users_ssh_signing_keys_test.go index d5c15ee34ee..56c082fdb8a 100644 --- a/github/users_ssh_signing_keys_test.go +++ b/github/users_ssh_signing_keys_test.go @@ -32,7 +32,7 @@ func TestUsersService_ListSSHSigningKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListSSHSigningKeys returned error: %v", err) } - want := []*SSHSigningKey{{ID: Int64(1)}} + want := []*SSHSigningKey{{ID: Ptr(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListSSHSigningKeys returned %+v, want %+v", keys, want) } @@ -67,7 +67,7 @@ func TestUsersService_ListSSHSigningKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListSSHSigningKeys returned error: %v", err) } - want := []*SSHSigningKey{{ID: Int64(1)}} + want := []*SSHSigningKey{{ID: Ptr(int64(1))}} if !cmp.Equal(keys, want) { t.Errorf("Users.ListSSHSigningKeys returned %+v, want %+v", keys, want) } @@ -97,7 +97,7 @@ func TestUsersService_GetSSHSigningKey(t *testing.T) { t.Errorf("Users.GetSSHSigningKey returned error: %v", err) } - want := &SSHSigningKey{ID: Int64(1)} + want := &SSHSigningKey{ID: Ptr(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.GetSSHSigningKey returned %+v, want %+v", key, want) } @@ -121,7 +121,7 @@ func TestUsersService_CreateSSHSigningKey(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &Key{Key: String("k"), Title: String("t")} + input := &Key{Key: Ptr("k"), Title: Ptr("t")} mux.HandleFunc("/user/ssh_signing_keys", func(w http.ResponseWriter, r *http.Request) { v := new(Key) @@ -141,7 +141,7 @@ func TestUsersService_CreateSSHSigningKey(t *testing.T) { t.Errorf("Users.CreateSSHSigningKey returned error: %v", err) } - want := &SSHSigningKey{ID: Int64(1)} + want := &SSHSigningKey{ID: Ptr(int64(1))} if !cmp.Equal(key, want) { t.Errorf("Users.CreateSSHSigningKey returned %+v, want %+v", key, want) } @@ -186,9 +186,9 @@ func TestSSHSigningKey_Marshal(t *testing.T) { testJSONMarshal(t, &SSHSigningKey{}, "{}") u := &Key{ - ID: Int64(1), - Key: String("abc"), - Title: String("title"), + ID: Ptr(int64(1)), + Key: Ptr("abc"), + Title: Ptr("title"), CreatedAt: &Timestamp{referenceTime}, } diff --git a/github/users_test.go b/github/users_test.go index 0e0137a65aa..96332b15567 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -20,22 +20,22 @@ func TestUser_Marshal(t *testing.T) { testJSONMarshal(t, &User{}, "{}") u := &User{ - Login: String("l"), - ID: Int64(1), - URL: String("u"), - AvatarURL: String("a"), - GravatarID: String("g"), - Name: String("n"), - Company: String("c"), - Blog: String("b"), - Location: String("l"), - Email: String("e"), - Hireable: Bool(true), - Bio: String("b"), - TwitterUsername: String("t"), - PublicRepos: Int(1), - Followers: Int(1), - Following: Int(1), + Login: Ptr("l"), + ID: Ptr(int64(1)), + URL: Ptr("u"), + AvatarURL: Ptr("a"), + GravatarID: Ptr("g"), + Name: Ptr("n"), + Company: Ptr("c"), + Blog: Ptr("b"), + Location: Ptr("l"), + Email: Ptr("e"), + Hireable: Ptr(true), + Bio: Ptr("b"), + TwitterUsername: Ptr("t"), + PublicRepos: Ptr(1), + Followers: Ptr(1), + Following: Ptr(1), CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, } @@ -62,44 +62,44 @@ func TestUser_Marshal(t *testing.T) { testJSONMarshal(t, u, want) u2 := &User{ - Login: String("testLogin"), - ID: Int64(1), - NodeID: String("testNode123"), - AvatarURL: String("https://www.my-avatar.com"), - HTMLURL: String("https://www.test-url.com"), - GravatarID: String("testGravatar123"), - Name: String("myName"), - Company: String("testCompany"), - Blog: String("test Blog"), - Location: String("test location"), - Email: String("test@test.com"), - Hireable: Bool(true), - Bio: String("my good bio"), - TwitterUsername: String("https://www.twitter.com/test"), - PublicRepos: Int(1), - PublicGists: Int(2), - Followers: Int(100), - Following: Int(29), + Login: Ptr("testLogin"), + ID: Ptr(int64(1)), + NodeID: Ptr("testNode123"), + AvatarURL: Ptr("https://www.my-avatar.com"), + HTMLURL: Ptr("https://www.test-url.com"), + GravatarID: Ptr("testGravatar123"), + Name: Ptr("myName"), + Company: Ptr("testCompany"), + Blog: Ptr("test Blog"), + Location: Ptr("test location"), + Email: Ptr("test@test.com"), + Hireable: Ptr(true), + Bio: Ptr("my good bio"), + TwitterUsername: Ptr("https://www.twitter.com/test"), + PublicRepos: Ptr(1), + PublicGists: Ptr(2), + Followers: Ptr(100), + Following: Ptr(29), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, - Type: String("test type"), - SiteAdmin: Bool(false), - TotalPrivateRepos: Int64(2), - OwnedPrivateRepos: Int64(1), - PrivateGists: Int(1), - DiskUsage: Int(1), - Collaborators: Int(1), - TwoFactorAuthentication: Bool(false), + Type: Ptr("test type"), + SiteAdmin: Ptr(false), + TotalPrivateRepos: Ptr(int64(2)), + OwnedPrivateRepos: Ptr(int64(1)), + PrivateGists: Ptr(1), + DiskUsage: Ptr(1), + Collaborators: Ptr(1), + TwoFactorAuthentication: Ptr(false), Plan: &Plan{ - Name: String("silver"), - Space: Int(1024), - Collaborators: Int(10), - PrivateRepos: Int64(4), - FilledSeats: Int(24), - Seats: Int(1), + Name: Ptr("silver"), + Space: Ptr(1024), + Collaborators: Ptr(10), + PrivateRepos: Ptr(int64(4)), + FilledSeats: Ptr(24), + Seats: Ptr(1), }, - LdapDn: String("test ldap"), + LdapDn: Ptr("test ldap"), } want2 := `{ @@ -160,7 +160,7 @@ func TestUsersService_Get_authenticatedUser(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := &User{ID: Int64(1)} + want := &User{ID: Ptr(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.Get returned %+v, want %+v", user, want) } @@ -195,7 +195,7 @@ func TestUsersService_Get_specifiedUser(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := &User{ID: Int64(1)} + want := &User{ID: Ptr(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.Get returned %+v, want %+v", user, want) } @@ -225,7 +225,7 @@ func TestUsersService_GetByID(t *testing.T) { t.Fatalf("Users.GetByID returned error: %v", err) } - want := &User{ID: Int64(1)} + want := &User{ID: Ptr(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.GetByID returned %+v, want %+v", user, want) } @@ -249,7 +249,7 @@ func TestUsersService_Edit(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &User{Name: String("n")} + input := &User{Name: Ptr("n")} mux.HandleFunc("/user", func(w http.ResponseWriter, r *http.Request) { v := new(User) @@ -269,7 +269,7 @@ func TestUsersService_Edit(t *testing.T) { t.Errorf("Users.Edit returned error: %v", err) } - want := &User{ID: Int64(1)} + want := &User{ID: Ptr(int64(1))} if !cmp.Equal(user, want) { t.Errorf("Users.Edit returned %+v, want %+v", user, want) } @@ -301,7 +301,7 @@ func TestUsersService_GetHovercard(t *testing.T) { t.Errorf("Users.GetHovercard returned error: %v", err) } - want := &Hovercard{Contexts: []*UserContext{{Message: String("Owns this repository"), Octicon: String("repo")}}} + want := &Hovercard{Contexts: []*UserContext{{Message: Ptr("Owns this repository"), Octicon: Ptr("repo")}}} if !cmp.Equal(hovercard, want) { t.Errorf("Users.GetHovercard returned %+v, want %+v", hovercard, want) } @@ -338,7 +338,7 @@ func TestUsersService_ListAll(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := []*User{{ID: Int64(2)}} + want := []*User{{ID: Ptr(int64(2))}} if !cmp.Equal(users, want) { t.Errorf("Users.ListAll returned %+v, want %+v", users, want) } @@ -368,7 +368,7 @@ func TestUsersService_ListInvitations(t *testing.T) { t.Errorf("Users.ListInvitations returned error: %v", err) } - want := []*RepositoryInvitation{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*RepositoryInvitation{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(got, want) { t.Errorf("Users.ListInvitations = %+v, want %+v", got, want) } @@ -457,8 +457,8 @@ func TestUserContext_Marshal(t *testing.T) { testJSONMarshal(t, &UserContext{}, "{}") u := &UserContext{ - Message: String("message"), - Octicon: String("message"), + Message: Ptr("message"), + Octicon: Ptr("message"), } want := `{ @@ -476,8 +476,8 @@ func TestHovercard_Marshal(t *testing.T) { h := &Hovercard{ Contexts: []*UserContext{ { - Message: String("someMessage"), - Octicon: String("someOcticon"), + Message: Ptr("someMessage"), + Octicon: Ptr("someOcticon"), }, }, } diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index 09b2601d571..f54c98bd9fd 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -93,7 +93,7 @@ func deleteSubscription(t *testing.T) { func createSubscription(t *testing.T) { // watch the target repository - sub := &github.Subscription{Subscribed: github.Bool(true)} + sub := &github.Subscription{Subscribed: github.Ptr(true)} _, _, err := client.Activity.SetRepositorySubscription(context.Background(), owner, repo, sub) if err != nil { t.Fatalf("Activity.SetRepositorySubscription returned error: %v", err) diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 48745706002..cc816a40f57 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -76,8 +76,8 @@ func createRandomTestRepository(owner string, autoinit bool) (*github.Repository context.Background(), owner, &github.Repository{ - Name: github.String(repoName), - AutoInit: github.Bool(autoinit), + Name: github.Ptr(repoName), + AutoInit: github.Ptr(autoinit), }, ) if err != nil { diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index be9cc6a0960..ebcafb6850a 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -29,7 +29,7 @@ func TestRepositories_CRUD(t *testing.T) { } // update the repository description - repo.Description = github.String("description") + repo.Description = github.Ptr("description") repo.DefaultBranch = nil // FIXME: this shouldn't be necessary _, _, err = client.Repositories.Edit(context.Background(), *repo.Owner.Login, *repo.Name, repo) if err != nil { @@ -112,9 +112,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.Bool(false), - LockBranch: github.Bool(false), - AllowForkSyncing: github.Bool(false), + BlockCreations: github.Ptr(false), + LockBranch: github.Ptr(false), + AllowForkSyncing: github.Ptr(false), } protection, _, err := client.Repositories.UpdateBranchProtection(context.Background(), *repo.Owner.Login, *repo.Name, "master", protectionRequest) @@ -132,18 +132,18 @@ func TestRepositories_EditBranches(t *testing.T) { RequiredApprovingReviewCount: 0, }, EnforceAdmins: &github.AdminEnforcement{ - URL: github.String("https://api.github.com/repos/" + *repo.Owner.Login + "/" + *repo.Name + "/branches/master/protection/enforce_admins"), + URL: github.Ptr("https://api.github.com/repos/" + *repo.Owner.Login + "/" + *repo.Name + "/branches/master/protection/enforce_admins"), Enabled: true, }, Restrictions: nil, BlockCreations: &github.BlockCreations{ - Enabled: github.Bool(false), + Enabled: github.Ptr(false), }, LockBranch: &github.LockBranch{ - Enabled: github.Bool(false), + Enabled: github.Ptr(false), }, AllowForkSyncing: &github.AllowForkSyncing{ - Enabled: github.Bool(false), + Enabled: github.Ptr(false), }, } if !cmp.Equal(protection, want) { @@ -213,9 +213,9 @@ func TestRepositories_Autolinks(t *testing.T) { } opts := &github.AutolinkOptions{ - KeyPrefix: github.String("TICKET-"), - URLTemplate: github.String("https://example.com/TICKET?query="), - IsAlphanumeric: github.Bool(false), + KeyPrefix: github.Ptr("TICKET-"), + URLTemplate: github.Ptr("https://example.com/TICKET?query="), + IsAlphanumeric: github.Ptr(false), } actionlink, _, err := client.Repositories.AddAutolink(context.Background(), *repo.Owner.Login, *repo.Name, opts) diff --git a/test/integration/users_test.go b/test/integration/users_test.go index 6d1e834ad34..76c27e2e987 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -190,8 +190,8 @@ func TestUsers_Keys(t *testing.T) { // Add new key _, _, err = client.Users.CreateKey(context.Background(), &github.Key{ - Title: github.String("go-github test key"), - Key: github.String(key), + Title: github.Ptr("go-github test key"), + Key: github.Ptr(key), }) if err != nil { t.Fatalf("Users.CreateKey() returned error: %v", err) diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 51e36b390c9..dde89967eb0 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -355,19 +355,19 @@ func newTestServer(t *testing.T, ref string, files map[string]interface{}) *http server := httptest.NewServer(mux) mux.HandleFunc( path.Join(repoPath, "commits", ref), - jsonHandler(emptyQuery, &github.RepositoryCommit{SHA: github.String("s")}), + jsonHandler(emptyQuery, &github.RepositoryCommit{SHA: github.Ptr("s")}), ) var descriptionsContent []*github.RepositoryContent for name, content := range files { descriptionsContent = append(descriptionsContent, &github.RepositoryContent{ - Name: github.String(path.Base(path.Dir(name))), + Name: github.Ptr(path.Base(path.Dir(name))), }) mux.HandleFunc( path.Join(repoPath, "contents/descriptions", path.Dir(name)), jsonHandler(refQuery, []*github.RepositoryContent{ { - Name: github.String(path.Base(name)), - DownloadURL: github.String(server.URL + "/dl/" + name), + Name: github.Ptr(path.Base(name)), + DownloadURL: github.Ptr(server.URL + "/dl/" + name), }, }), )