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

Safe cast for uint #2659

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Safe cast for uint #2659

wants to merge 2 commits into from

Conversation

monlu92
Copy link

@monlu92 monlu92 commented Jun 2, 2023

Negative integers would convert into big uint's instead of failing.
I have added tests covering the case.

@coveralls
Copy link

Coverage Status

coverage: 79.191% (+0.06%) from 79.131% when pulling 78f39d6 on monlu92:master into dbb6117 on 99designs:master.

@StevenACoffman
Copy link
Collaborator

Looks like some lint and test failures. Can you try this:

go generate ./...; cd _examples; go generate ./...; cd ..; go test ./...; cd _examples; go test ./...

@chadxzs
Copy link

chadxzs commented Jun 5, 2023

Nice small improvement @monlu92! Did you run into this as a bug in the wild? Or find it through some other means?

@monlu92
Copy link
Author

monlu92 commented Jun 7, 2023

@chadxzs thanks! I did just find it in the wild when making some graphQL resolvers, great library otherwise though :)

@StevenACoffman
Copy link
Collaborator

I like this functionality, but it is implemented using golang.org/x/exp per https://pkg.go.dev/golang.org/x/exp#section-readme:

Warning: Packages here are experimental and unreliable. Some may one day be promoted to the main repository or other subrepository, or they may be modified arbitrarily or even disappear altogether.

Is it possible to implement this without dependending on an unreliable package? Also, there are merge conflicts, so it needs to be rebased.

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.

None yet

6 participants