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

decodeInt throws an error for an empty string #206

Closed
elledoo opened this issue Sep 18, 2020 · 1 comment
Closed

decodeInt throws an error for an empty string #206

elledoo opened this issue Sep 18, 2020 · 1 comment

Comments

@elledoo
Copy link

@elledoo elledoo commented Sep 18, 2020

Hi!
Is it by design that decoding an empty string with decodeInt (case dataKind == reflect.String && d.config.WeaklyTypedInput) throws an error? There is no check for an empty string and strconv.ParseInt does indeed throw an error when an empty string is encountered. I would rather expect to be able to decode an empty string to 0 for WeaklyTypedInput

@mitchellh
Copy link
Owner

@mitchellh mitchellh commented Nov 26, 2020

No, it should probably return 0 as you suggest.

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

Successfully merging a pull request may close this issue.

None yet
2 participants