N
N
nikita_chiru2019-08-16 09:22:44
go
nikita_chiru, 2019-08-16 09:22:44

Why is the govalidator swearing at the generated uuidV4?

Generating with the library

github.com/nu7hatch/gouid

uuid.newv4
and this line cannot be validated.
What can be wrong?
This line is ca86c268-ce1b-46f5-4917-c1fe16caa986

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
falconandy, 2019-08-17
@nikita_chiru

If you look at the sources of govalidator, then the validity of uuid v4 is checked with a regular expression
The string "ca86c268-ce1b-46f5-4917-c1fe16caa986" does not match because the penultimate segment must begin with 8, 9, a or b.
Conforming to RFC 4122 Specification
Issue at github.com/nu7hatch/gouuid - Not compliant with RFC4122 spec
I used https://github.com/gofrs/uuid

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question