1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-04-13 11:50:34 +02:00

fix: windows filenames (#1539)

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2020-05-21 22:08:54 -03:00 committed by GitHub
parent 6b80d90ac7
commit ef19f1610b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -81,7 +81,7 @@ func (*Builder) Build(ctx *context.Context, build config.Build, options api.Opti
Goarm: target.arm,
Gomips: target.mips,
Extra: map[string]interface{}{
"Binary": filepath.Base(options.Path),
"Binary": strings.TrimSuffix(filepath.Base(options.Path), options.Ext),
"Ext": options.Ext,
"ID": build.ID,
},

View File

@ -117,16 +117,15 @@ func TestBuild(t *testing.T) {
var ext string
if strings.HasPrefix(target, "windows") {
ext = ".exe"
}
if target == "js_wasm" {
} else if target == "js_wasm" {
ext = ".wasm"
}
bin, terr := tmpl.New(ctx).Apply(build.Binary)
require.NoError(t, terr)
var err = Default.Build(ctx, build, api.Options{
Target: target,
Name: bin,
Path: filepath.Join(folder, "dist", target, bin),
Name: bin + ext,
Path: filepath.Join(folder, "dist", target, bin+ext),
Ext: ext,
})
assert.NoError(t, err)
@ -196,8 +195,8 @@ func TestBuild(t *testing.T) {
},
},
{
Name: "bin/foo-v5.6.7",
Path: filepath.Join(folder, "dist", "windows_amd64", "bin", "foo-v5.6.7"),
Name: "bin/foo-v5.6.7.exe",
Path: filepath.Join(folder, "dist", "windows_amd64", "bin", "foo-v5.6.7.exe"),
Goos: "windows",
Goarch: "amd64",
Type: artifact.Binary,
@ -208,8 +207,8 @@ func TestBuild(t *testing.T) {
},
},
{
Name: "bin/foo-v5.6.7",
Path: filepath.Join(folder, "dist", "js_wasm", "bin", "foo-v5.6.7"),
Name: "bin/foo-v5.6.7.wasm",
Path: filepath.Join(folder, "dist", "js_wasm", "bin", "foo-v5.6.7.wasm"),
Goos: "js",
Goarch: "wasm",
Type: artifact.Binary,