From 4aa098052d3cfa346f077a7ae5172313d157f36a Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sun, 15 Jan 2017 08:48:27 -0200 Subject: [PATCH 1/2] golint comments --- clients/github.go | 1 + context/context.go | 3 +++ pipeline/compress/tar/tar.go | 4 ++++ pipeline/compress/zip/zip.go | 4 ++++ sha256sum/sha256.go | 1 + 5 files changed, 13 insertions(+) diff --git a/clients/github.go b/clients/github.go index 45807ad3f..29a125feb 100644 --- a/clients/github.go +++ b/clients/github.go @@ -7,6 +7,7 @@ import ( "golang.org/x/oauth2" ) +// GitHub client for the given token func Github(token string) *github.Client { ts := oauth2.StaticTokenSource( &oauth2.Token{AccessToken: token}, diff --git a/context/context.go b/context/context.go index 967ee11f0..c85a56bcd 100644 --- a/context/context.go +++ b/context/context.go @@ -9,10 +9,12 @@ type GitInfo struct { Diff string } +// Repo owner/name pair type Repo struct { Owner, Name string } +// Context carries along some data through the pipes type Context struct { Config *config.ProjectConfig Token *string @@ -22,6 +24,7 @@ type Context struct { Archives map[string]string } +// New context func New(config config.ProjectConfig) *Context { return &Context{ Config: &config, diff --git a/pipeline/compress/tar/tar.go b/pipeline/compress/tar/tar.go index ee023325b..f99a27067 100644 --- a/pipeline/compress/tar/tar.go +++ b/pipeline/compress/tar/tar.go @@ -7,11 +7,13 @@ import ( "os" ) +// Archive as tar.gz type Archive struct { gw *gzip.Writer tw *tar.Writer } +// Close all closeables func (a Archive) Close() error { if err := a.tw.Close(); err != nil { return err @@ -22,6 +24,7 @@ func (a Archive) Close() error { return nil } +// New tar.gz archive func New(target *os.File) Archive { gw := gzip.NewWriter(target) tw := tar.NewWriter(gw) @@ -31,6 +34,7 @@ func New(target *os.File) Archive { } } +// Add file to the archive func (a Archive) Add(name, path string) (err error) { file, err := os.Open(path) if err != nil { diff --git a/pipeline/compress/zip/zip.go b/pipeline/compress/zip/zip.go index b79bfd95d..017d0166d 100644 --- a/pipeline/compress/zip/zip.go +++ b/pipeline/compress/zip/zip.go @@ -6,20 +6,24 @@ import ( "os" ) +// Archive zip struct type Archive struct { z *zip.Writer } +// Close all closeables func (a Archive) Close() error { return a.z.Close() } +// New zip archive func New(target *os.File) Archive { return Archive{ z: zip.NewWriter(target), } } +// Add a file to the zip archive func (a Archive) Add(name, path string) (err error) { file, err := os.Open(path) if err != nil { diff --git a/sha256sum/sha256.go b/sha256sum/sha256.go index 9aaee5159..e25ba02e6 100644 --- a/sha256sum/sha256.go +++ b/sha256sum/sha256.go @@ -7,6 +7,7 @@ import ( "os" ) +// For calculates the SHA256 sum for the given file func For(path string) (result string, err error) { file, err := os.Open(path) if err != nil { From fecd9be9aea73029d648d73da30cb00ee55d97ef Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sun, 15 Jan 2017 08:49:08 -0200 Subject: [PATCH 2/2] typo --- clients/github.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/github.go b/clients/github.go index 29a125feb..3b956ebec 100644 --- a/clients/github.go +++ b/clients/github.go @@ -7,7 +7,7 @@ import ( "golang.org/x/oauth2" ) -// GitHub client for the given token +// Github client for the given token func Github(token string) *github.Client { ts := oauth2.StaticTokenSource( &oauth2.Token{AccessToken: token},