-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: upgrade to golangci-lint v1.39.0 #22696
Conversation
header.Data = (*reflect.SliceHeader)(unsafe.Pointer(&mem)).Data | ||
header.Cap = len(mem) / 4 | ||
header.Len = header.Cap | ||
return mem, view, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other similar conversions seem a bit different. Perhaps lets do this part the same way?
var cache []byte
cacheHdr := (*reflect.SliceHeader)(unsafe.Pointer(&cache))
dstHdr := (*reflect.SliceHeader)(unsafe.Pointer(&dest))
cacheHdr.Data = dstHdr.Data
cacheHdr.Len = dstHdr.Len * 4
cacheHdr.Cap = dstHdr.Cap * 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no real difference between what you posted and what's in the diff.
In the []uint32
to []byte
conversion in algorithm.go, it accesses the length of the
slice header instead of calling len
. But they give the same result, and I prefer using len
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the difference is that the alternative uses dstHdr
to retrieve the Len and Cap (no idea where these come from), vs you assume these will have certain values based on mem
. I'm almost certain your code is fine since we never append to these constructed slices, but unsure what would hapen if we did.
* build: upgrade to golangci-lint v1.39.0 * consensus/ethash: fix go vet warning regarding reflect.SliceHeader * eth/catalyst: fix lint issue * consensus/ethash: fix bug in memoryMapFile
This updates the lint tool and fixes the issues reported by the new tool version.