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

windows support

This commit is contained in:
Carlos Alexandro Becker 2016-12-30 16:48:55 -02:00
parent d9c8c5f499
commit 0c9147de65
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,14 @@
package compress
import (
"testing"
"github.com/docker/docker/pkg/testutil/assert"
)
func TestExtWindows(t *testing.T) {
assert.Equal(t, ext("windows"), ".exe")
}
func TestExtOthers(t *testing.T) {
assert.Equal(t, ext("linux"), "")
}

View File

@ -51,7 +51,7 @@ func create(system, arch string, config config.ProjectConfig) error {
return err
}
}
if err := addFile(tw, config.BinaryName, binaryName(system, arch, config.BinaryName)); err != nil {
if err := addFile(tw, config.BinaryName+ext(system), binaryPath(system, arch, config.BinaryName)); err != nil {
return err
}
return nil
@ -85,6 +85,13 @@ func nameFor(system, arch, binary string) string {
return binary + "_" + uname.FromGo(system) + "_" + uname.FromGo(arch)
}
func binaryName(system, arch, binary string) string {
func binaryPath(system, arch, binary string) string {
return "dist/" + nameFor(system, arch, binary) + "/" + binary
}
func ext(system string) string {
if system == "windows" {
return ".exe"
}
return ""
}