diff --git a/github/enterprise_apps_test.go b/github/enterprise_apps_test.go index 5b53b28d8b6..0c258002bfe 100644 --- a/github/enterprise_apps_test.go +++ b/github/enterprise_apps_test.go @@ -51,7 +51,7 @@ func TestEnterpriseService_UpdateAppInstallationRepositories(t *testing.T) { client, mux, _ := setup(t) input := UpdateAppInstallationRepositoriesOptions{ - RepositorySelection: String("selected"), + RepositorySelection: Ptr("selected"), SelectedRepositoryIDs: []int64{1, 2}, } diff --git a/github/github.go b/github/github.go index 316ff8010de..93ef56b8f1d 100644 --- a/github/github.go +++ b/github/github.go @@ -1791,25 +1791,33 @@ func Ptr[T any](v T) *T { // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Bool(v bool) *bool { return &v } +// +//go:fix inline +func Bool(v bool) *bool { return Ptr(v) } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Int(v int) *int { return &v } +// +//go:fix inline +func Int(v int) *int { return Ptr(v) } // Int64 is a helper routine that allocates a new int64 value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Int64(v int64) *int64 { return &v } +// +//go:fix inline +func Int64(v int64) *int64 { return Ptr(v) } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func String(v string) *string { return &v } +// +//go:fix inline +func String(v string) *string { return Ptr(v) } // roundTripperFunc creates a RoundTripper (transport). type roundTripperFunc func(*http.Request) (*http.Response, error) diff --git a/github/orgs_custom_repository_roles_test.go b/github/orgs_custom_repository_roles_test.go index 94acfcdca87..a091a22fb73 100644 --- a/github/orgs_custom_repository_roles_test.go +++ b/github/orgs_custom_repository_roles_test.go @@ -130,21 +130,21 @@ func TestOrganizationsService_GetCustomRepoRole(t *testing.T) { } want := &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)}, diff --git a/github/scim_test.go b/github/scim_test.go index 3b092427ccd..985fcb5f2f2 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -491,7 +491,7 @@ func TestSCIMUserRole_Marshal(t *testing.T) { testJSONMarshal(t, &SCIMUserRole{ Value: "enterprise_owner", - Primary: Bool(true), + Primary: Ptr(true), }, `{ "value": "enterprise_owner", "primary": true diff --git a/github/sub_issue_test.go b/github/sub_issue_test.go index 5d179161fbd..9c9eff482ae 100644 --- a/github/sub_issue_test.go +++ b/github/sub_issue_test.go @@ -38,7 +38,7 @@ func TestSubIssuesService_Add(t *testing.T) { t.Errorf("SubIssues.Add returned error: %v", err) } - want := &SubIssue{Number: Ptr(1), ID: Int64(42)} + want := &SubIssue{Number: Ptr(1), ID: Ptr(int64(42))} if !cmp.Equal(got, want) { t.Errorf("SubIssues.Add = %+v, want %+v", got, want) } @@ -77,7 +77,7 @@ func TestSubIssuesService_ListByIssue(t *testing.T) { t.Errorf("SubIssues.ListByIssue returned error: %v", err) } - want := []*SubIssue{{ID: Int64(1)}, {ID: Int64(2)}} + want := []*SubIssue{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} if !cmp.Equal(issues, want) { t.Errorf("SubIssues.ListByIssue = %+v, want %+v", issues, want) } @@ -121,7 +121,7 @@ func TestSubIssuesService_Remove(t *testing.T) { t.Errorf("SubIssues.Remove returned error: %v", err) } - want := &SubIssue{ID: Int64(42), Number: Ptr(1)} + want := &SubIssue{ID: Ptr(int64(42)), Number: Ptr(1)} if !cmp.Equal(got, want) { t.Errorf("SubIssues.Remove = %+v, want %+v", got, want) } @@ -140,7 +140,7 @@ func TestSubIssuesService_Reprioritize(t *testing.T) { t.Parallel() client, mux, _ := setup(t) - input := &SubIssueRequest{SubIssueID: 42, AfterID: Int64(5)} + input := &SubIssueRequest{SubIssueID: 42, AfterID: Ptr(int64(5))} mux.HandleFunc("/repos/o/r/issues/1/sub_issues/priority", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -162,7 +162,7 @@ func TestSubIssuesService_Reprioritize(t *testing.T) { t.Errorf("SubIssues.Reprioritize returned error: %v", err) } - want := &SubIssue{ID: Int64(42), Number: Ptr(1)} + want := &SubIssue{ID: Ptr(int64(42)), Number: Ptr(1)} if !cmp.Equal(got, want) { t.Errorf("SubIssues.Reprioritize = %+v, want %+v", got, want) }