Skip to content

Commit

Permalink
linters: fix for golangci-lint v1.55
Browse files Browse the repository at this point in the history
  • Loading branch information
twmb committed Oct 21, 2023
1 parent 5cfb6a5 commit 7e83e62
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
7 changes: 3 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -68,15 +68,14 @@ linters-settings:
#
# https://github.com/mvdan/gofumpt/issues/137
gofumpt:
lang-version: "1.19"
lang-version: "1.21"
extra-rules: true

gosec:
excludes:
- 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.
Expand Down Expand Up @@ -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"]
3 changes: 1 addition & 2 deletions pkg/kgo/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions pkg/kgo/ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion pkg/sasl/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}

Expand Down

0 comments on commit 7e83e62

Please sign in to comment.