diff --git a/internal/pipe/partial/partial.go b/internal/pipe/partial/partial.go index 7873dcaf0..46defba8d 100644 --- a/internal/pipe/partial/partial.go +++ b/internal/pipe/partial/partial.go @@ -33,6 +33,22 @@ func getFilter() string { goarm := ordered.First(os.Getenv("GGOARM"), os.Getenv("GOARM"), experimental.DefaultGOARM()) target = target + "_" + goarm } + if strings.HasSuffix(target, "_arm64") { + goarm := ordered.First(os.Getenv("GGOARM64"), os.Getenv("GOARM64"), "v8.0") + target = target + "_" + goarm + } + if strings.HasSuffix(target, "_386") { + goarm := ordered.First(os.Getenv("GGO386"), os.Getenv("GO386"), "sse2") + target = target + "_" + goarm + } + if strings.HasSuffix(target, "_ppc64") { + goarm := ordered.First(os.Getenv("GGOPPC64"), os.Getenv("GOPPC64"), "power8") + target = target + "_" + goarm + } + if strings.HasSuffix(target, "_riscv64") { + goarm := ordered.First(os.Getenv("GGORISCV64"), os.Getenv("GORISCV64"), "rva20u64") + target = target + "_" + goarm + } if strings.HasSuffix(target, "_mips") || strings.HasSuffix(target, "_mips64") || strings.HasSuffix(target, "_mipsle") || diff --git a/internal/pipe/partial/partial_test.go b/internal/pipe/partial/partial_test.go index 900731a46..db0d8ba25 100644 --- a/internal/pipe/partial/partial_test.go +++ b/internal/pipe/partial/partial_test.go @@ -35,7 +35,7 @@ func TestRun(t *testing.T) { t.Setenv("GOOS", "windows") t.Setenv("GOARCH", "arm64") require.NoError(t, pipe.Run(ctx)) - require.Equal(t, "windows_arm64", ctx.PartialTarget) + require.Equal(t, "windows_arm64_v8.0", ctx.PartialTarget) }) t.Run("using GGOOS and GGOARCH", func(t *testing.T) { ctx := testctx.NewWithCfg(config.Project{ @@ -44,7 +44,7 @@ func TestRun(t *testing.T) { t.Setenv("GGOOS", "windows") t.Setenv("GGOARCH", "arm64") require.NoError(t, pipe.Run(ctx)) - require.Equal(t, "windows_arm64", ctx.PartialTarget) + require.Equal(t, "windows_arm64_v8.0", ctx.PartialTarget) }) t.Run("custom GGOARM", func(t *testing.T) { ctx := testctx.NewWithCfg(config.Project{ @@ -62,6 +62,22 @@ func TestRun(t *testing.T) { require.Equal(t, "linux_arm_7", ctx.PartialTarget) }) }) + t.Run("custom GGOARM64", func(t *testing.T) { + ctx := testctx.NewWithCfg(config.Project{ + Dist: "dist", + }, testctx.Partial) + t.Setenv("GGOOS", "linux") + t.Setenv("GGOARCH", "arm64") + t.Run("default", func(t *testing.T) { + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_arm64_v8.0", ctx.PartialTarget) + }) + t.Run("default", func(t *testing.T) { + t.Setenv("GGOARM64", "v9.0") + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_arm64_v9.0", ctx.PartialTarget) + }) + }) t.Run("custom GGOAMD64", func(t *testing.T) { ctx := testctx.NewWithCfg(config.Project{ Dist: "dist", @@ -98,6 +114,54 @@ func TestRun(t *testing.T) { }) } }) + t.Run("custom GGO386", func(t *testing.T) { + ctx := testctx.NewWithCfg(config.Project{ + Dist: "dist", + }, testctx.Partial) + t.Setenv("GGOOS", "linux") + t.Setenv("GGOARCH", "386") + t.Run("default", func(t *testing.T) { + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_386_sse2", ctx.PartialTarget) + }) + t.Run("default", func(t *testing.T) { + t.Setenv("GGO386", "softfloat") + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_386_softfloat", ctx.PartialTarget) + }) + }) + t.Run("custom GGOPPC64", func(t *testing.T) { + ctx := testctx.NewWithCfg(config.Project{ + Dist: "dist", + }, testctx.Partial) + t.Setenv("GGOOS", "linux") + t.Setenv("GGOARCH", "ppc64") + t.Run("default", func(t *testing.T) { + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_ppc64_power8", ctx.PartialTarget) + }) + t.Run("default", func(t *testing.T) { + t.Setenv("GGOPPC64", "power9") + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_ppc64_power9", ctx.PartialTarget) + }) + }) + t.Run("custom GGORISCV64", func(t *testing.T) { + ctx := testctx.NewWithCfg(config.Project{ + Dist: "dist", + }, testctx.Partial) + t.Setenv("GGOOS", "linux") + t.Setenv("GGOARCH", "riscv64") + t.Run("default", func(t *testing.T) { + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_riscv64_rva20u64", ctx.PartialTarget) + }) + t.Run("default", func(t *testing.T) { + t.Setenv("GGORISCV64", "rva22u64") + require.NoError(t, pipe.Run(ctx)) + require.Equal(t, "linux_riscv64_rva22u64", ctx.PartialTarget) + }) + }) t.Run("using runtime", func(t *testing.T) { ctx := testctx.NewWithCfg(config.Project{ Dist: "dist", @@ -105,8 +169,11 @@ func TestRun(t *testing.T) { require.NoError(t, pipe.Run(ctx)) target := fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH) // commonly tests will run on either arm64 or amd64. - if runtime.GOARCH == "amd64" { + switch runtime.GOARCH { + case "amd64": target += "_v1" + case "arm64": + target += "_v8.0" } require.Equal(t, target, ctx.PartialTarget) })