Browse Source

redeclare String() as value method throughout

Will Norris 13 years ago
parent
commit
303846dd04
20 changed files with 31 additions and 27 deletions
  1. +3
    -3
      github/activity_events.go
  2. +2
    -2
      github/gists.go
  3. +1
    -1
      github/gists_comments.go
  4. +2
    -2
      github/git_commits.go
  5. +2
    -2
      github/git_trees.go
  6. +1
    -1
      github/issues.go
  7. +1
    -1
      github/issues_comments.go
  8. +1
    -1
      github/orgs.go
  9. +1
    -1
      github/orgs_teams.go
  10. +1
    -1
      github/pulls.go
  11. +1
    -1
      github/pulls_comments.go
  12. +1
    -1
      github/repos.go
  13. +1
    -1
      github/repos_comments.go
  14. +4
    -4
      github/repos_hooks.go
  15. +1
    -1
      github/repos_statuses.go
  16. +1
    -1
      github/search.go
  17. +1
    -1
      github/strings.go
  18. +4
    -0
      github/strings_test.go
  19. +1
    -1
      github/timestamp.go
  20. +1
    -1
      github/users.go

+ 3
- 3
github/activity_events.go View File

@ -25,7 +25,7 @@ type Event struct {
ID *string `json:"id,omitempty"`
}
func (e *Event) String() string {
func (e Event) String() string {
return Stringify(e)
}
@ -53,7 +53,7 @@ type PushEvent struct {
Commits []PushEventCommit `json:"commits,omitempty"`
}
func (p *PushEvent) String() string {
func (p PushEvent) String() string {
return Stringify(p)
}
@ -66,7 +66,7 @@ type PushEventCommit struct {
Distinct *bool `json:"distinct"`
}
func (p *PushEventCommit) String() string {
func (p PushEventCommit) String() string {
return Stringify(p)
}


+ 2
- 2
github/gists.go View File

@ -33,7 +33,7 @@ type Gist struct {
CreatedAt *time.Time `json:"created_at,omitempty"`
}
func (g *Gist) String() string {
func (g Gist) String() string {
return Stringify(g)
}
@ -48,7 +48,7 @@ type GistFile struct {
Content *string `json:"content,omitempty"`
}
func (g *GistFile) String() string {
func (g GistFile) String() string {
return Stringify(g)
}


+ 1
- 1
github/gists_comments.go View File

@ -19,7 +19,7 @@ type GistComment struct {
CreatedAt *time.Time `json:"created_at,omitempty"`
}
func (g *GistComment) String() string {
func (g GistComment) String() string {
return Stringify(g)
}


+ 2
- 2
github/git_commits.go View File

@ -20,7 +20,7 @@ type Commit struct {
Parents []Commit `json:"parents,omitempty"`
}
func (c *Commit) String() string {
func (c Commit) String() string {
return Stringify(c)
}
@ -32,7 +32,7 @@ type CommitAuthor struct {
Email *string `json:"email,omitempty"`
}
func (c *CommitAuthor) String() string {
func (c CommitAuthor) String() string {
return Stringify(c)
}


+ 2
- 2
github/git_trees.go View File

@ -13,7 +13,7 @@ type Tree struct {
Entries []TreeEntry `json:"tree,omitempty"`
}
func (t *Tree) String() string {
func (t Tree) String() string {
return Stringify(t)
}
@ -28,7 +28,7 @@ type TreeEntry struct {
Size *int `json:"size,omitempty"`
}
func (t *TreeEntry) String() string {
func (t TreeEntry) String() string {
return Stringify(t)
}


+ 1
- 1
github/issues.go View File

@ -38,7 +38,7 @@ type Issue struct {
// TODO(willnorris): milestone
}
func (i *Issue) String() string {
func (i Issue) String() string {
return Stringify(i)
}


+ 1
- 1
github/issues_comments.go View File

@ -20,7 +20,7 @@ type IssueComment struct {
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
func (i *IssueComment) String() string {
func (i IssueComment) String() string {
return Stringify(i)
}


+ 1
- 1
github/orgs.go View File

@ -30,7 +30,7 @@ type Organization struct {
CreatedAt *time.Time `json:"created_at,omitempty"`
}
func (o *Organization) String() string {
func (o Organization) String() string {
return Stringify(o)
}


+ 1
- 1
github/orgs_teams.go View File

@ -19,7 +19,7 @@ type Team struct {
ReposCount *int `json:"repos_count,omitempty"`
}
func (t *Team) String() string {
func (t Team) String() string {
return Stringify(t)
}


+ 1
- 1
github/pulls.go View File

@ -42,7 +42,7 @@ type PullRequest struct {
// TODO(willnorris): add head and base once we have a Commit struct defined somewhere
}
func (p *PullRequest) String() string {
func (p PullRequest) String() string {
return Stringify(p)
}


+ 1
- 1
github/pulls_comments.go View File

@ -23,7 +23,7 @@ type PullRequestComment struct {
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
func (p *PullRequestComment) String() string {
func (p PullRequestComment) String() string {
return Stringify(p)
}


+ 1
- 1
github/repos.go View File

@ -37,7 +37,7 @@ type Repository struct {
HasWiki *bool `json:"has_wiki"`
}
func (r *Repository) String() string {
func (r Repository) String() string {
return Stringify(r)
}


+ 1
- 1
github/repos_comments.go View File

@ -27,7 +27,7 @@ type RepositoryComment struct {
Position *int `json:"position,omitempty"`
}
func (r *RepositoryComment) String() string {
func (r RepositoryComment) String() string {
return Stringify(r)
}


+ 4
- 4
github/repos_hooks.go View File

@ -33,7 +33,7 @@ type WebHookPayload struct {
Repo *Repository `json:"repository,omitempty"`
}
func (w *WebHookPayload) String() string {
func (w WebHookPayload) String() string {
return Stringify(w)
}
@ -51,7 +51,7 @@ type WebHookCommit struct {
Timestamp *time.Time `json:"timestamp,omitempty"`
}
func (w *WebHookCommit) String() string {
func (w WebHookCommit) String() string {
return Stringify(w)
}
@ -63,7 +63,7 @@ type WebHookAuthor struct {
Username *string `json:"username,omitempty"`
}
func (w *WebHookAuthor) String() string {
func (w WebHookAuthor) String() string {
return Stringify(w)
}
@ -78,7 +78,7 @@ type Hook struct {
ID *int `json:"id,omitempty"`
}
func (h *Hook) String() string {
func (h Hook) String() string {
return Stringify(h)
}


+ 1
- 1
github/repos_statuses.go View File

@ -30,7 +30,7 @@ type RepoStatus struct {
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
func (r *RepoStatus) String() string {
func (r RepoStatus) String() string {
return Stringify(r)
}


+ 1
- 1
github/search.go View File

@ -102,7 +102,7 @@ type CodeResult struct {
Repository *Repository `json:"repository,omitempty"`
}
func (c *CodeResult) String() string {
func (c CodeResult) String() string {
return Stringify(c)
}


+ 1
- 1
github/strings.go View File

@ -57,7 +57,7 @@ func stringifyValue(w io.Writer, val reflect.Value) {
// special handling of Timestamp values
if v.Type() == timestampType {
fmt.Fprint(w, v.Interface())
fmt.Fprintf(w, "{%s}", v.Interface())
return
}


+ 4
- 0
github/strings_test.go View File

@ -56,6 +56,10 @@ func TestStringify(t *testing.T) {
Timestamp{time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC)},
`github.Timestamp{2006-01-02 15:04:05 +0000 UTC}`,
},
{
&Timestamp{time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC)},
`github.Timestamp{2006-01-02 15:04:05 +0000 UTC}`,
},
{
User{ID: Int(123), Name: String("n")},
`github.User{ID:123, Name:"n"}`,


+ 1
- 1
github/timestamp.go View File

@ -18,7 +18,7 @@ type Timestamp struct {
time.Time
}
func (t *Timestamp) String() string {
func (t Timestamp) String() string {
return t.Time.String()
}


+ 1
- 1
github/users.go View File

@ -39,7 +39,7 @@ type User struct {
CreatedAt *time.Time `json:"created_at,omitempty"`
}
func (u *User) String() string {
func (u User) String() string {
return Stringify(u)
}


Loading…
Cancel
Save