You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs state the following about null.String.IsZero:
IsZero returns true for null or empty strings, for future omitempty support. (Go 1.4?)
Will return false s if blank but non-null.
Which looks like a contradictory statement. In a test with an empty string, the latter held true: false is returned if the string is equal to "". Could either the behavior of IsZero() change to return true if string equals empty string or the docs be clarified?
Thanks.
The text was updated successfully, but these errors were encountered:
Whoops. That was the old behavior in null.v2, if you use v2 you can still get it. Alternatively you can use zero.String and it will have similar semantics. I will fix the docs.
Alright, I fixed the docs in aa8aa51.
If you would like null.String to have the behavior you described, consider using null.v2 instead of v3, or using a zero.String instead of a null.String.
null.String's behavior was changed in v3 to make it more consistent with the rest of the null package. See #10 for more info about this. 🙇
The docs state the following about null.String.IsZero:
Which looks like a contradictory statement. In a test with an empty string, the latter held true:
false
is returned if the string is equal to "". Could either the behavior of IsZero() change to returntrue
if string equals empty string or the docs be clarified?Thanks.
The text was updated successfully, but these errors were encountered: