uuid icon indicating copy to clipboard operation
uuid copied to clipboard

panic: uuid: Parse(): invalid UUID length: 0

Open ahloul opened this issue 1 year ago • 1 comments

I got this issue panic: uuid: Parse(): invalid UUID length: 0

ahloul avatar Apr 11 '23 19:04 ahloul

could you elaborate on how to replicate the panic?

toothsy avatar Jun 27 '23 14:06 toothsy

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.

jensilo avatar Jul 09 '24 13:07 jensilo

As mentioned, this is the correct behavior of MustParse. Normally MustParse is used during initialization with fixed strings.

bormanp avatar Jul 09 '24 13:07 bormanp