From 0d2238dc3ee69152d69104da32479f57898c18b2 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Mon, 19 Sep 2022 10:14:53 +0200 Subject: [PATCH] upgrade go to 1.19 and pin cosign-installer to v2 (#203) * upgrade go to 1.19 and pin cosign-installer to v2 Signed-off-by: cpanato * update golangci-lint to v1.48.0 Signed-off-by: cpanato * remove io/ioutil deprecations Signed-off-by: cpanato Signed-off-by: cpanato --- .github/workflows/ci.yaml | 2 +- go.mod | 2 +- pkg/git/git.go | 3 +-- pkg/packager/packager.go | 4 ++-- pkg/packager/packager_test.go | 3 +-- pkg/releaser/releaser_test.go | 7 +++---- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9d27c6c..22fbfc9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -81,4 +81,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.46.2 + version: v1.48.0 diff --git a/go.mod b/go.mod index 5fe3b42..9a5557a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/helm/chart-releaser -go 1.18 +go 1.19 require ( github.com/Songmu/retry v0.1.0 diff --git a/pkg/git/git.go b/pkg/git/git.go index 27a5941..79dd12f 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -16,7 +16,6 @@ package git import ( "fmt" - "io/ioutil" "os" "os/exec" "strings" @@ -26,7 +25,7 @@ type Git struct{} // AddWorktree creates a new Git worktree with a detached HEAD for the given committish and returns its path. func (g *Git) AddWorktree(workingDir string, committish string) (string, error) { - dir, err := ioutil.TempDir("", "chart-releaser-") + dir, err := os.MkdirTemp("", "chart-releaser-") if err != nil { return "", err } diff --git a/pkg/packager/packager.go b/pkg/packager/packager.go index 0a68602..0feb1c9 100644 --- a/pkg/packager/packager.go +++ b/pkg/packager/packager.go @@ -16,7 +16,7 @@ package packager import ( "fmt" - "io/ioutil" + "io" "os" "path/filepath" @@ -67,7 +67,7 @@ func (p *Packager) CreatePackages() error { } downloadManager := &downloader.Manager{ - Out: ioutil.Discard, + Out: io.Discard, ChartPath: path, Keyring: helmClient.Keyring, Getters: getters, diff --git a/pkg/packager/packager_test.go b/pkg/packager/packager_test.go index 7e4d1f3..603ea19 100644 --- a/pkg/packager/packager_test.go +++ b/pkg/packager/packager_test.go @@ -15,7 +15,6 @@ package packager import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -27,7 +26,7 @@ import ( ) func TestPackager_CreatePackages(t *testing.T) { - packagePath, _ := ioutil.TempDir(".", "packages") + packagePath, _ := os.MkdirTemp(".", "packages") invalidPackagePath := filepath.Join(packagePath, "bad") file, _ := os.Create(invalidPackagePath) t.Cleanup(func() { diff --git a/pkg/releaser/releaser_test.go b/pkg/releaser/releaser_test.go index e6d0ce2..33ce966 100644 --- a/pkg/releaser/releaser_test.go +++ b/pkg/releaser/releaser_test.go @@ -17,7 +17,6 @@ package releaser import ( "context" "fmt" - "io/ioutil" "os" "path/filepath" "testing" @@ -41,7 +40,7 @@ type FakeGit struct { } func (f *FakeGit) AddWorktree(workingDir string, committish string) (string, error) { - dir, err := ioutil.TempDir("", "chart-releaser-") + dir, err := os.MkdirTemp("", "chart-releaser-") if err != nil { return "", err } @@ -98,7 +97,7 @@ func (f *FakeGitHub) CreatePullRequest(owner string, repo string, message string } func TestReleaser_UpdateIndexFile(t *testing.T) { - indexDir, _ := ioutil.TempDir(".", "index") + indexDir, _ := os.MkdirTemp(".", "index") defer os.RemoveAll(indexDir) fakeGitHub := new(FakeGitHub) @@ -180,7 +179,7 @@ func TestReleaser_UpdateIndexFile(t *testing.T) { } func TestReleaser_UpdateIndexFileGenerated(t *testing.T) { - indexDir, _ := ioutil.TempDir(".", "index") + indexDir, _ := os.MkdirTemp(".", "index") defer os.RemoveAll(indexDir) fakeGitHub := new(FakeGitHub)