mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
golint comments
This commit is contained in:
parent
2200e87764
commit
4aa098052d
@ -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},
|
||||
|
@ -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,
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user