Repository: goreleaser/goreleaser
Pull request #1999 (2021-01-07 02:28:12)

feat: add arm64 to the default goarch list
With Apple M1's getting common soon, as well as other arm64 devices (like the raspberry pi), I think we can add arm64 as a default GOARCH.

refs https://github.com/goreleaser/goreleaser/pull/1956#issuecomment-754830155

vercel[bot]: This pull request is being automatically deployed with Vercel ([learn more](https://vercel.link/github-learn-more)).  
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: [https://vercel.com/goreleaser/goreleaser/nfpn69phg](https://vercel.com/goreleaser/goreleaser/nfpn69phg)  
✅ Preview: [https://goreleaser-git-arm64.goreleaser.vercel.app](https://goreleaser-git-arm64.goreleaser.vercel.app)



Patch:
diff --git a/internal/builders/golang/build.go b/internal/builders/golang/build.go
index 4e715eed..d050e318 100644
--- a/internal/builders/golang/build.go
+++ b/internal/builders/golang/build.go
@@ -49,7 +49,7 @@ func (*Builder) WithDefaults(build config.Build) (config.Build, error) {
 			build.Goos = []string{"linux", "darwin"}
 		}
 		if len(build.Goarch) == 0 {
-			build.Goarch = []string{"amd64", "386"}
+			build.Goarch = []string{"amd64", "arm64", "386"}
 		}
 		if len(build.Goarm) == 0 {
 			build.Goarm = []string{"6"}
diff --git a/www/docs/customization/build.md b/www/docs/customization/build.md
index 6b44b8db..64061f09 100644
--- a/www/docs/customization/build.md
+++ b/www/docs/customization/build.md
@@ -70,7 +70,7 @@ builds:
 
     # GOARCH to build for.
     # For more info refer to: https://golang.org/doc/install/source#environment
-    # Defaults are 386 and amd64.
+    # Defaults are 386, amd64 and arm64.
     goarch:
       - amd64
       - arm


Test patch:
diff --git a/internal/builders/golang/build_test.go b/internal/builders/golang/build_test.go
index 0646faf8..7b49eb40 100644
--- a/internal/builders/golang/build_test.go
+++ b/internal/builders/golang/build_test.go
@@ -66,6 +66,7 @@ func TestWithDefaults(t *testing.T) {
 			targets: []string{
 				"linux_amd64",
 				"linux_386",
+				"linux_arm64",
 				"darwin_amd64",
 			},
 			goBinary: "go",
diff --git a/internal/pipe/build/build_test.go b/internal/pipe/build/build_test.go
index b6fece6c..35e4d6b2 100644
--- a/internal/pipe/build/build_test.go
+++ b/internal/pipe/build/build_test.go
@@ -264,7 +264,7 @@ func TestDefaultEmptyBuild(t *testing.T) {
 	require.Equal(t, ".", build.Dir)
 	require.Equal(t, ".", build.Main)
 	require.Equal(t, []string{"linux", "darwin"}, build.Goos)
-	require.Equal(t, []string{"amd64", "386"}, build.Goarch)
+	require.Equal(t, []string{"amd64", "arm64", "386"}, build.Goarch)
 	require.Equal(t, []string{"6"}, build.Goarm)
 	require.Len(t, build.Ldflags, 1)
 	require.Equal(t, "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser", build.Ldflags[0])
@@ -334,7 +334,7 @@ func TestDefaultPartialBuilds(t *testing.T) {
 		require.Equal(t, ".", build.Dir)
 		require.Equal(t, "./cmd/main.go", build.Main)
 		require.Equal(t, []string{"linux"}, build.Goos)
-		require.Equal(t, []string{"amd64", "386"}, build.Goarch)
+		require.Equal(t, []string{"amd64", "arm64", "386"}, build.Goarch)
 		require.Equal(t, []string{"6"}, build.Goarm)
 		require.Len(t, build.Ldflags, 1)
 		require.Equal(t, "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser", build.Ldflags[0])