1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix: linter errors

This commit is contained in:
Carlos Alexandro Becker 2018-01-24 21:22:45 -02:00
parent 2f69359209
commit a2e2177a99
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 7 additions and 7 deletions

View File

@ -1,3 +1,4 @@
// Package build provides the API for external builders
package build
import (
@ -16,31 +17,37 @@ var (
lock sync.Mutex
)
// Register register a builder to a given lang
func Register(lang string, builder Builder) {
lock.Lock()
builders[lang] = builder
lock.Unlock()
}
// For gets the previously register builder for the given lang
func For(lang string) Builder {
return builders[lang]
}
// Options to be passed down to a builder
type Options struct {
Name, Path, Ext, Target string
}
// Builder defines a builder
type Builder interface {
Default(build config.Build) config.Build
Build(ctx *context.Context, build config.Build, options Options) error
}
// Run runs a command within the given context and env
func Run(ctx *context.Context, command, env []string) error {
/* #nosec */
var cmd = exec.CommandContext(ctx, command[0], command[1:]...)
var log = log.WithField("env", env).WithField("cmd", command)
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, env...)
// TODO: improve debug here
log.Debug("running")
if out, err := cmd.CombinedOutput(); err != nil {
log.WithError(err).Debug("failed")

View File

@ -13,8 +13,6 @@ import (
"github.com/stretchr/testify/assert"
)
var emptyEnv []string
type fakeBuilder struct{}
func (*fakeBuilder) Default(build config.Build) config.Build {
@ -217,8 +215,3 @@ func exists(file string) bool {
_, err := os.Stat(file)
return !os.IsNotExist(err)
}
func assertContainsError(t *testing.T, err error, s string) {
assert.Error(t, err)
assert.Contains(t, err.Error(), s)
}