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

feat: unmarshal empty string as zero #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hunjixin
Copy link

No description provided.

Comment on lines +1319 to +1322
if len(str) == 0 {
*d = Zero
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this should be the default library behavior. I think in most cases empty string is treated as an incorrect value, we should not implicitly cast it to zero value. I understand there could be use cases for such behavior, but it should be at least hidden behind a config flag.
See #216 for additional details.

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