-
Notifications
You must be signed in to change notification settings - Fork 115
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
Update message unimarshaller functions #291
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #291 +/- ##
==========================================
- Coverage 74.91% 74.75% -0.17%
==========================================
Files 43 43
Lines 2436 2452 +16
==========================================
+ Hits 1825 1833 +8
- Misses 389 396 +7
- Partials 222 223 +1
☔ View full report in Codecov by Sentry. |
It looks good! Would you please add table tests for Marshal/Unmarshal something like this: https://github.com/moov-io/iso8583/blob/2f44c9f5c9bf72927313d35e4dfaa478711943fb/exp_test.go? |
I will append exp_test.go in next pr |
@@ -153,7 +153,7 @@ func (f *String) Unmarshal(v interface{}) error { | |||
} | |||
|
|||
func (f *String) Marshal(v interface{}) error { | |||
if v == nil || reflect.ValueOf(v).IsZero() { | |||
if v == nil || (!reflect.ValueOf(v).CanInt() && reflect.ValueOf(v).IsZero()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we add keepzero
we should check if value is 0
(int/*int) for field.String
, then we should assign it.
Also, it may be similar to some other types. Not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
the code is exception for having int value zero
#282