diff --git a/clients/github.go b/clients/github.go index 09444d7b3..935543da2 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 e59843b07..60cbdc4a2 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/archive/tar/tar.go b/pipeline/archive/tar/tar.go index ee023325b..f99a27067 100644 --- a/pipeline/archive/tar/tar.go +++ b/pipeline/archive/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/archive/zip/zip.go b/pipeline/archive/zip/zip.go index b79bfd95d..017d0166d 100644 --- a/pipeline/archive/zip/zip.go +++ b/pipeline/archive/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 {