From f9dbfb5d7040f40ec8c0687efd60b9dcc1db71e8 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sun, 17 Dec 2017 22:28:24 -0200 Subject: [PATCH] fix: cleaning up --- internal/ext/ext.go | 6 +----- pipeline/archive/archive.go | 3 +-- pipeline/brew/brew.go | 2 -- pipeline/build/build.go | 4 +++- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/internal/ext/ext.go b/internal/ext/ext.go index b7e377e82..a3528368a 100644 --- a/internal/ext/ext.go +++ b/internal/ext/ext.go @@ -4,11 +4,7 @@ import "github.com/goreleaser/goreleaser/internal/buildtarget" // For returns the binary extension for the given platform func For(target buildtarget.Target) (ext string) { - return ForOS(target.OS) -} - -func ForOS(os string) string { - if os == "windows" { + if target.OS == "windows" { return ".exe" } return "" diff --git a/pipeline/archive/archive.go b/pipeline/archive/archive.go index b7d35bfa7..50057af98 100644 --- a/pipeline/archive/archive.go +++ b/pipeline/archive/archive.go @@ -17,7 +17,6 @@ import ( "github.com/goreleaser/goreleaser/context" "github.com/goreleaser/goreleaser/internal/archiveformat" "github.com/goreleaser/goreleaser/internal/artifact" - "github.com/goreleaser/goreleaser/internal/ext" "github.com/goreleaser/goreleaser/internal/nametemplate" ) @@ -125,7 +124,7 @@ func skip(ctx *context.Context, artifacts []artifact.Artifact) error { return err } a.Type = artifact.UploadableBinary - a.Name = name + ext.ForOS(a.Goos) + a.Name = name + a.Extra["Ext"] ctx.Artifacts.Add(a) } return nil diff --git a/pipeline/brew/brew.go b/pipeline/brew/brew.go index 15ed18996..530acbc6b 100644 --- a/pipeline/brew/brew.go +++ b/pipeline/brew/brew.go @@ -24,8 +24,6 @@ var ErrNoDarwin64Build = errors.New("brew tap requires one darwin amd64 build") // ErrTooManyDarwin64Builds when there are too many builds for darwin_amd64 var ErrTooManyDarwin64Builds = errors.New("brew tap requires at most one darwin amd64 build") -const platform = "darwinamd64" - // Pipe for brew deployment type Pipe struct{} diff --git a/pipeline/build/build.go b/pipeline/build/build.go index 94c67f3a8..749311dcf 100644 --- a/pipeline/build/build.go +++ b/pipeline/build/build.go @@ -106,7 +106,8 @@ func runHook(env []string, hook string) error { } func doBuild(ctx *context.Context, build config.Build, target buildtarget.Target) error { - var binaryName = build.Binary + ext.For(target) + var ext = ext.For(target) + var binaryName = build.Binary + ext var binary = filepath.Join(ctx.Config.Dist, target.String(), binaryName) ctx.Artifacts.Add(artifact.Artifact{ Type: artifact.Binary, @@ -117,6 +118,7 @@ func doBuild(ctx *context.Context, build config.Build, target buildtarget.Target Goarm: target.Arm, Extra: map[string]string{ "Binary": build.Binary, + "Ext": ext, }, }) log.WithField("binary", binary).Info("building")