Skip to content

Commit

Permalink
Merge pull request #436 from hypnoglow/update-go-golangci
Browse files Browse the repository at this point in the history
Update Go, golangci-lint
  • Loading branch information
hypnoglow authored Jul 4, 2024
2 parents ddc50e0 + a91cad7 commit 50ade6b
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 18 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ jobs:
uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5

- name: Run linters
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
version: v1.48
version: v1.59.1
args: --verbose
# See: https://github.com/golangci/golangci-lint-action/issues/244
skip-pkg-cache: true
skip-build-cache: true

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0
Expand Down
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ linters:
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
- exhaustive
Expand Down Expand Up @@ -39,13 +37,11 @@ linters:
- rowserrcheck
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

linters-settings:
Expand All @@ -67,3 +63,7 @@ issues:
- linters:
- staticcheck
text: "strings.Title has been deprecated"
# TODO: fix this later.
- linters:
- revive
text: "^unused-parameter"
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
golang 1.19.13
golang 1.22.5
helm 3.13.2
golangci-lint 1.48.0
golangci-lint 1.59.1
goreleaser 2.0.1
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `generated` timestamp field in the index file is now updated with current time
on push, reindex and delete.

- Go updated to 1.22.

## [0.16.0] - 2023-12-07

### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GO_VERSION=1.19
ARG GO_VERSION=1.22
ARG HELM_VERSION

FROM golang:${GO_VERSION}-alpine as build
Expand Down
7 changes: 7 additions & 0 deletions cmd/helm-s3/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ func newInitCommand(opts *options) *cobra.Command {
flags.BoolVar(&act.force, "force", act.force, "Replace the index file if it already exists.")
flags.BoolVar(&act.ignoreIfExists, "ignore-if-exists", act.ignoreIfExists, "If the index file already exists, exit normally and do not trigger an error.")

// We don't use cobra's feature
//
// cmd.MarkFlagsMutuallyExclusive("force", "ignore-if-exists")
//
// because the error message is confusing. Instead, we check the flags
// manually in run().

return cmd
}

Expand Down
7 changes: 7 additions & 0 deletions cmd/helm-s3/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func newPushCommand(opts *options) *cobra.Command {
flags.BoolVar(&act.ignoreIfExists, "ignore-if-exists", act.ignoreIfExists, "If the chart already exists, exit normally and do not trigger an error.")
flags.BoolVar(&act.relative, "relative", act.relative, "Use relative chart URL in the index instead of absolute.")

// We don't use cobra's feature
//
// cmd.MarkFlagsMutuallyExclusive("force", "ignore-if-exists")
//
// because the error message is confusing. Instead, we check the flags
// manually in run().

return cmd
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hypnoglow/helm-s3

go 1.19
go 1.22

require (
github.com/Masterminds/semver v1.5.0
Expand Down
35 changes: 35 additions & 0 deletions go.sum

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions internal/awss3/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (s *Storage) Traverse(ctx context.Context, repoURI string) (<-chan ChartInf
// traverse traverses all charts in the repository.
// It writes an info item about every chart to items, and errors to errs.
// It always closes both channels when returns.
func (s *Storage) traverse(ctx context.Context, repoURI string, items chan<- ChartInfo, errs chan<- error) { //nolint:unparam // TODO: fix this issue.
func (s *Storage) traverse(ctx context.Context, repoURI string, items chan<- ChartInfo, errs chan<- error) {
defer close(items)
defer close(errs)

Expand All @@ -80,7 +80,7 @@ func (s *Storage) traverse(ctx context.Context, repoURI string, items chan<- Cha

var continuationToken *string
for {
listOut, err := client.ListObjectsV2(&s3.ListObjectsV2Input{
listOut, err := client.ListObjectsV2WithContext(ctx, &s3.ListObjectsV2Input{
Bucket: aws.String(bucket),
Prefix: aws.String(prefixKey),
ContinuationToken: continuationToken,
Expand Down Expand Up @@ -110,7 +110,7 @@ func (s *Storage) traverse(ctx context.Context, repoURI string, items chan<- Cha
continue
}

metaOut, err := client.HeadObject(&s3.HeadObjectInput{
metaOut, err := client.HeadObjectWithContext(ctx, &s3.HeadObjectInput{
Bucket: aws.String(bucket),
Key: obj.Key,
})
Expand All @@ -134,7 +134,7 @@ func (s *Storage) traverse(ctx context.Context, repoURI string, items chan<- Cha
// https://github.com/hypnoglow/helm-s3/issues/112 )
//
// In this case we have to download the ch file itself.
objectOut, err := client.GetObject(&s3.GetObjectInput{
objectOut, err := client.GetObjectWithContext(ctx, &s3.GetObjectInput{
Bucket: aws.String(bucket),
Key: obj.Key,
})
Expand Down Expand Up @@ -229,7 +229,7 @@ func (s *Storage) Exists(ctx context.Context, uri string) (bool, error) {
return false, err
}

_, err = s3.New(s.session).HeadObject(&s3.HeadObjectInput{
_, err = s3.New(s.session).HeadObjectWithContext(ctx, &s3.HeadObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
})
Expand Down

0 comments on commit 50ade6b

Please sign in to comment.