Update golangci-lint, resolve warnings #285

Merged
fyrchik merged 1 commits from fyrchik/frostfs-node:fix-linter into master 2023-07-26 21:07:57 +00:00

Let me know if the last commit is too tricky, we can add nolint, though I'd like to avoid it.

Let me know if the last commit is _too_ tricky, we can add `nolint`, though I'd like to avoid it.
fyrchik force-pushed fix-linter from 85bb0dc564 to a7d1c97987 2023-04-26 08:50:23 +00:00 Compare
fyrchik reviewed 2023-04-26 08:56:25 +00:00
@ -33,3 +34,3 @@
func upperPowerOfTwo(v uint64) (upperBound uint64) {
for upperBound = firstBucketBound; upperBound < v; upperBound *= 2 {
if v <= firstBucketBound {
Poster
Owner

We also have this https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 , but it seems even less readable, though with a solid reference.

We also have this https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 , but it seems even less readable, though with a solid reference.
ale64bit reviewed 2023-04-26 09:42:23 +00:00
@ -36,3 +38,2 @@
}
return
return 1 << (64 - bits.LeadingZeros64(v-1))
Collaborator

You can simplify it a bit:

	return 1 << bits.Len64(v-1)

which is what bits.LeadingZeros64 does internally anyway.

Also, the upperBound named return value is not really needed anymore, is it?

You can simplify it a bit: ``` return 1 << bits.Len64(v-1) ``` which is what `bits.LeadingZeros64` [does internally](https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/math/bits/bits.go;l=37) anyway. Also, the `upperBound` named return value is not really needed anymore, is it?
Poster
Owner

Fixed

Fixed
ale64bit marked this conversation as resolved
fyrchik force-pushed fix-linter from a7d1c97987 to 37563c3c6e 2023-04-26 10:07:40 +00:00 Compare
fyrchik requested review from storage-core-committers 2023-04-26 10:19:14 +00:00
fyrchik requested review from storage-core-developers 2023-04-26 10:19:14 +00:00
ale64bit approved these changes 2023-04-26 10:52:43 +00:00
carpawell approved these changes 2023-04-26 11:51:47 +00:00
carpawell left a comment
Collaborator

if the last commit is too tricky

well, it took some time for me, so i have to say that it is not as regular as the previous for loop. i would keep for with some changes but that way looks cool to me too.

> if the last commit is too tricky well, _it took some time_ for me, so i have to say that it is not as regular as the previous `for` loop. i would keep `for` with some changes but that way looks cool to me too.
fyrchik force-pushed fix-linter from 37563c3c6e to 1f4061c0e2 2023-04-26 14:35:55 +00:00 Compare
fyrchik merged commit 1f4061c0e2 into master 2023-04-26 14:36:16 +00:00
fyrchik deleted branch fix-linter 2023-04-26 14:36:19 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#285
There is no content yet.