Skip to content

Commit

Permalink
fix: .Amd64 in build hooks
Browse files Browse the repository at this point in the history
closes #4399
  • Loading branch information
caarlos0 committed Nov 2, 2023
1 parent 69a1fb3 commit b8cc16d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/tmpl/tmpl.go
Expand Up @@ -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,
}
}
Expand Down
17 changes: 17 additions & 0 deletions internal/tmpl/tmpl_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}

0 comments on commit b8cc16d

Please sign in to comment.