Repository: google/go-github
Pull request #1443 (2020-02-28 00:35:27)

Add pointers to structs in slices
Since we decided in #180 to standardize using pointers to structs when they appear in slices, and some slices have slipped through code reviews without having pointers, this PR cleans these up.

Fixes: #1100. 

This is a breaking API change.


Patch:
diff --git a/example/commitpr/main.go b/example/commitpr/main.go
index 188424dc..e2ba12a4 100644
--- a/example/commitpr/main.go
+++ b/example/commitpr/main.go
@@ -87,7 +87,7 @@ func getRef() (ref *github.Reference, err error) {
 // of the ref you got in getRef.
 func getTree(ref *github.Reference) (tree *github.Tree, err error) {
 	// Create a tree with what to commit.
-	entries := []github.TreeEntry{}
+	entries := []*github.TreeEntry{}
 
 	// Load each file into the tree.
 	for _, fileArg := range strings.Split(*sourceFiles, ",") {
@@ -95,7 +95,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.String(file), Type: github.String("blob"), Content: github.String(string(content)), Mode: github.String("100644")})
 	}
 
 	tree, _, err = client.Git.CreateTree(ctx, *sourceOwner, *sourceRepo, *ref.Object.SHA, entries)
@@ -135,7 +135,7 @@ func pushCommit(ref *github.Reference, tree *github.Tree) (err error) {
 	// Create the commit using the tree.
 	date := time.Now()
 	author := &github.CommitAuthor{Date: &date, Name: authorName, Email: authorEmail}
-	commit := &github.Commit{Author: author, Message: commitMessage, Tree: tree, Parents: []github.Commit{*parent.Commit}}
+	commit := &github.Commit{Author: author, Message: commitMessage, Tree: tree, Parents: []*github.Commit{parent.Commit}}
 	newCommit, _, err := client.Git.CreateCommit(ctx, *sourceOwner, *sourceRepo, commit)
 	if err != nil {
 		return err
diff --git a/github/activity.go b/github/activity.go
index d6c992c7..f6336fcc 100644
--- a/github/activity.go
+++ b/github/activity.go
@@ -29,13 +29,13 @@ type Feeds struct {
 	CurrentUserOrganizationURL  *string  `json:"current_user_organization_url,omitempty"`
 	CurrentUserOrganizationURLs []string `json:"current_user_organization_urls,omitempty"`
 	Links                       *struct {
-		Timeline                 *FeedLink  `json:"timeline,omitempty"`
-		User                     *FeedLink  `json:"user,omitempty"`
-		CurrentUserPublic        *FeedLink  `json:"current_user_public,omitempty"`
-		CurrentUser              *FeedLink  `json:"current_user,omitempty"`
-		CurrentUserActor         *FeedLink  `json:"current_user_actor,omitempty"`
-		CurrentUserOrganization  *FeedLink  `json:"current_user_organization,omitempty"`
-		CurrentUserOrganizations []FeedLink `json:"current_user_organizations,omitempty"`
+		Timeline                 *FeedLink   `json:"timeline,omitempty"`
+		User                     *FeedLink   `json:"user,omitempty"`
+		CurrentUserPublic        *FeedLink   `json:"current_user_public,omitempty"`
+		CurrentUser              *FeedLink   `json:"current_user,omitempty"`
+		CurrentUserActor         *FeedLink   `json:"current_user_actor,omitempty"`
+		CurrentUserOrganization  *FeedLink   `json:"current_user_organization,omitempty"`
+		CurrentUserOrganizations []*FeedLink `json:"current_user_organizations,omitempty"`
 	} `json:"_links,omitempty"`
 }
 
diff --git a/github/event_types.go b/github/event_types.go
index 4f537c8d..bf145de0 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -649,13 +649,13 @@ type PullRequestReviewCommentEvent struct {
 //
 // GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent
 type PushEvent struct {
-	PushID       *int64            `json:"push_id,omitempty"`
-	Head         *string           `json:"head,omitempty"`
-	Ref          *string           `json:"ref,omitempty"`
-	Size         *int              `json:"size,omitempty"`
-	Commits      []PushEventCommit `json:"commits,omitempty"`
-	Before       *string           `json:"before,omitempty"`
-	DistinctSize *int              `json:"distinct_size,omitempty"`
+	PushID       *int64             `json:"push_id,omitempty"`
+	Head         *string            `json:"head,omitempty"`
+	Ref          *string            `json:"ref,omitempty"`
+	Size         *int               `json:"size,omitempty"`
+	Commits      []*PushEventCommit `json:"commits,omitempty"`
+	Before       *string            `json:"before,omitempty"`
+	DistinctSize *int               `json:"distinct_size,omitempty"`
 
 	// The following fields are only populated by Webhook events.
 	After        *string              `json:"after,omitempty"`
diff --git a/github/git_commits.go b/github/git_commits.go
index 74196198..e1dba1cf 100644
--- a/github/git_commits.go
+++ b/github/git_commits.go
@@ -31,7 +31,7 @@ type Commit struct {
 	Committer    *CommitAuthor          `json:"committer,omitempty"`
 	Message      *string                `json:"message,omitempty"`
 	Tree         *Tree                  `json:"tree,omitempty"`
-	Parents      []Commit               `json:"parents,omitempty"`
+	Parents      []*Commit              `json:"parents,omitempty"`
 	Stats        *CommitStats           `json:"stats,omitempty"`
 	HTMLURL      *string                `json:"html_url,omitempty"`
 	URL          *string                `json:"url,omitempty"`
diff --git a/github/git_trees.go b/github/git_trees.go
index 7714946c..7430876a 100644
--- a/github/git_trees.go
+++ b/github/git_trees.go
@@ -13,8 +13,8 @@ import (
 
 // Tree represents a GitHub tree.
 type Tree struct {
-	SHA     *string     `json:"sha,omitempty"`
-	Entries []TreeEntry `json:"tree,omitempty"`
+	SHA     *string      `json:"sha,omitempty"`
+	Entries []*TreeEntry `json:"tree,omitempty"`
 
 	// Truncated is true if the number of items in the tree
 	// exceeded GitHub's maximum limit and the Entries were truncated
@@ -125,7 +125,7 @@ type createTree struct {
 // that tree with the new path contents and write a new tree out.
 //
 // GitHub API docs: https://developer.github.com/v3/git/trees/#create-a-tree
-func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) {
+func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) {
 	u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)
 
 	newEntries := make([]interface{}, 0, len(entries))
diff --git a/github/issues.go b/github/issues.go
index 63a5fde7..71994070 100644
--- a/github/issues.go
+++ b/github/issues.go
@@ -33,7 +33,7 @@ type Issue struct {
 	Title            *string           `json:"title,omitempty"`
 	Body             *string           `json:"body,omitempty"`
 	User             *User             `json:"user,omitempty"`
-	Labels           []Label           `json:"labels,omitempty"`
+	Labels           []*Label          `json:"labels,omitempty"`
 	Assignee         *User             `json:"assignee,omitempty"`
 	Comments         *int              `json:"comments,omitempty"`
 	ClosedAt         *time.Time        `json:"closed_at,omitempty"`
@@ -55,7 +55,7 @@ type Issue struct {
 
 	// TextMatches is only populated from search results that request text matches
 	// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
-	TextMatches []TextMatch `json:"text_matches,omitempty"`
+	TextMatches []*TextMatch `json:"text_matches,omitempty"`
 
 	// ActiveLockReason is populated only when LockReason is provided while locking the issue.
 	// Possible values are: "off-topic", "too heated", "resolved", and "spam".
diff --git a/github/migrations_source_import.go b/github/migrations_source_import.go
index 080a5503..cbdf1ea8 100644
--- a/github/migrations_source_import.go
+++ b/github/migrations_source_import.go
@@ -106,7 +106,7 @@ type Import struct {
 	// When the importer finds several projects or repositories at the
 	// provided URLs, this will identify the available choices. Call
 	// UpdateImport with the selected Import value.
-	ProjectChoices []Import `json:"project_choices,omitempty"`
+	ProjectChoices []*Import `json:"project_choices,omitempty"`
 }
 
 func (i Import) String() string {
diff --git a/github/repos.go b/github/repos.go
index 5aa56006..bce3c942 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -120,7 +120,7 @@ type Repository struct {
 
 	// TextMatches is only populated from search results that request text matches
 	// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
-	TextMatches []TextMatch `json:"text_matches,omitempty"`
+	TextMatches []*TextMatch `json:"text_matches,omitempty"`
 }
 
 func (r Repository) String() string {
diff --git a/github/repos_commits.go b/github/repos_commits.go
index d6960124..77bd7481 100644
--- a/github/repos_commits.go
+++ b/github/repos_commits.go
@@ -16,20 +16,20 @@ import (
 // Note that it's wrapping a Commit, so author/committer information is in two places,
 // but contain different details about them: in RepositoryCommit "github details", in Commit - "git details".
 type RepositoryCommit struct {
-	NodeID      *string  `json:"node_id,omitempty"`
-	SHA         *string  `json:"sha,omitempty"`
-	Commit      *Commit  `json:"commit,omitempty"`
-	Author      *User    `json:"author,omitempty"`
-	Committer   *User    `json:"committer,omitempty"`
-	Parents     []Commit `json:"parents,omitempty"`
-	HTMLURL     *string  `json:"html_url,omitempty"`
-	URL         *string  `json:"url,omitempty"`
-	CommentsURL *string  `json:"comments_url,omitempty"`
+	NodeID      *string   `json:"node_id,omitempty"`
+	SHA         *string   `json:"sha,omitempty"`
+	Commit      *Commit   `json:"commit,omitempty"`
+	Author      *User     `json:"author,omitempty"`
+	Committer   *User     `json:"committer,omitempty"`
+	Parents     []*Commit `json:"parents,omitempty"`
+	HTMLURL     *string   `json:"html_url,omitempty"`
+	URL         *string   `json:"url,omitempty"`
+	CommentsURL *string   `json:"comments_url,omitempty"`
 
 	// Details about how many changes were made in this commit. Only filled in during GetCommit!
 	Stats *CommitStats `json:"stats,omitempty"`
 	// Details about which files, and how this commit touched. Only filled in during GetCommit!
-	Files []CommitFile `json:"files,omitempty"`
+	Files []*CommitFile `json:"files,omitempty"`
 }
 
 func (r RepositoryCommit) String() string {
@@ -78,9 +78,9 @@ type CommitsComparison struct {
 	BehindBy     *int    `json:"behind_by,omitempty"`
 	TotalCommits *int    `json:"total_commits,omitempty"`
 
-	Commits []RepositoryCommit `json:"commits,omitempty"`
+	Commits []*RepositoryCommit `json:"commits,omitempty"`
 
-	Files []CommitFile `json:"files,omitempty"`
+	Files []*CommitFile `json:"files,omitempty"`
 
 	HTMLURL      *string `json:"html_url,omitempty"`
 	PermalinkURL *string `json:"permalink_url,omitempty"`
diff --git a/github/repos_hooks.go b/github/repos_hooks.go
index 86728223..5af71dfd 100644
--- a/github/repos_hooks.go
+++ b/github/repos_hooks.go
@@ -19,18 +19,18 @@ import (
 //
 // GitHub API docs: https://help.github.com/articles/post-receive-hooks
 type WebHookPayload struct {
-	After      *string         `json:"after,omitempty"`
-	Before     *string         `json:"before,omitempty"`
-	Commits    []WebHookCommit `json:"commits,omitempty"`
-	Compare    *string         `json:"compare,omitempty"`
-	Created    *bool           `json:"created,omitempty"`
-	Deleted    *bool           `json:"deleted,omitempty"`
-	Forced     *bool           `json:"forced,omitempty"`
-	HeadCommit *WebHookCommit  `json:"head_commit,omitempty"`
-	Pusher     *User           `json:"pusher,omitempty"`
-	Ref        *string         `json:"ref,omitempty"`
-	Repo       *Repository     `json:"repository,omitempty"`
-	Sender     *User           `json:"sender,omitempty"`
+	After      *string          `json:"after,omitempty"`
+	Before     *string          `json:"before,omitempty"`
+	Commits    []*WebHookCommit `json:"commits,omitempty"`
+	Compare    *string          `json:"compare,omitempty"`
+	Created    *bool            `json:"created,omitempty"`
+	Deleted    *bool            `json:"deleted,omitempty"`
+	Forced     *bool            `json:"forced,omitempty"`
+	HeadCommit *WebHookCommit   `json:"head_commit,omitempty"`
+	Pusher     *User            `json:"pusher,omitempty"`
+	Ref        *string          `json:"ref,omitempty"`
+	Repo       *Repository      `json:"repository,omitempty"`
+	Sender     *User            `json:"sender,omitempty"`
 }
 
 func (w WebHookPayload) String() string {
diff --git a/github/repos_releases.go b/github/repos_releases.go
index 645f980a..6cd64c7f 100644
--- a/github/repos_releases.go
+++ b/github/repos_releases.go
@@ -27,18 +27,18 @@ type RepositoryRelease struct {
 	Prerelease      *bool   `json:"prerelease,omitempty"`
 
 	// The following fields are not used in CreateRelease or EditRelease:
-	ID          *int64         `json:"id,omitempty"`
-	CreatedAt   *Timestamp     `json:"created_at,omitempty"`
-	PublishedAt *Timestamp     `json:"published_at,omitempty"`
-	URL         *string        `json:"url,omitempty"`
-	HTMLURL     *string        `json:"html_url,omitempty"`
-	AssetsURL   *string        `json:"assets_url,omitempty"`
-	Assets      []ReleaseAsset `json:"assets,omitempty"`
-	UploadURL   *string        `json:"upload_url,omitempty"`
-	ZipballURL  *string        `json:"zipball_url,omitempty"`
-	TarballURL  *string        `json:"tarball_url,omitempty"`
-	Author      *User          `json:"author,omitempty"`
-	NodeID      *string        `json:"node_id,omitempty"`
+	ID          *int64          `json:"id,omitempty"`
+	CreatedAt   *Timestamp      `json:"created_at,omitempty"`
+	PublishedAt *Timestamp      `json:"published_at,omitempty"`
+	URL         *string         `json:"url,omitempty"`
+	HTMLURL     *string         `json:"html_url,omitempty"`
+	AssetsURL   *string         `json:"assets_url,omitempty"`
+	Assets      []*ReleaseAsset `json:"assets,omitempty"`
+	UploadURL   *string         `json:"upload_url,omitempty"`
+	ZipballURL  *string         `json:"zipball_url,omitempty"`
+	TarballURL  *string         `json:"tarball_url,omitempty"`
+	Author      *User           `json:"author,omitempty"`
+	NodeID      *string         `json:"node_id,omitempty"`
 }
 
 func (r RepositoryRelease) String() string {
diff --git a/github/repos_stats.go b/github/repos_stats.go
index bb355aea..e9c6d3ff 100644
--- a/github/repos_stats.go
+++ b/github/repos_stats.go
@@ -14,9 +14,9 @@ import (
 // ContributorStats represents a contributor to a repository and their
 // weekly contributions to a given repo.
 type ContributorStats struct {
-	Author *Contributor  `json:"author,omitempty"`
-	Total  *int          `json:"total,omitempty"`
-	Weeks  []WeeklyStats `json:"weeks,omitempty"`
+	Author *Contributor   `json:"author,omitempty"`
+	Total  *int           `json:"total,omitempty"`
+	Weeks  []*WeeklyStats `json:"weeks,omitempty"`
 }
 
 func (c ContributorStats) String() string {
diff --git a/github/repos_statuses.go b/github/repos_statuses.go
index 5576d311..cd7e4241 100644
--- a/github/repos_statuses.go
+++ b/github/repos_statuses.go
@@ -91,10 +91,10 @@ type CombinedStatus struct {
 	// failure, pending, or success.
 	State *string `json:"state,omitempty"`
 
-	Name       *string      `json:"name,omitempty"`
-	SHA        *string      `json:"sha,omitempty"`
-	TotalCount *int         `json:"total_count,omitempty"`
-	Statuses   []RepoStatus `json:"statuses,omitempty"`
+	Name       *string       `json:"name,omitempty"`
+	SHA        *string       `json:"sha,omitempty"`
+	TotalCount *int          `json:"total_count,omitempty"`
+	Statuses   []*RepoStatus `json:"statuses,omitempty"`
 
 	CommitURL     *string `json:"commit_url,omitempty"`
 	RepositoryURL *string `json:"repository_url,omitempty"`
diff --git a/github/search.go b/github/search.go
index 80587a3e..f08b3eb0 100644
--- a/github/search.go
+++ b/github/search.go
@@ -62,9 +62,9 @@ type searchParameters struct {
 
 // RepositoriesSearchResult represents the result of a repositories search.
 type RepositoriesSearchResult struct {
-	Total             *int         `json:"total_count,omitempty"`
-	IncompleteResults *bool        `json:"incomplete_results,omitempty"`
-	Repositories      []Repository `json:"items,omitempty"`
+	Total             *int          `json:"total_count,omitempty"`
+	IncompleteResults *bool         `json:"incomplete_results,omitempty"`
+	Repositories      []*Repository `json:"items,omitempty"`
 }
 
 // Repositories searches repositories via various criteria.
@@ -140,9 +140,9 @@ func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchO
 
 // IssuesSearchResult represents the result of an issues search.
 type IssuesSearchResult struct {
-	Total             *int    `json:"total_count,omitempty"`
-	IncompleteResults *bool   `json:"incomplete_results,omitempty"`
-	Issues            []Issue `json:"items,omitempty"`
+	Total             *int     `json:"total_count,omitempty"`
+	IncompleteResults *bool    `json:"incomplete_results,omitempty"`
+	Issues            []*Issue `json:"items,omitempty"`
 }
 
 // Issues searches issues via various criteria.
@@ -156,9 +156,9 @@ func (s *SearchService) Issues(ctx context.Context, query string, opts *SearchOp
 
 // UsersSearchResult represents the result of a users search.
 type UsersSearchResult struct {
-	Total             *int   `json:"total_count,omitempty"`
-	IncompleteResults *bool  `json:"incomplete_results,omitempty"`
-	Users             []User `json:"items,omitempty"`
+	Total             *int    `json:"total_count,omitempty"`
+	IncompleteResults *bool   `json:"incomplete_results,omitempty"`
+	Users             []*User `json:"items,omitempty"`
 }
 
 // Users searches users via various criteria.
@@ -178,11 +178,11 @@ type Match struct {
 
 // TextMatch represents a text match for a SearchResult
 type TextMatch struct {
-	ObjectURL  *string `json:"object_url,omitempty"`
-	ObjectType *string `json:"object_type,omitempty"`
-	Property   *string `json:"property,omitempty"`
-	Fragment   *string `json:"fragment,omitempty"`
-	Matches    []Match `json:"matches,omitempty"`
+	ObjectURL  *string  `json:"object_url,omitempty"`
+	ObjectType *string  `json:"object_type,omitempty"`
+	Property   *string  `json:"property,omitempty"`
+	Fragment   *string  `json:"fragment,omitempty"`
+	Matches    []*Match `json:"matches,omitempty"`
 }
 
 func (tm TextMatch) String() string {
@@ -191,19 +191,19 @@ func (tm TextMatch) String() string {
 
 // CodeSearchResult represents the result of a code search.
 type CodeSearchResult struct {
-	Total             *int         `json:"total_count,omitempty"`
-	IncompleteResults *bool        `json:"incomplete_results,omitempty"`
-	CodeResults       []CodeResult `json:"items,omitempty"`
+	Total             *int          `json:"total_count,omitempty"`
+	IncompleteResults *bool         `json:"incomplete_results,omitempty"`
+	CodeResults       []*CodeResult `json:"items,omitempty"`
 }
 
 // CodeResult represents a single search result.
 type CodeResult struct {
-	Name        *string     `json:"name,omitempty"`
-	Path        *string     `json:"path,omitempty"`
-	SHA         *string     `json:"sha,omitempty"`
-	HTMLURL     *string     `json:"html_url,omitempty"`
-	Repository  *Repository `json:"repository,omitempty"`
-	TextMatches []TextMatch `json:"text_matches,omitempty"`
+	Name        *string      `json:"name,omitempty"`
+	Path        *string      `json:"path,omitempty"`
+	SHA         *string      `json:"sha,omitempty"`
+	HTMLURL     *string      `json:"html_url,omitempty"`
+	Repository  *Repository  `json:"repository,omitempty"`
+	TextMatches []*TextMatch `json:"text_matches,omitempty"`
 }
 
 func (c CodeResult) String() string {
diff --git a/github/users.go b/github/users.go
index f7c77c61..8b6ce5d8 100644
--- a/github/users.go
+++ b/github/users.go
@@ -63,7 +63,7 @@ type User struct {
 
 	// TextMatches is only populated from search results that request text matches
 	// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
-	TextMatches []TextMatch `json:"text_matches,omitempty"`
+	TextMatches []*TextMatch `json:"text_matches,omitempty"`
 
 	// Permissions identifies the permissions that a user has on a given
 	// repository. This is only populated when calling Repositories.ListCollaborators.
diff --git a/github/users_gpg_keys.go b/github/users_gpg_keys.go
index 42638eb5..1d4dab04 100644
--- a/github/users_gpg_keys.go
+++ b/github/users_gpg_keys.go
@@ -15,18 +15,18 @@ import (
 //
 // https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
 type GPGKey struct {
-	ID                *int64     `json:"id,omitempty"`
-	PrimaryKeyID      *int64     `json:"primary_key_id,omitempty"`
-	KeyID             *string    `json:"key_id,omitempty"`
-	PublicKey         *string    `json:"public_key,omitempty"`
-	Emails            []GPGEmail `json:"emails,omitempty"`
-	Subkeys           []GPGKey   `json:"subkeys,omitempty"`
-	CanSign           *bool      `json:"can_sign,omitempty"`
-	CanEncryptComms   *bool      `json:"can_encrypt_comms,omitempty"`
-	CanEncryptStorage *bool      `json:"can_encrypt_storage,omitempty"`
-	CanCertify        *bool      `json:"can_certify,omitempty"`
-	CreatedAt         *time.Time `json:"created_at,omitempty"`
-	ExpiresAt         *time.Time `json:"expires_at,omitempty"`
+	ID                *int64      `json:"id,omitempty"`
+	PrimaryKeyID      *int64      `json:"primary_key_id,omitempty"`
+	KeyID             *string     `json:"key_id,omitempty"`
+	PublicKey         *string     `json:"public_key,omitempty"`
+	Emails            []*GPGEmail `json:"emails,omitempty"`
+	Subkeys           []*GPGKey   `json:"subkeys,omitempty"`
+	CanSign           *bool       `json:"can_sign,omitempty"`
+	CanEncryptComms   *bool       `json:"can_encrypt_comms,omitempty"`
+	CanEncryptStorage *bool       `json:"can_encrypt_storage,omitempty"`
+	CanCertify        *bool       `json:"can_certify,omitempty"`
+	CreatedAt         *time.Time  `json:"created_at,omitempty"`
+	ExpiresAt         *time.Time  `json:"expires_at,omitempty"`
 }
 
 // String stringifies a GPGKey.


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 928ca47a..bf3f173c 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -7,7 +7,7 @@ jobs:
   test:
     strategy:
       matrix:
-        go-version: [1.x, 1.12.x]
+        go-version: [1.x, 1.13.x]
         platform: [ubuntu-latest, windows-latest]
     runs-on: ${{ matrix.platform }}
 
diff --git a/github/activity_test.go b/github/activity_test.go
index b577118a..c533333c 100644
--- a/github/activity_test.go
+++ b/github/activity_test.go
@@ -116,13 +116,13 @@ var wantFeeds = &Feeds{
 		"https://github.com/organizations/github/defunkt.private.atom?token=abc123",
 	},
 	Links: &struct {
-		Timeline                 *FeedLink  `json:"timeline,omitempty"`
-		User                     *FeedLink  `json:"user,omitempty"`
-		CurrentUserPublic        *FeedLink  `json:"current_user_public,omitempty"`
-		CurrentUser              *FeedLink  `json:"current_user,omitempty"`
-		CurrentUserActor         *FeedLink  `json:"current_user_actor,omitempty"`
-		CurrentUserOrganization  *FeedLink  `json:"current_user_organization,omitempty"`
-		CurrentUserOrganizations []FeedLink `json:"current_user_organizations,omitempty"`
+		Timeline                 *FeedLink   `json:"timeline,omitempty"`
+		User                     *FeedLink   `json:"user,omitempty"`
+		CurrentUserPublic        *FeedLink   `json:"current_user_public,omitempty"`
+		CurrentUser              *FeedLink   `json:"current_user,omitempty"`
+		CurrentUserActor         *FeedLink   `json:"current_user_actor,omitempty"`
+		CurrentUserOrganization  *FeedLink   `json:"current_user_organization,omitempty"`
+		CurrentUserOrganizations []*FeedLink `json:"current_user_organizations,omitempty"`
 	}{
 		Timeline: &FeedLink{
 			HRef: String("https://github.com/timeline"),
@@ -148,7 +148,7 @@ var wantFeeds = &Feeds{
 			HRef: String(""),
 			Type: String(""),
 		},
-		CurrentUserOrganizations: []FeedLink{
+		CurrentUserOrganizations: []*FeedLink{
 			{
 				HRef: String("https://github.com/organizations/github/defunkt.private.atom?token=abc123"),
 				Type: String("application/atom+xml"),
diff --git a/github/git_commits_test.go b/github/git_commits_test.go
index 6e858baf..9a7e1988 100644
--- a/github/git_commits_test.go
+++ b/github/git_commits_test.go
@@ -38,7 +38,7 @@ func TestCommit_Marshal(t *testing.T) {
 		Message: String("m"),
 		Tree: &Tree{
 			SHA: String("s"),
-			Entries: []TreeEntry{{
+			Entries: []*TreeEntry{{
 				SHA:     String("s"),
 				Path:    String("p"),
 				Mode:    String("m"),
@@ -153,7 +153,7 @@ func TestGitService_CreateCommit(t *testing.T) {
 	input := &Commit{
 		Message: String("Commit Message."),
 		Tree:    &Tree{SHA: String("t")},
-		Parents: []Commit{{SHA: String("p")}},
+		Parents: []*Commit{{SHA: String("p")}},
 	}
 
 	mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) {
@@ -193,7 +193,7 @@ func TestGitService_CreateSignedCommit(t *testing.T) {
 	input := &Commit{
 		Message: String("Commit Message."),
 		Tree:    &Tree{SHA: String("t")},
-		Parents: []Commit{{SHA: String("p")}},
+		Parents: []*Commit{{SHA: String("p")}},
 		Verification: &SignatureVerification{
 			Signature: String(signature),
 		},
@@ -259,7 +259,7 @@ func TestGitService_CreateSignedCommitWithKey(t *testing.T) {
 	input := &Commit{
 		Message:    String("Commit Message."),
 		Tree:       &Tree{SHA: String("t")},
-		Parents:    []Commit{{SHA: String("p")}},
+		Parents:    []*Commit{{SHA: String("p")}},
 		SigningKey: keyring[0],
 		Author:     &author,
 	}
diff --git a/github/git_trees_test.go b/github/git_trees_test.go
index 3e765274..97be57b3 100644
--- a/github/git_trees_test.go
+++ b/github/git_trees_test.go
@@ -35,7 +35,7 @@ func TestGitService_GetTree(t *testing.T) {
 
 	want := Tree{
 		SHA: String("s"),
-		Entries: []TreeEntry{
+		Entries: []*TreeEntry{
 			{
 				Type: String("blob"),
 			},
@@ -59,7 +59,7 @@ func TestGitService_CreateTree(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	input := []TreeEntry{
+	input := []*TreeEntry{
 		{
 			Path: String("file.rb"),
 			Mode: String("100644"),
@@ -102,7 +102,7 @@ func TestGitService_CreateTree(t *testing.T) {
 
 	want := Tree{
 		String("cd8274d15fa3ae2ab983129fb037999f264ba9a7"),
-		[]TreeEntry{
+		[]*TreeEntry{
 			{
 				Path: String("file.rb"),
 				Mode: String("100644"),
@@ -123,7 +123,7 @@ func TestGitService_CreateTree_Content(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	input := []TreeEntry{
+	input := []*TreeEntry{
 		{
 			Path:    String("content.md"),
 			Mode:    String("100644"),
@@ -167,7 +167,7 @@ func TestGitService_CreateTree_Content(t *testing.T) {
 
 	want := Tree{
 		String("5c6780ad2c68743383b740fd1dab6f6a33202b11"),
-		[]TreeEntry{
+		[]*TreeEntry{
 			{
 				Path: String("content.md"),
 				Mode: String("100644"),
@@ -189,7 +189,7 @@ func TestGitService_CreateTree_Delete(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	input := []TreeEntry{
+	input := []*TreeEntry{
 		{
 			Path: String("content.md"),
 			Mode: String("100644"),
@@ -232,7 +232,7 @@ func TestGitService_CreateTree_Delete(t *testing.T) {
 
 	want := Tree{
 		String("5c6780ad2c68743383b740fd1dab6f6a33202b11"),
-		[]TreeEntry{
+		[]*TreeEntry{
 			{
 				Path: String("content.md"),
 				Mode: String("100644"),
diff --git a/github/issues_test.go b/github/issues_test.go
index e26d7f5d..0a11935d 100644
--- a/github/issues_test.go
+++ b/github/issues_test.go
@@ -169,7 +169,7 @@ func TestIssuesService_Get(t *testing.T) {
 
 	want := &Issue{
 		Number: Int(1),
-		Labels: []Label{{
+		Labels: []*Label{{
 			URL:   String("u"),
 			Name:  String("n"),
 			Color: String("c"),
diff --git a/github/pulls_test.go b/github/pulls_test.go
index 4adabdbd..d05e7a9b 100644
--- a/github/pulls_test.go
+++ b/github/pulls_test.go
@@ -467,7 +467,7 @@ func TestPullRequestsService_ListCommits(t *testing.T) {
 	want := []*RepositoryCommit{
 		{
 			SHA: String("3"),
-			Parents: []Commit{
+			Parents: []*Commit{
 				{
 					SHA: String("2"),
 				},
@@ -475,7 +475,7 @@ func TestPullRequestsService_ListCommits(t *testing.T) {
 		},
 		{
 			SHA: String("2"),
-			Parents: []Commit{
+			Parents: []*Commit{
 				{
 					SHA: String("1"),
 				},
diff --git a/github/repos_commits_test.go b/github/repos_commits_test.go
index 1c4fd774..221ddaf7 100644
--- a/github/repos_commits_test.go
+++ b/github/repos_commits_test.go
@@ -96,7 +96,7 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
 		Committer: &User{
 			Login: String("l"),
 		},
-		Parents: []Commit{
+		Parents: []*Commit{
 			{
 				SHA: String("s"),
 			},
@@ -106,7 +106,7 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
 			Deletions: Int(4),
 			Total:     Int(108),
 		},
-		Files: []CommitFile{
+		Files: []*CommitFile{
 			{
 				Filename:    String("f"),
 				Additions:   Int(10),
@@ -358,7 +358,7 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
 			},
 			Author:    &User{Login: String("l")},
 			Committer: &User{Login: String("l")},
-			Parents: []Commit{
+			Parents: []*Commit{
 				{
 					SHA: String("s"),
 				},
@@ -368,7 +368,7 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
 		AheadBy:      Int(1),
 		BehindBy:     Int(2),
 		TotalCommits: Int(1),
-		Commits: []RepositoryCommit{
+		Commits: []*RepositoryCommit{
 			{
 				SHA: String("s"),
 				Commit: &Commit{
@@ -376,14 +376,14 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
 				},
 				Author:    &User{Login: String("l")},
 				Committer: &User{Login: String("l")},
-				Parents: []Commit{
+				Parents: []*Commit{
 					{
 						SHA: String("s"),
 					},
 				},
 			},
 		},
-		Files: []CommitFile{
+		Files: []*CommitFile{
 			{
 				Filename: String("f"),
 			},
diff --git a/github/repos_releases_test.go b/github/repos_releases_test.go
index 9ccf9ac4..242c2811 100644
--- a/github/repos_releases_test.go
+++ b/github/repos_releases_test.go
@@ -112,7 +112,7 @@ func TestRepositoriesService_CreateRelease(t *testing.T) {
 		URL:         String("http://url/"),
 		HTMLURL:     String("http://htmlurl/"),
 		AssetsURL:   String("http://assetsurl/"),
-		Assets:      []ReleaseAsset{{ID: Int64(5)}},
+		Assets:      []*ReleaseAsset{{ID: Int64(5)}},
 		UploadURL:   String("http://uploadurl/"),
 		ZipballURL:  String("http://zipballurl/"),
 		TarballURL:  String("http://tarballurl/"),
@@ -156,7 +156,7 @@ func TestRepositoriesService_EditRelease(t *testing.T) {
 		URL:         String("http://url/"),
 		HTMLURL:     String("http://htmlurl/"),
 		AssetsURL:   String("http://assetsurl/"),
-		Assets:      []ReleaseAsset{{ID: Int64(5)}},
+		Assets:      []*ReleaseAsset{{ID: Int64(5)}},
 		UploadURL:   String("http://uploadurl/"),
 		ZipballURL:  String("http://zipballurl/"),
 		TarballURL:  String("http://tarballurl/"),
diff --git a/github/repos_stats_test.go b/github/repos_stats_test.go
index 4668cf18..d838239a 100644
--- a/github/repos_stats_test.go
+++ b/github/repos_stats_test.go
@@ -54,7 +54,7 @@ func TestRepositoriesService_ListContributorsStats(t *testing.T) {
 				NodeID: String("nodeid-1"),
 			},
 			Total: Int(135),
-			Weeks: []WeeklyStats{
+			Weeks: []*WeeklyStats{
 				{
 					Week:      &Timestamp{time.Date(2013, time.May, 05, 00, 00, 00, 0, time.UTC).Local()},
 					Additions: Int(6898),
diff --git a/github/repos_statuses_test.go b/github/repos_statuses_test.go
index b556b716..df52ec92 100644
--- a/github/repos_statuses_test.go
+++ b/github/repos_statuses_test.go
@@ -96,7 +96,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: String("success"), Statuses: []*RepoStatus{{ID: Int64(1)}}}
 	if !reflect.DeepEqual(status, want) {
 		t.Errorf("Repositories.GetCombinedStatus returned %+v, want %+v", status, want)
 	}
diff --git a/github/search_test.go b/github/search_test.go
index 7b607569..e6d19734 100644
--- a/github/search_test.go
+++ b/github/search_test.go
@@ -10,7 +10,6 @@ import (
 	"fmt"
 	"net/http"
 	"reflect"
-
 	"testing"
 )
 
@@ -40,7 +39,7 @@ func TestSearchService_Repositories(t *testing.T) {
 	want := &RepositoriesSearchResult{
 		Total:             Int(4),
 		IncompleteResults: Bool(false),
-		Repositories:      []Repository{{ID: Int64(1)}, {ID: Int64(2)}},
+		Repositories:      []*Repository{{ID: Int64(1)}, {ID: Int64(2)}},
 	}
 	if !reflect.DeepEqual(result, want) {
 		t.Errorf("Search.Repositories returned %+v, want %+v", result, want)
@@ -135,7 +134,7 @@ func TestSearchService_Issues(t *testing.T) {
 	want := &IssuesSearchResult{
 		Total:             Int(4),
 		IncompleteResults: Bool(true),
-		Issues:            []Issue{{Number: Int(1)}, {Number: Int(2)}},
+		Issues:            []*Issue{{Number: Int(1)}, {Number: Int(2)}},
 	}
 	if !reflect.DeepEqual(result, want) {
 		t.Errorf("Search.Issues returned %+v, want %+v", result, want)
@@ -172,7 +171,7 @@ func TestSearchService_Issues_withQualifiersNoOpts(t *testing.T) {
 	want := &IssuesSearchResult{
 		Total:             Int(4),
 		IncompleteResults: Bool(true),
-		Issues:            []Issue{{Number: Int(1)}, {Number: Int(2)}},
+		Issues:            []*Issue{{Number: Int(1)}, {Number: Int(2)}},
 	}
 	if !reflect.DeepEqual(result, want) {
 		t.Errorf("Search.Issues returned %+v, want %+v", result, want)
@@ -210,7 +209,7 @@ func TestSearchService_Issues_withQualifiersAndOpts(t *testing.T) {
 	want := &IssuesSearchResult{
 		Total:             Int(4),
 		IncompleteResults: Bool(true),
-		Issues:            []Issue{{Number: Int(1)}, {Number: Int(2)}},
+		Issues:            []*Issue{{Number: Int(1)}, {Number: Int(2)}},
 	}
 	if !reflect.DeepEqual(result, want) {
 		t.Errorf("Search.Issues returned %+v, want %+v", result, want)
@@ -243,7 +242,7 @@ func TestSearchService_Users(t *testing.T) {
 	want := &UsersSearchResult{
 		Total:             Int(4),
 		IncompleteResults: Bool(false),
-		Users:             []User{{ID: Int64(1)}, {ID: Int64(2)}},
+		Users:             []*User{{ID: Int64(1)}, {ID: Int64(2)}},
 	}
 	if !reflect.DeepEqual(result, want) {
 		t.Errorf("Search.Users returned %+v, want %+v", result, want)
@@ -276,7 +275,7 @@ func TestSearchService_Code(t *testing.T) {
 	want := &CodeSearchResult{
 		Total:             Int(4),
 		IncompleteResults: Bool(false),
-		CodeResults:       []CodeResult{{Name: String("1")}, {Name: String("2")}},
+		CodeResults:       []*CodeResult{{Name: String("1")}, {Name: String("2")}},
 	}
 	if !reflect.DeepEqual(result, want) {
 		t.Errorf("Search.Code returned %+v, want %+v", result, want)
@@ -325,11 +324,11 @@ func TestSearchService_CodeTextMatch(t *testing.T) {
 		t.Errorf("Search.Code returned error: %v", err)
 	}
 
-	wantedCodeResult := CodeResult{
+	wantedCodeResult := &CodeResult{
 		Name: String("gopher1"),
-		TextMatches: []TextMatch{{
+		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}}},
+			Matches:  []*Match{{Text: String("gopher"), Indices: []int{14, 21}}},
 		},
 		},
 	}
@@ -337,7 +336,7 @@ func TestSearchService_CodeTextMatch(t *testing.T) {
 	want := &CodeSearchResult{
 		Total:             Int(1),
 		IncompleteResults: Bool(false),
-		CodeResults:       []CodeResult{wantedCodeResult},
+		CodeResults:       []*CodeResult{wantedCodeResult},
 	}
 	if !reflect.DeepEqual(result, want) {
 		t.Errorf("Search.Code returned %+v, want %+v", result, want)