Skip to content
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

Error build on 32 bits arch #103

Closed
rfccg opened this issue Feb 15, 2018 · 1 comment
Closed

Error build on 32 bits arch #103

rfccg opened this issue Feb 15, 2018 · 1 comment

Comments

@rfccg
Copy link
Contributor

rfccg commented Feb 15, 2018

As I try to build my code using a 32 bits architecture with goavro as a dependency I get the following error:

vendor/github.com/linkedin/goavro/array.go:48:34: constant -9223372036854775808 overflows int
vendor/github.com/linkedin/goavro/array.go:86:35: constant -9223372036854775808 overflows int
vendor/github.com/linkedin/goavro/binaryReader.go:96:27: constant -9223372036854775808 overflows int
vendor/github.com/linkedin/goavro/binaryReader.go:144:28: constant -9223372036854775808 overflows int
vendor/github.com/linkedin/goavro/map.go:50:34: constant -9223372036854775808 overflows int
vendor/github.com/linkedin/goavro/map.go:97:35: constant -9223372036854775808 overflows int

To build I used the following command:

GOOS=linux GOARCH=386 go build -a --ldflags="-s" -o bin/injector cmd/injector.go

As I looked at the code all lines that were producing errors are fmt.Errorf that prints the math.MinInt64.
To fix the problem is easy. In the array.go file just replace:

if blockCount == math.MinInt64 {
    // The minimum number for any signed numerical type can never be made positive
    return nil, nil, fmt.Errorf("cannot decode binary array with block count: %d", math.MinInt64)
}

with:

if blockCount == math.MinInt64 {
    // The minimum number for any signed numerical type can never be made positive
    return nil, nil, fmt.Errorf("cannot decode binary array with block count: %d", blockCount)
}

What happens is that for any reason math.MinInt64 is a constant and not a int64.

@karrick
Copy link
Contributor

karrick commented Feb 19, 2018

I'm closing this issue because I have merged in your PR. Thanks again for your help getting 32-bit architecture supported!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants