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

Fix MaxInt64 overflows on ARM 32-bits #575

Merged
merged 3 commits into from
Feb 21, 2023

Conversation

rayae
Copy link
Contributor

@rayae rayae commented Feb 16, 2023

math.MaxInt64 is untyped constant. This causes overflow on a 32-bit system.

Reproduce:

$ GOARCH=arm go build example/config/main.go 
go: downloading golang.org/x/net v0.0.0-20210525063256-abc453219eb5
go: downloading golang.org/x/sys v0.0.0-20220114195835-da31bd327af9
go: downloading golang.org/x/text v0.3.6
# github.com/nacos-group/nacos-sdk-go/v2/clients/config_client
clients\config_client\config_client.go:141:45: math.MaxInt64 (untyped int constant 9223372036854775807) overflows int

Edit:
clients\config_client\config_client.go:141:45

max := int64(math.MaxInt64)

Copy link
Member

@binbin0325 binbin0325 left a comment

Choose a reason for hiding this comment

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

math.MaxInt may be better

Copy link
Contributor Author

@rayae rayae left a comment

Choose a reason for hiding this comment

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

yes its better

@rayae
Copy link
Contributor Author

rayae commented Feb 17, 2023

i have tested with math.MaxInt and it works fine

@rayae rayae closed this Feb 21, 2023
@rayae rayae reopened this Feb 21, 2023
@binbin0325 binbin0325 merged commit 8c02e5d into nacos-group:master Feb 21, 2023
@rayae rayae deleted the fix-MaxInt64-overflows-on-ARM branch March 29, 2023 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants