From 7e83e62cadcf4c0c2c659d9a8f3f38ba48cddf80 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Fri, 20 Oct 2023 19:15:46 -0600 Subject: [PATCH] linters: fix for golangci-lint v1.55 --- .golangci.yml | 7 +++---- pkg/kgo/consumer.go | 3 +-- pkg/kgo/ring.go | 11 +++++------ pkg/sasl/aws/aws.go | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 0ad253b4..600552cc 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,7 @@ # We may as well allow multiple golangci-lint invocations at once. run: allow-parallel-runners: true - go: "1.19" + go: "1.21" # golangci-lint by default ignores some staticcheck and vet raised issues that # are actually important to catch. The following ensures that we do not ignore @@ -68,7 +68,7 @@ linters-settings: # # https://github.com/mvdan/gofumpt/issues/137 gofumpt: - lang-version: "1.19" + lang-version: "1.21" extra-rules: true gosec: @@ -76,7 +76,6 @@ linters-settings: - G104 # unhandled errors, we exclude for the same reason we do not use errcheck - G404 # we want math/rand - # Gocritic is a meta linter that has very good lints, and most of the # experimental ones are very good too. We opt into everything, which helps # us when we upgrade golangci-lint, and we specifically opt out of a batch. @@ -164,5 +163,5 @@ linters-settings: # contexts for beneficial reasons, and we disable the SSLv3 deprecation # warning because this is solely for a debug log. staticcheck: - go: "1.19" + go: "1.21" checks: ["all", "-SA1012", "-SA1019"] diff --git a/pkg/kgo/consumer.go b/pkg/kgo/consumer.go index caf98a6d..475270ed 100644 --- a/pkg/kgo/consumer.go +++ b/pkg/kgo/consumer.go @@ -41,9 +41,8 @@ func (o Offset) String() string { return fmt.Sprintf("{%d e%d ce%d}", o.at, o.epoch, o.currentEpoch) } else if o.relative > 0 { return fmt.Sprintf("{%d+%d e%d ce%d}", o.at, o.relative, o.epoch, o.currentEpoch) - } else { - return fmt.Sprintf("{%d-%d e%d ce%d}", o.at, -o.relative, o.epoch, o.currentEpoch) } + return fmt.Sprintf("{%d-%d e%d ce%d}", o.at, -o.relative, o.epoch, o.currentEpoch) } // EpochOffset returns this offset as an EpochOffset, allowing visibility into diff --git a/pkg/kgo/ring.go b/pkg/kgo/ring.go index 43ee72a6..3ef989f4 100644 --- a/pkg/kgo/ring.go +++ b/pkg/kgo/ring.go @@ -260,11 +260,10 @@ func (r *ringBatchPromise) dropPeek() (next batchPromise, more bool) { return next, false } return r.overflow[0], true - } else { - r.overflow = r.overflow[1:] - if len(r.overflow) > 0 { - return r.overflow[0], true - } - return next, false } + r.overflow = r.overflow[1:] + if len(r.overflow) > 0 { + return r.overflow[0], true + } + return next, false } diff --git a/pkg/sasl/aws/aws.go b/pkg/sasl/aws/aws.go index 685e1d7b..89f9cc33 100644 --- a/pkg/sasl/aws/aws.go +++ b/pkg/sasl/aws/aws.go @@ -201,7 +201,7 @@ func task1(host, qps string) []byte { // Finally, we add our empty body. // // HexEncode(Hash(RequestPayload)) - const emptyBody = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" //nolint:gosec // this is a defined constant hash of an empty body + const emptyBody = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" return append(canon, emptyBody...) }