uuid
uuid copied to clipboard
panic: uuid: Parse(): invalid UUID length: 0
I got this issue panic: uuid: Parse(): invalid UUID length: 0
could you elaborate on how to replicate the panic?
I guess, I know: uuid.MustParse.
https://github.com/google/uuid/blob/0f11ee6918f41a04c201eceeadf612a377bc7fbc/uuid.go#L169
@ahloul use uuid.MustParse very wisely as it panics if the provided uuid.UUID is not parsable. Otherwise, use uuid.Parse and it returns an error if the provided string can't be parsed as UUID.
As mentioned, this is the correct behavior of MustParse. Normally MustParse is used during initialization with fixed strings.