1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-11-06 09:09:29 +02:00

fix: custom targets if missing goamd64, goarm, gomips (#3056)

* fix: custom targets if missing goamd64, goarm, gomips

if the user provide custom targets without the goamd64, goarm or gomips bit, things may go awry at some point.

this prevents issues by suffixing them with the default when its missing.

closes https://github.com/goreleaser/goreleaser/issues/3055

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* test: fix build tests

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker
2022-04-20 09:43:39 -03:00
committed by GitHub
parent 922992ce76
commit 63436392db
3 changed files with 93 additions and 15 deletions

View File

@@ -562,11 +562,12 @@ func TestBuildOptionsForTarget(t *testing.T) {
},
},
expectedOpts: &api.Options{
Name: "testbinary",
Path: filepath.Join(tmpDir, "testid_linux_amd64", "testbinary"),
Target: "linux_amd64",
Goos: "linux",
Goarch: "amd64",
Name: "testbinary",
Path: filepath.Join(tmpDir, "testid_linux_amd64_v1", "testbinary"),
Target: "linux_amd64_v1",
Goos: "linux",
Goarch: "amd64",
Goamd64: "v1",
},
},
{
@@ -579,11 +580,12 @@ func TestBuildOptionsForTarget(t *testing.T) {
},
},
expectedOpts: &api.Options{
Name: "testbinary_linux_amd64",
Path: filepath.Join(tmpDir, "testid_linux_amd64", "testbinary_linux_amd64"),
Target: "linux_amd64",
Goos: "linux",
Goarch: "amd64",
Name: "testbinary_linux_amd64",
Path: filepath.Join(tmpDir, "testid_linux_amd64_v1", "testbinary_linux_amd64"),
Target: "linux_amd64_v1",
Goos: "linux",
Goarch: "amd64",
Goamd64: "v1",
},
},
{
@@ -597,11 +599,12 @@ func TestBuildOptionsForTarget(t *testing.T) {
NoUniqueDistDir: true,
},
expectedOpts: &api.Options{
Name: "distpath/linux/amd64/testbinary_linux_amd64",
Path: filepath.Join(tmpDir, "distpath", "linux", "amd64", "testbinary_linux_amd64"),
Target: "linux_amd64",
Goos: "linux",
Goarch: "amd64",
Name: "distpath/linux/amd64/testbinary_linux_amd64",
Path: filepath.Join(tmpDir, "distpath", "linux", "amd64", "testbinary_linux_amd64"),
Target: "linux_amd64_v1",
Goos: "linux",
Goarch: "amd64",
Goamd64: "v1",
},
},
{