diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3210c58a..b35052e3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,15 +19,6 @@ jobs: go-version-file: './go.mod' check-latest: true - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Set up QEMU uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0 @@ -45,14 +36,6 @@ jobs: - name: Install syft uses: anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3 - - name: Cache - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - uses: chainguard-dev/actions/goimports@main - name: Run Mage @@ -90,15 +73,7 @@ jobs: with: go-version-file: './go.mod' check-latest: true - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: golangci-lint uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0 with: - version: v1.51.0 + version: v1.53 diff --git a/.golangci.yml b/.golangci.yml index ba3c1ee2..fe1bdf82 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,6 @@ linters: enable: - asciicheck - - depguard - errcheck - errorlint - gofmt diff --git a/Dockerfile b/Dockerfile index 0edf91c1..7fd22db4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.17 +FROM alpine:3.18 RUN apk --no-cache add ca-certificates git diff --git a/cr/cmd/docGen.go b/cr/cmd/docGen.go index fd6460ef..e9f4c15b 100644 --- a/cr/cmd/docGen.go +++ b/cr/cmd/docGen.go @@ -32,7 +32,7 @@ var generateDocsCmd = &cobra.Command{ RunE: generateDocs, } -func generateDocs(cmd *cobra.Command, args []string) error { +func generateDocs(_ *cobra.Command, _ []string) error { fmt.Println("Generating docs...") err := doc.GenMarkdownTree(rootCmd.Root(), "doc") diff --git a/magefile.go b/magefile.go index 52848b64..67813a6c 100644 --- a/magefile.go +++ b/magefile.go @@ -110,7 +110,7 @@ func Test() error { } func Build() error { - return sh.RunV("goreleaser", "release", "--rm-dist", "--snapshot", "--skip-sign") + return sh.RunV("goreleaser", "release", "--clean", "--snapshot", "--skip-sign") } func CI() error { @@ -137,5 +137,5 @@ func Release() error { return err } - return sh.RunV("goreleaser", "release", "--rm-dist") + return sh.RunV("goreleaser", "release", "--clean") } diff --git a/pkg/github/github.go b/pkg/github/github.go index a5ac5d0c..c63b6f13 100644 --- a/pkg/github/github.go +++ b/pkg/github/github.go @@ -85,7 +85,7 @@ func NewClient(owner, repo, token, baseURL, uploadURL string) *Client { } // GetRelease queries the GitHub API for a specified release object -func (c *Client) GetRelease(ctx context.Context, tag string) (*Release, error) { +func (c *Client) GetRelease(_ context.Context, tag string) (*Release, error) { // Check Release whether already exists or not release, _, err := c.Repositories.GetReleaseByTag(context.TODO(), c.owner, c.repo, tag) if err != nil { @@ -103,7 +103,7 @@ func (c *Client) GetRelease(ctx context.Context, tag string) (*Release, error) { } // CreateRelease creates a new release object in the GitHub API -func (c *Client) CreateRelease(ctx context.Context, input *Release) error { +func (c *Client) CreateRelease(_ context.Context, input *Release) error { req := &github.RepositoryRelease{ Name: &input.Name, Body: &input.Description, @@ -150,7 +150,7 @@ func (c *Client) CreatePullRequest(owner string, repo string, message string, he } // UploadAsset uploads specified assets to a given release object -func (c *Client) uploadReleaseAsset(ctx context.Context, releaseID int64, filename string) error { +func (c *Client) uploadReleaseAsset(_ context.Context, releaseID int64, filename string) error { filename, err := filepath.Abs(filename) if err != nil { return errors.Wrap(err, "failed to get abs path") @@ -161,7 +161,7 @@ func (c *Client) uploadReleaseAsset(ctx context.Context, releaseID int64, filena Name: filepath.Base(filename), } - if err := retry.Retry(3, 3*time.Second, func() error { + if err := retry.Retry(3, 3*time.Second, func() error { //nolint: revive f, err := os.Open(filename) if err != nil { return errors.Wrap(err, "failed to open file") diff --git a/pkg/releaser/releaser.go b/pkg/releaser/releaser.go index 059ec0eb..7974647e 100644 --- a/pkg/releaser/releaser.go +++ b/pkg/releaser/releaser.go @@ -296,10 +296,7 @@ func (r *Releaser) addToIndexFile(indexFile *repo.IndexFile, url string) error { } // Add to index - if err := indexFile.MustAdd(c.Metadata, filepath.Base(arch), strings.Join(s, "/"), hash); err != nil { - return err - } - return nil + return indexFile.MustAdd(c.Metadata, filepath.Base(arch), strings.Join(s, "/"), hash) } // CreateReleases finds and uploads Helm chart packages to GitHub diff --git a/pkg/releaser/releaser_test.go b/pkg/releaser/releaser_test.go index 2396891c..55c7841f 100644 --- a/pkg/releaser/releaser_test.go +++ b/pkg/releaser/releaser_test.go @@ -40,7 +40,7 @@ type FakeGit struct { mock.Mock } -func (f *FakeGit) AddWorktree(workingDir string, committish string) (string, error) { +func (f *FakeGit) AddWorktree(workingDir string, committish string) (string, error) { //nolint: revive dir, err := os.MkdirTemp("", "chart-releaser-") if err != nil { return "", err @@ -92,7 +92,7 @@ func (f *FakeGitHub) CreateRelease(ctx context.Context, input *github.Release) e return nil } -func (f *FakeGitHub) GetRelease(ctx context.Context, tag string) (*github.Release, error) { +func (f *FakeGitHub) GetRelease(ctx context.Context, tag string) (*github.Release, error) { //nolint: revive release := &github.Release{ Name: "testdata/release-packages/test-chart-0.1.0", Description: "A Helm chart for Kubernetes",