Repository: goreleaser/goreleaser
Pull request #3595 (2022-11-25 08:01:28)

feat(deps): bump golang.org/x/text from 0.3.7 to 0.4.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.7 to 0.4.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/golang/text/commit/1bdb400fb39a45cc788ffe7e5d7a2a9719afc7e9"><code>1bdb400</code></a> language: remove compatibility with go &lt; 1.2</li>
<li><a href="https://github.com/golang/text/commit/252bee03417df7609718dd0885f25d37818cb5c1"><code>252bee0</code></a> go.mod: ignore cyclic dependency for tagging</li>
<li><a href="https://github.com/golang/text/commit/ecab6e5ab6ec037a966bd330f3c04322d09cb79e"><code>ecab6e5</code></a> go.mod: ignore cyclic dependency for tagging</li>
<li><a href="https://github.com/golang/text/commit/369c86ba1108cfc8744033afe107422a2ad76611"><code>369c86b</code></a> all: fix a few function names on comments</li>
<li><a href="https://github.com/golang/text/commit/434eadcdbc3b0256971992e8c70027278364c72c"><code>434eadc</code></a> language: reject excessively large Accept-Language strings</li>
<li><a href="https://github.com/golang/text/commit/23407e72ed5b895a2dfd230aec777f4fbe026d6a"><code>23407e7</code></a> go.mod: ignore cyclic dependency for tagging</li>
<li><a href="https://github.com/golang/text/commit/b18d3dd8a4b426ebedcf279b593e85ac4985b9d3"><code>b18d3dd</code></a> secure/precis: replace bytes.Compare with bytes.Equal</li>
<li><a href="https://github.com/golang/text/commit/795e854ff348c9cac4fd0033ce04c417705dd0bb"><code>795e854</code></a> all: replace io/ioutil with io and os package</li>
<li><a href="https://github.com/golang/text/commit/b0ca10ff35f1325c7d0ac7830fe3f036bd72d8f9"><code>b0ca10f</code></a> internal/language: bump script types to uint16 and update registry</li>
<li><a href="https://github.com/golang/text/commit/ba9b0e1d4b03523c708709935fbc961124b6967b"><code>ba9b0e1</code></a> go.mod: update x/tools to HEAD</li>
<li>Additional commits viewable in <a href="https://github.com/golang/text/compare/v0.3.7...v0.4.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=golang.org/x/text&package-manager=go_modules&previous-version=0.3.7&new-version=0.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/3595?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) Report
> Merging [#3595](https://codecov.io/gh/goreleaser/goreleaser/pull/3595?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (9ad07e8) into [main](https://codecov.io/gh/goreleaser/goreleaser/commit/eedf9578a61d44b09803b33c0be1df5293d919cf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (eedf957) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##             main    #3595   +/-   ##
=======================================
  Coverage   83.87%   83.87%           
=======================================
  Files         117      117           
  Lines        9751     9751           
=======================================
  Hits         8179     8179           
  Misses       1268     1268           
  Partials      304      304           
```



Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)


Patch:
diff --git a/go.mod b/go.mod
index c2635160..b5dec07b 100644
--- a/go.mod
+++ b/go.mod
@@ -41,7 +41,7 @@ require (
 	golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
 	golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c
 	golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
-	golang.org/x/text v0.3.7
+	golang.org/x/text v0.4.0
 	gopkg.in/mail.v2 v2.3.1
 	gopkg.in/yaml.v3 v3.0.1
 )
diff --git a/go.sum b/go.sum
index 892d7b77..ca6506ed 100644
--- a/go.sum
+++ b/go.sum
@@ -2009,8 +2009,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
+golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
diff --git a/internal/pipe/brew/brew.go b/internal/pipe/brew/brew.go
index 85b497a5..85f5f3c5 100644
--- a/internal/pipe/brew/brew.go
+++ b/internal/pipe/brew/brew.go
@@ -247,9 +247,6 @@ func buildFormula(ctx *context.Context, brew config.Homebrew, client client.Clie
 func doBuildFormula(ctx *context.Context, data templateData) (string, error) {
 	t, err := template.
 		New(data.Name).
-		Funcs(template.FuncMap{
-			"join": strings.Join,
-		}).
 		Parse(formulaTemplate)
 	if err != nil {
 		return "", err
@@ -282,9 +279,13 @@ func doBuildFormula(ctx *context.Context, data templateData) (string, error) {
 	return out.String(), nil
 }
 
-func installs(cfg config.Homebrew, art *artifact.Artifact) []string {
-	if cfg.Install != "" {
-		return split(cfg.Install)
+func installs(ctx *context.Context, cfg config.Homebrew, art *artifact.Artifact) ([]string, error) {
+	applied, err := tmpl.New(ctx).WithArtifact(art, nil).Apply(cfg.Install)
+	if err != nil {
+		return nil, err
+	}
+	if applied != "" {
+		return split(applied), nil
 	}
 
 	install := map[string]bool{}
@@ -302,7 +303,7 @@ func installs(cfg config.Homebrew, art *artifact.Artifact) []string {
 	result := keys(install)
 	sort.Strings(result)
 	log.Warnf("guessing install to be %q", strings.Join(result, ", "))
-	return result
+	return result, nil
 }
 
 func keys(m map[string]bool) []string {
@@ -351,13 +352,18 @@ func dataFor(ctx *context.Context, cfg config.Homebrew, cl client.Client, artifa
 			return result, err
 		}
 
+		install, err := installs(ctx, cfg, art)
+		if err != nil {
+			return result, err
+		}
+
 		pkg := releasePackage{
 			DownloadURL:      url,
 			SHA256:           sum,
 			OS:               art.Goos,
 			Arch:             art.Goarch,
 			DownloadStrategy: cfg.DownloadStrategy,
-			Install:          installs(cfg, art),
+			Install:          install,
 		}
 
 		counts[pkg.OS+pkg.Arch]++


Test patch:
diff --git a/internal/pipe/brew/brew_test.go b/internal/pipe/brew/brew_test.go
index 38ea0064..fc94b42c 100644
--- a/internal/pipe/brew/brew_test.go
+++ b/internal/pipe/brew/brew_test.go
@@ -247,6 +247,14 @@ func TestFullPipe(t *testing.T) {
 			},
 			expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
 		},
+		"invalid_install_template": {
+			prepare: func(ctx *context.Context) {
+				ctx.Config.Brews[0].Tap.Owner = "test"
+				ctx.Config.Brews[0].Tap.Name = "test"
+				ctx.Config.Brews[0].Install = "{{ .aaaa }"
+			},
+			expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
+		},
 	} {
 		t.Run(name, func(t *testing.T) {
 			folder := t.TempDir()
@@ -280,7 +288,7 @@ func TestFullPipe(t *testing.T) {
 							Conflicts:   []string{"gtk+", "qt"},
 							Service:     "run foo/bar\nkeep_alive true",
 							PostInstall: "system \"echo\"\ntouch \"/tmp/hi\"",
-							Install:     `bin.install "{{ .ProjectName }}"`,
+							Install:     `bin.install "{{ .ProjectName }}_{{.Os}}_{{.Arch}} => {{.ProjectName}}"`,
 							Goamd64:     "v1",
 						},
 					},
@@ -312,6 +320,29 @@ func TestFullPipe(t *testing.T) {
 					artifact.ExtraFormat: "tar.gz",
 				},
 			})
+			ctx.Artifacts.Add(&artifact.Artifact{
+				Name:   "bin.tar.gz",
+				Path:   path,
+				Goos:   "darwin",
+				Goarch: "arm64",
+				Type:   artifact.UploadableArchive,
+				Extra: map[string]interface{}{
+					artifact.ExtraID:     "foo",
+					artifact.ExtraFormat: "tar.gz",
+				},
+			})
+			ctx.Artifacts.Add(&artifact.Artifact{
+				Name:    "bin.tar.gz",
+				Path:    path,
+				Goos:    "linux",
+				Goarch:  "amd64",
+				Goamd64: "v1",
+				Type:    artifact.UploadableArchive,
+				Extra: map[string]interface{}{
+					artifact.ExtraID:     "foo",
+					artifact.ExtraFormat: "tar.gz",
+				},
+			})
 
 			f, err := os.Create(path)
 			require.NoError(t, err)
@@ -1116,20 +1147,22 @@ func TestRunSkipNoName(t *testing.T) {
 
 func TestInstalls(t *testing.T) {
 	t.Run("provided", func(t *testing.T) {
+		install, err := installs(
+			context.New(config.Project{}),
+			config.Homebrew{Install: "bin.install \"foo\"\nbin.install \"bar\""},
+			&artifact.Artifact{},
+		)
+		require.NoError(t, err)
 		require.Equal(t, []string{
 			`bin.install "foo"`,
 			`bin.install "bar"`,
-		}, installs(
-			config.Homebrew{Install: "bin.install \"foo\"\nbin.install \"bar\""},
-			&artifact.Artifact{},
-		))
+		}, install)
 	})
 
 	t.Run("from archives", func(t *testing.T) {
-		require.Equal(t, []string{
-			`bin.install "bar"`,
-			`bin.install "foo"`,
-		}, installs(
+		install, err := installs(
+			context.New(config.Project{}),
+
 			config.Homebrew{},
 			&artifact.Artifact{
 				Type: artifact.UploadableArchive,
@@ -1137,13 +1170,17 @@ func TestInstalls(t *testing.T) {
 					artifact.ExtraBinaries: []string{"foo", "bar"},
 				},
 			},
-		))
+		)
+		require.NoError(t, err)
+		require.Equal(t, []string{
+			`bin.install "bar"`,
+			`bin.install "foo"`,
+		}, install)
 	})
 
 	t.Run("from binary", func(t *testing.T) {
-		require.Equal(t, []string{
-			`bin.install "foo_macos" => "foo"`,
-		}, installs(
+		install, err := installs(
+			context.New(config.Project{}),
 			config.Homebrew{},
 			&artifact.Artifact{
 				Name: "foo_macos",
@@ -1152,7 +1189,29 @@ func TestInstalls(t *testing.T) {
 					artifact.ExtraBinary: "foo",
 				},
 			},
-		))
+		)
+		require.NoError(t, err)
+		require.Equal(t, []string{
+			`bin.install "foo_macos" => "foo"`,
+		}, install)
+	})
+
+	t.Run("from template", func(t *testing.T) {
+		install, err := installs(
+			context.New(config.Project{}),
+			config.Homebrew{
+				Install: `bin.install "foo_{{.Os}}" => "foo"`,
+			},
+			&artifact.Artifact{
+				Name: "foo_darwin",
+				Goos: "darwin",
+				Type: artifact.UploadableBinary,
+			},
+		)
+		require.NoError(t, err)
+		require.Equal(t, []string{
+			`bin.install "foo_darwin" => "foo"`,
+		}, install)
 	})
 }
 
diff --git a/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden
index 5bef8efc..f1184a21 100644
--- a/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden
+++ b/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden
@@ -10,23 +10,33 @@ class CustomBlock < Formula
   depends_on "zsh" => :optional
   depends_on "bash" => "3.2.57"
   depends_on "fish" => :optional
-  depends_on :macos
 
   on_macos do
-    url "https://dummyhost/download/v1.0.1/bin.tar.gz"
-    sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
 
-    def install
-      bin.install "custom_block"
+      def install
+        bin.install "custom_block_darwin_amd64 => custom_block"
+      end
     end
-
     if Hardware::CPU.arm?
-      def caveats
-        <<~EOS
-          The darwin_arm64 architecture is not supported for the CustomBlock
-          formula at this time. The darwin_amd64 binary may work in compatibility
-          mode, but it might not be fully supported.
-        EOS
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "custom_block_darwin_arm64 => custom_block"
+      end
+    end
+  end
+
+  on_linux do
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "custom_block_linux_amd64 => custom_block"
       end
     end
   end
diff --git a/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden
index 90525b1f..2dd74674 100644
--- a/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden
+++ b/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden
@@ -10,23 +10,33 @@ class CustomDownloadStrategy < Formula
   depends_on "zsh" => :optional
   depends_on "bash" => "3.2.57"
   depends_on "fish" => :optional
-  depends_on :macos
 
   on_macos do
-    url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: GitHubPrivateRepositoryReleaseDownloadStrategy
-    sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: GitHubPrivateRepositoryReleaseDownloadStrategy
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
 
-    def install
-      bin.install "custom_download_strategy"
+      def install
+        bin.install "custom_download_strategy_darwin_amd64 => custom_download_strategy"
+      end
     end
-
     if Hardware::CPU.arm?
-      def caveats
-        <<~EOS
-          The darwin_arm64 architecture is not supported for the CustomDownloadStrategy
-          formula at this time. The darwin_amd64 binary may work in compatibility
-          mode, but it might not be fully supported.
-        EOS
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: GitHubPrivateRepositoryReleaseDownloadStrategy
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "custom_download_strategy_darwin_arm64 => custom_download_strategy"
+      end
+    end
+  end
+
+  on_linux do
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: GitHubPrivateRepositoryReleaseDownloadStrategy
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "custom_download_strategy_linux_amd64 => custom_download_strategy"
       end
     end
   end
diff --git a/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden
index 6dee341f..ab512b64 100644
--- a/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden
+++ b/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden
@@ -11,23 +11,33 @@ class CustomRequire < Formula
   depends_on "zsh" => :optional
   depends_on "bash" => "3.2.57"
   depends_on "fish" => :optional
-  depends_on :macos
 
   on_macos do
-    url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: CustomDownloadStrategy
-    sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: CustomDownloadStrategy
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
 
-    def install
-      bin.install "custom_require"
+      def install
+        bin.install "custom_require_darwin_amd64 => custom_require"
+      end
     end
-
     if Hardware::CPU.arm?
-      def caveats
-        <<~EOS
-          The darwin_arm64 architecture is not supported for the CustomRequire
-          formula at this time. The darwin_amd64 binary may work in compatibility
-          mode, but it might not be fully supported.
-        EOS
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: CustomDownloadStrategy
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "custom_require_darwin_arm64 => custom_require"
+      end
+    end
+  end
+
+  on_linux do
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz", using: CustomDownloadStrategy
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "custom_require_linux_amd64 => custom_require"
       end
     end
   end
diff --git a/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden
index d8d4b479..35e3f9d7 100644
--- a/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden
+++ b/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden
@@ -10,23 +10,33 @@ class Default < Formula
   depends_on "zsh" => :optional
   depends_on "bash" => "3.2.57"
   depends_on "fish" => :optional
-  depends_on :macos
 
   on_macos do
-    url "https://dummyhost/download/v1.0.1/bin.tar.gz"
-    sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
 
-    def install
-      bin.install "default"
+      def install
+        bin.install "default_darwin_amd64 => default"
+      end
     end
-
     if Hardware::CPU.arm?
-      def caveats
-        <<~EOS
-          The darwin_arm64 architecture is not supported for the Default
-          formula at this time. The darwin_amd64 binary may work in compatibility
-          mode, but it might not be fully supported.
-        EOS
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "default_darwin_arm64 => default"
+      end
+    end
+  end
+
+  on_linux do
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "default_linux_amd64 => default"
       end
     end
   end
diff --git a/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden
index 23dc20da..76d87375 100644
--- a/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden
+++ b/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden
@@ -10,23 +10,33 @@ class DefaultGitlab < Formula
   depends_on "zsh" => :optional
   depends_on "bash" => "3.2.57"
   depends_on "fish" => :optional
-  depends_on :macos
 
   on_macos do
-    url "https://dummyhost/download/v1.0.1/bin.tar.gz"
-    sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
 
-    def install
-      bin.install "default_gitlab"
+      def install
+        bin.install "default_gitlab_darwin_amd64 => default_gitlab"
+      end
     end
-
     if Hardware::CPU.arm?
-      def caveats
-        <<~EOS
-          The darwin_arm64 architecture is not supported for the DefaultGitlab
-          formula at this time. The darwin_amd64 binary may work in compatibility
-          mode, but it might not be fully supported.
-        EOS
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "default_gitlab_darwin_arm64 => default_gitlab"
+      end
+    end
+  end
+
+  on_linux do
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "default_gitlab_linux_amd64 => default_gitlab"
       end
     end
   end
diff --git a/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden
index 28a01583..a87974ae 100644
--- a/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden
+++ b/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden
@@ -10,23 +10,33 @@ class ValidTapTemplates < Formula
   depends_on "zsh" => :optional
   depends_on "bash" => "3.2.57"
   depends_on "fish" => :optional
-  depends_on :macos
 
   on_macos do
-    url "https://dummyhost/download/v1.0.1/bin.tar.gz"
-    sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
 
-    def install
-      bin.install "valid_tap_templates"
+      def install
+        bin.install "valid_tap_templates_darwin_amd64 => valid_tap_templates"
+      end
     end
-
     if Hardware::CPU.arm?
-      def caveats
-        <<~EOS
-          The darwin_arm64 architecture is not supported for the ValidTapTemplates
-          formula at this time. The darwin_amd64 binary may work in compatibility
-          mode, but it might not be fully supported.
-        EOS
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "valid_tap_templates_darwin_arm64 => valid_tap_templates"
+      end
+    end
+  end
+
+  on_linux do
+    if Hardware::CPU.intel?
+      url "https://dummyhost/download/v1.0.1/bin.tar.gz"
+      sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+
+      def install
+        bin.install "valid_tap_templates_linux_amd64 => valid_tap_templates"
       end
     end
   end