-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fix 32-bit build #158
Fix 32-bit build #158
Conversation
When trying to build for 32-bit ARM (linux/arm), you get: ``` pkg/remote/client.go:120:35: cannot use 0xffffffff (untyped int constant 4294967295) as int value in argument to fmt.Errorf (overflows) ``` Pass the constant as unsigned 64-bit integer, which is what the underlying snappy code is doing (it's casting the argument to an uint64 and comparing against 0xffffffff, which in Go means it's comparing against uint64(0xffffffff)). Since this is just an error message, it shouldn't matter, but let's be consistent. Signed-off-by: Marcelo E. Magallon <[email protected]>
Sorry about recreating the PR instead of reopening the old one (#132). My bad. I reworded the commit message to reflect the fact that this is not specific to ARM. The reason why I would like to have this is because I would like to run k6 on linux/arm (Raspberry Pi and whatnot). |
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.
Hey @mem,
I think my comment on the previous PR #132 (comment) is still valid, can you take a look into it, please?
pkg/remote/client.go
Outdated
@@ -117,7 +117,7 @@ func newWriteRequestBody(series []*prompb.TimeSeries) ([]byte, error) { | |||
} | |||
if snappy.MaxEncodedLen(len(b)) < 0 { | |||
return nil, fmt.Errorf("the protobuf message is too large to be handled by Snappy encoder; "+ | |||
"size: %d, limit: %d", len(b), 0xffffffff) | |||
"size: %d, limit: %d", len(b), uint64(0xffffffff)) |
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.
"size: %d, limit: %d", len(b), uint64(0xffffffff)) | |
"size: %d, limit: %d", len(b), math.MaxUint32) |
I think something like that could be better as self-documenting code so we don't have to remember why we did it. @mem Can you try if it works on your 32-bit arch, please?
When trying to build for 32-bit ARM (linux/arm), you get:
Pass the constant as unsigned 64-bit integer, which is what the underlying snappy code is doing (it's casting the argument to an uint64 and comparing against 0xffffffff, which in Go means it's comparing against uint64(0xffffffff)). Since this is just an error message, it shouldn't matter, but let's be consistent.