1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00

fix: .Amd64 in build hooks

closes #4399
This commit is contained in:
Carlos Alexandro Becker 2023-11-02 12:46:18 +00:00
parent 69a1fb3ad4
commit b8cc16d4ac
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 18 additions and 0 deletions

View File

@ -183,6 +183,7 @@ func buildOptsToFields(opts build.Options) Fields {
osKey: opts.Goos,
arch: opts.Goarch,
arm: opts.Goarm,
amd64: opts.Goamd64,
mips: opts.Gomips,
}
}

View File

@ -10,6 +10,7 @@ import (
"github.com/goreleaser/goreleaser/internal/artifact"
"github.com/goreleaser/goreleaser/internal/testctx"
"github.com/goreleaser/goreleaser/pkg/build"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
"github.com/stretchr/testify/require"
@ -430,3 +431,19 @@ func TestInvalidMap(t *testing.T) {
_, err := New(testctx.New()).Apply(`{{ $m := map "a" }}`)
require.ErrorContains(t, err, "map expects even number of arguments, got 1")
}
func TestWithBuildOptions(t *testing.T) {
out, err := New(testctx.New()).WithBuildOptions(build.Options{
Name: "name",
Path: "./path",
Ext: ".ext",
Target: "target",
Goos: "os",
Goarch: "arch",
Goamd64: "amd64",
Goarm: "arm",
Gomips: "mips",
}).Apply("{{.Name}}_{{.Path}}_{{.Ext}}_{{.Target}}_{{.Os}}_{{.Arch}}_{{.Amd64}}_{{.Arm}}_{{.Mips}}")
require.NoError(t, err)
require.Equal(t, "name_./path_.ext_target_os_arch_amd64_arm_mips", out)
}