Browse Source

fix golint and gofmt errors

Will Norris 12 years ago
parent
commit
dcc1981fd9
6 changed files with 14 additions and 14 deletions
  1. +2
    -2
      github/github.go
  2. +3
    -3
      github/gitignore.go
  3. +5
    -5
      github/repos_contents.go
  4. +1
    -1
      github/repos_releases.go
  5. +2
    -2
      github/repos_stats.go
  6. +1
    -1
      tests/fields/fields.go

+ 2
- 2
github/github.go View File

@ -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


+ 3
- 3
github/gitignore.go View File

@ -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) {


+ 5
- 5
github/repos_contents.go View File

@ -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


+ 1
- 1
github/repos_releases.go View File

@ -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()))


+ 2
- 2
github/repos_stats.go View File

@ -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


+ 1
- 1
tests/fields/fields.go View File

@ -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"
)


Loading…
Cancel
Save