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
This is a known "feature" and has been discussed before. Fixing this could very well break existing code. I actually don't see any issue with the first and third examples. The current code also can parse [6ba7b810-9dad-11d1-80b4-00c04fd430c8], <6ba7b810-9dad-11d1-80b4-00c04fd430c8>, (6ba7b810-9dad-11d1-80b4-00c04fd430c8), '6ba7b810-9dad-11d1-80b4-00c04fd430c8' all of which I have no particular problem with. I agree that the seocnd example does not return an error is unfortunate. In any event, the time for this change has long since passed.
If validating, rather than just parsing, strings as UUIDs I could imagine a function like:
func Validate(s string) (uuid, error) {
if len(s) == 36 + 2 {
// do some checks
}
return Parse(s)
}
it seems that there are some cases where
uuid.Parse
is not throwing an error for invalid uuidsexamples of invalid UUID's that do not give errors
-6ba7b810-9dad-11d1-80b4-00c04fd430c8-
06ba7b810-9dad-11d1-80b4-00c04fd430c81
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
see here for a reproducible example
The text was updated successfully, but these errors were encountered: