mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
parent
69a1fb3ad4
commit
b8cc16d4ac
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user