mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-20 03:59:26 +02:00
fix: do not default goos/goarch/goarm if targets is provided (#1789)
* fix: do not default goos/goarch/goarm if targets is provided Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: fixed Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
58cce33c0f
commit
28230b67f8
@ -41,19 +41,19 @@ func (*Builder) WithDefaults(build config.Build) config.Build {
|
||||
if build.Main == "" {
|
||||
build.Main = "."
|
||||
}
|
||||
if len(build.Goos) == 0 {
|
||||
build.Goos = []string{"linux", "darwin"}
|
||||
}
|
||||
if len(build.Goarch) == 0 {
|
||||
build.Goarch = []string{"amd64", "386"}
|
||||
}
|
||||
if len(build.Goarm) == 0 {
|
||||
build.Goarm = []string{"6"}
|
||||
}
|
||||
if len(build.Ldflags) == 0 {
|
||||
build.Ldflags = []string{"-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser"}
|
||||
}
|
||||
if len(build.Targets) == 0 {
|
||||
if len(build.Goos) == 0 {
|
||||
build.Goos = []string{"linux", "darwin"}
|
||||
}
|
||||
if len(build.Goarch) == 0 {
|
||||
build.Goarch = []string{"amd64", "386"}
|
||||
}
|
||||
if len(build.Goarm) == 0 {
|
||||
build.Goarm = []string{"6"}
|
||||
}
|
||||
build.Targets = matrix(build)
|
||||
}
|
||||
if build.GoBinary == "" {
|
||||
|
@ -71,6 +71,21 @@ func TestWithDefaults(t *testing.T) {
|
||||
},
|
||||
goBinary: "go",
|
||||
},
|
||||
"custom targets": {
|
||||
build: config.Build{
|
||||
ID: "foo3",
|
||||
Binary: "foo",
|
||||
Targets: []string{
|
||||
"linux_386",
|
||||
"darwin_amd64",
|
||||
},
|
||||
},
|
||||
targets: []string{
|
||||
"linux_386",
|
||||
"darwin_amd64",
|
||||
},
|
||||
goBinary: "go",
|
||||
},
|
||||
} {
|
||||
t.Run(name, func(tt *testing.T) {
|
||||
var config = config.Project{
|
||||
|
Loading…
x
Reference in New Issue
Block a user