From dcc1981fd936f5c4e35bea783d91aae3f2ca6e95 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Sat, 17 May 2014 11:35:34 -1000 Subject: [PATCH] fix golint and gofmt errors --- github/github.go | 4 ++-- github/gitignore.go | 6 +++--- github/repos_contents.go | 10 +++++----- github/repos_releases.go | 2 +- github/repos_stats.go | 4 ++-- tests/fields/fields.go | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/github/github.go b/github/github.go index bfa0fdd..224a07e 100644 --- a/github/github.go +++ b/github/github.go @@ -485,10 +485,10 @@ type UnauthenticatedRateLimitedTransport struct { // RoundTrip implements the RoundTripper interface. func (t *UnauthenticatedRateLimitedTransport) RoundTrip(req *http.Request) (*http.Response, error) { if t.ClientID == "" { - return nil, errors.New("ClientID is empty") + return nil, errors.New("t.ClientID is empty") } if t.ClientSecret == "" { - return nil, errors.New("ClientSecret is empty") + return nil, errors.New("t.ClientSecret is empty") } // To set extra querystring params, we must make a copy of the Request so diff --git a/github/gitignore.go b/github/gitignore.go index 038df90..31d5902 100644 --- a/github/gitignore.go +++ b/github/gitignore.go @@ -15,7 +15,7 @@ type GitignoresService struct { client *Client } -// Represents a .gitignore file as returned by the GitHub API. +// Gitignore represents a .gitignore file as returned by the GitHub API. type Gitignore struct { Name *string `json:"name,omitempty"` Source *string `json:"source,omitempty"` @@ -25,7 +25,7 @@ func (g Gitignore) String() string { return Stringify(g) } -// Fetches a list of all available Gitignore templates. +// List all available Gitignore templates. // // http://developer.github.com/v3/gitignore/#listing-available-templates func (s GitignoresService) List() ([]string, *Response, error) { @@ -43,7 +43,7 @@ func (s GitignoresService) List() ([]string, *Response, error) { return *availableTemplates, resp, err } -// Fetches a Gitignore by name. +// Get a Gitignore by name. // // http://developer.github.com/v3/gitignore/#get-a-single-template func (s GitignoresService) Get(name string) (*Gitignore, *Response, error) { diff --git a/github/repos_contents.go b/github/repos_contents.go index 6ab55ae..d17c63e 100644 --- a/github/repos_contents.go +++ b/github/repos_contents.go @@ -58,11 +58,11 @@ func (r RepositoryContent) String() string { } // Decode decodes the file content if it is base64 encoded. -func (c *RepositoryContent) Decode() ([]byte, error) { - if *c.Encoding != "base64" { - return nil, errors.New("Cannot decode non-base64") +func (r *RepositoryContent) Decode() ([]byte, error) { + if *r.Encoding != "base64" { + return nil, errors.New("cannot decode non-base64") } - o, err := base64.StdEncoding.DecodeString(*c.Content) + o, err := base64.StdEncoding.DecodeString(*r.Content) if err != nil { return nil, err } @@ -122,7 +122,7 @@ func (s *RepositoriesService) GetContents(owner, repo, path string, opt *Reposit if directoryUnmarshalError == nil { return nil, directoryContent, resp, directoryUnmarshalError } - return nil, nil, resp, fmt.Errorf("Unmarshalling failed for both file and directory content: %s and %s ", fileUnmarshalError, directoryUnmarshalError) + return nil, nil, resp, fmt.Errorf("unmarshalling failed for both file and directory content: %s and %s ", fileUnmarshalError, directoryUnmarshalError) } // CreateFile creates a new file in a repository at the given path and returns diff --git a/github/repos_releases.go b/github/repos_releases.go index 09da650..f3574d1 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -235,7 +235,7 @@ func (s *RepositoriesService) UploadReleaseAsset(owner, repo string, id int, opt return nil, nil, err } if stat.IsDir() { - return nil, nil, errors.New("The asset to upload can't be a directory") + return nil, nil, errors.New("the asset to upload can't be a directory") } mediaType := mime.TypeByExtension(filepath.Ext(file.Name())) diff --git a/github/repos_stats.go b/github/repos_stats.go index 452ff18..7c1de09 100644 --- a/github/repos_stats.go +++ b/github/repos_stats.go @@ -116,7 +116,7 @@ func (s *RepositoriesService) ListCodeFrequency(owner, repo string) ([]WeeklySta resp, err := s.client.Do(req, &weeks) // convert int slices into WeeklyStats - stats := make([]WeeklyStats, 0) + var stats []WeeklyStats for _, week := range weeks { if len(week) != 3 { continue @@ -197,7 +197,7 @@ func (s *RepositoriesService) ListPunchCard(owner, repo string) ([]PunchCard, *R resp, err := s.client.Do(req, &results) // convert int slices into Punchcards - cards := make([]PunchCard, 0) + var cards []PunchCard for _, result := range results { if len(result) != 3 { continue diff --git a/tests/fields/fields.go b/tests/fields/fields.go index 5905690..24c7036 100644 --- a/tests/fields/fields.go +++ b/tests/fields/fields.go @@ -23,8 +23,8 @@ import ( "os" "reflect" "strings" - "code.google.com/p/goauth2/oauth" + "code.google.com/p/goauth2/oauth" "github.com/google/go-github/github" )