Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Conversation

mem
Copy link
Contributor

@mem mem commented Oct 31, 2023

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.

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 <marcelo.magallon@grafana.com>
@mem mem requested a review from a team as a code owner October 31, 2023 20:01
@mem mem requested review from mstoykov and codebien and removed request for a team October 31, 2023 20:01
@mem
Copy link
Contributor Author

mem commented Oct 31, 2023

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

Copy link
Contributor

@codebien codebien left a 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?

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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?

@codebien codebien merged commit 4737495 into main Dec 19, 2023
@codebien codebien deleted the mem/fix-32-bit-build branch December 19, 2023 15:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants