What steps will reproduce the problem?
1. Create a new UUID
2. Marshal said UUID
3. Unmarshal the result of 2 into a new UUID
What is the expected output? What do you see instead?
Both UUIDs should be equal. Instead, step 3 throws an Unmarshal error.
Marshaling occurs as is typical for byte slices--it is encoded as a string--but
Unmarshaling cannot unmarshal a string to type UUID.
What version of the product are you using? On what operating system?
This was confirmed in Go 1.2rc3 on the Go playground:
http://play.golang.org/p/BUo5pw9BAO. It is running against the latest master of
go-uuid, 7dda39b2e7d5.
Please provide any additional information below.
This should be simple enough to fix: extend the UUID type to implement
Marshaler and Unmarshaler. I would expect them to call json.Marshal on
id.String() (where id is a UUID), and json.Unmarshal, followed by Parse() on
the result.
If this were on Github or something similar, I'd submit a pull request.
Unfortunately, I'm unsure as to how to do that on Google Code. Instead, I've
implemented a variation on the Go Playground:
http://play.golang.org/p/OXjK4Jdd7w
This could be implemented by aliasing the UUID type locally an extending it,
but that seems like a silly wrapper to maintain, rather than adding two
functions to go-uuid.