From dafd9bcb242c6d32e7b970130313b58f57a9333c Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 29 Oct 2019 10:24:05 +1100 Subject: [PATCH] fix: make binary name more os specific --- cmd/helpers.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/helpers.go b/cmd/helpers.go index 819b947c..6c5b29e9 100644 --- a/cmd/helpers.go +++ b/cmd/helpers.go @@ -7,6 +7,7 @@ import ( "os/exec" "path/filepath" "runtime" + "strings" "time" "github.com/leaanthony/mewn" @@ -87,6 +88,17 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa buildCommand.Add("build") if binaryName != "" { + // Alter binary name based on OS + switch runtime.GOOS { + case "windows": + if !strings.HasSuffix(binaryName, ".exe") { + binaryName += ".exe" + } + default: + if strings.HasSuffix(binaryName, ".exe") { + binaryName = strings.TrimSuffix(binaryName, ".exe") + } + } buildCommand.Add("-o") buildCommand.Add(binaryName) }