From 44388ffc1aa4295173ebca412de36a4762e35b2b Mon Sep 17 00:00:00 2001 From: Annie Ku Date: Fri, 26 Apr 2024 16:55:08 -0700 Subject: [PATCH 1/2] fix: remove deprecated ioutil package given go new version (#1017) Co-authored-by: Jake Heath <76011913+jakeyheath@users.noreply.github.com> --- plugins/custom_plugin_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/custom_plugin_test.go b/plugins/custom_plugin_test.go index 61a98c6c8..241005d82 100644 --- a/plugins/custom_plugin_test.go +++ b/plugins/custom_plugin_test.go @@ -6,7 +6,6 @@ import ( "compress/gzip" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" @@ -78,7 +77,7 @@ func TestCustomPluginTarStripComponents(t *testing.T) { r.NoError(err) defer os.RemoveAll(d) - cacheDir, err := ioutil.TempDir("", "") + cacheDir, err := os.MkdirTemp("", "") r.NoError(err) defer os.RemoveAll(cacheDir) cache := plugins.GetPluginCache(cacheDir) @@ -139,7 +138,7 @@ func TestCustomPluginZip(t *testing.T) { r.NoError(err) defer os.RemoveAll(d) - cacheDir, err := ioutil.TempDir("", "") + cacheDir, err := os.MkdirTemp("", "") r.NoError(err) defer os.RemoveAll(cacheDir) cache := plugins.GetPluginCache(cacheDir) @@ -189,7 +188,7 @@ func TestCustomPluginBin(t *testing.T) { defer os.RemoveAll(d) fileContents := "some contents" - cacheDir, err := ioutil.TempDir("", "") + cacheDir, err := os.MkdirTemp("", "") r.NoError(err) defer os.RemoveAll(cacheDir) cache := plugins.GetPluginCache(cacheDir) @@ -220,7 +219,7 @@ func TestCustomPluginBin(t *testing.T) { f, err := fs.Open(customPluginPath) r.Nil(err) - contents, err := ioutil.ReadAll(f) + contents, err := io.ReadAll(f) r.Nil(err) r.Equal(string(contents), fileContents) @@ -233,7 +232,7 @@ func TestCustomPluginBin(t *testing.T) { func generateTar(t *testing.T, files []string, dirs []string) string { r := require.New(t) - f, err := ioutil.TempFile("", "testing") + f, err := os.CreateTemp("", "testing") r.Nil(err) defer f.Close() gw := gzip.NewWriter(f) @@ -269,7 +268,7 @@ func generateTar(t *testing.T, files []string, dirs []string) string { // based on https://golangcode.com/create-zip-files-in-go/ func generateZip(t *testing.T, files []string) string { r := require.New(t) - f, err := ioutil.TempFile("", "testing") + f, err := os.CreateTemp("", "testing") r.Nil(err) defer f.Close() From efe3bd2c4486a447805484885066e395a69af850 Mon Sep 17 00:00:00 2001 From: Annie Ku Date: Fri, 26 Apr 2024 16:59:02 -0700 Subject: [PATCH 2/2] fix: goreleaser small fixes to move away from deprecated configs (#1018) Co-authored-by: Jake Heath <76011913+jakeyheath@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- .goreleaser.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e55dffd4b..3d32c7ca0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} if: ${{ steps.release.outputs.release_created }} diff --git a/.goreleaser.yml b/.goreleaser.yml index f653fa3e7..a11907944 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -21,7 +21,7 @@ release: brews: - description: 'Terraform without pain.' - tap: + repository: owner: chanzuckerberg name: homebrew-tap homepage: 'https://github.com/chanzuckerberg/fogg'