mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-13 13:48:40 +02:00
parent
0a272037b3
commit
c9068b4b3c
@ -273,8 +273,19 @@ func withOverrides(ctx *context.Context, build config.Build, options api.Options
|
||||
return build.BuildDetails, nil
|
||||
}
|
||||
|
||||
func buildGoBuildLine(ctx *context.Context, build config.Build, details config.BuildDetails, options api.Options, artifact *artifact.Artifact, env []string) ([]string, error) {
|
||||
cmd := []string{build.GoBinary, build.Command}
|
||||
func buildGoBuildLine(
|
||||
ctx *context.Context,
|
||||
build config.Build,
|
||||
details config.BuildDetails,
|
||||
options api.Options,
|
||||
artifact *artifact.Artifact,
|
||||
env []string,
|
||||
) ([]string, error) {
|
||||
gobin, err := tmpl.New(ctx).WithBuildOptions(options).Apply(build.GoBinary)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cmd := []string{gobin, build.Command}
|
||||
|
||||
// tags, ldflags, and buildmode, should only appear once, warning only to avoid a breaking change
|
||||
validateUniqueFlags(details)
|
||||
|
@ -342,7 +342,7 @@ func TestBuild(t *testing.T) {
|
||||
folder := testlib.Mktmp(t)
|
||||
writeGoodMain(t, folder)
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Env: []string{"GO_FLAGS=-v"},
|
||||
Env: []string{"GO_FLAGS=-v", "GOBIN=go"},
|
||||
Builds: []config.Build{
|
||||
{
|
||||
ID: "foo",
|
||||
@ -356,7 +356,7 @@ func TestBuild(t *testing.T) {
|
||||
"linux_mips_softfloat",
|
||||
"linux_mips64le_softfloat",
|
||||
},
|
||||
GoBinary: "go",
|
||||
GoBinary: "{{ .Env.GOBIN }}",
|
||||
Command: "build",
|
||||
BuildDetails: config.BuildDetails{
|
||||
Env: []string{
|
||||
@ -1071,6 +1071,7 @@ func TestBuildGoBuildLine(t *testing.T) {
|
||||
},
|
||||
testctx.WithVersion("1.2.3"),
|
||||
testctx.WithGitInfo(context.GitInfo{Commit: "aaa"}),
|
||||
testctx.WithEnv(map[string]string{"GOBIN": "go"}),
|
||||
)
|
||||
options := api.Options{
|
||||
Path: ctx.Config.Builds[0].Binary,
|
||||
@ -1104,7 +1105,7 @@ func TestBuildGoBuildLine(t *testing.T) {
|
||||
Ldflags: []string{"ldflag1", "ldflag2"},
|
||||
},
|
||||
Binary: "foo",
|
||||
GoBinary: "go",
|
||||
GoBinary: "{{ .Env.GOBIN }}",
|
||||
Command: "build",
|
||||
}, []string{
|
||||
"go", "build",
|
||||
|
@ -195,14 +195,12 @@ func buildOptionsForTarget(ctx *context.Context, build config.Build, target stri
|
||||
Goamd64: goamd64,
|
||||
}
|
||||
|
||||
if err := tmpl.New(ctx).WithBuildOptions(buildOpts).ApplyAll(
|
||||
&build.Binary,
|
||||
&build.GoBinary,
|
||||
); err != nil {
|
||||
bin, err := tmpl.New(ctx).WithBuildOptions(buildOpts).Apply(build.Binary)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
name := build.Binary + ext
|
||||
name := bin + ext
|
||||
dir := fmt.Sprintf("%s_%s", build.ID, target)
|
||||
if build.NoUniqueDistDir {
|
||||
dir = ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user