google / uuid

Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should uuid.Nil marshal to null instead of all zeroes

maroux opened this issue · comments

The library uses the uuid.Nil value as an empty value. This suggests to me that Nil value is treated as a special value, which is in line with the RFC. However, the behavior of this value when marshaling to json is questionable. The library serializes to 00000000-0000-0000-0000-000000000000 (play) instead of null. Should this behavior be changed? Marshaling to text can probably yield an error, or just empty string, not sure.