Skip to content

Commit

Permalink
Fix 32-bit build (#158)
Browse files Browse the repository at this point in the history
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]>
Co-authored-by: codebien <[email protected]>
  • Loading branch information
mem and codebien authored Dec 19, 2023
1 parent 7e717fb commit 4737495
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/remote/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"crypto/tls"
"fmt"
"io"
"math"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -117,7 +118,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), math.MaxUint32)
}
return snappy.Encode(nil, b), nil
}
Expand Down

0 comments on commit 4737495

Please sign in to comment.