Thanks to visit codestin.com
Credit goes to github.com

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion github/enterprise_apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}

Expand Down
16 changes: 12 additions & 4 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 13 additions & 13 deletions github/orgs_custom_repository_roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
2 changes: 1 addition & 1 deletion github/scim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions github/sub_issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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")
Expand All @@ -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)
}
Expand Down
Loading