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.
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.
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.
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.