validator
validator copied to clipboard
[Bug]: validation of uuidv4 failed with valid uuidv4
What happened?
The validation of the a uuid failed with a valid v4 uuid.
https://go.dev/play/p/LUMbUHajvZX
Version
v10
Example Code
const uuidStr = "e3e70682-c209-4cac-629f-6fbed82c07cd"
type test struct {
Uuid string `json:"uuid" validate:"uuid4_rfc4122|uuid4"`
}
testVar := test{
Uuid: uuidStr,
}
valid := validator.New()
err := valid.Struct(&testVar)
if err != nil {
fmt.Printf("err: %+v\n", err)
os.Exit(-1)
}
Hmm... Here is my version of the UUID v4 test: https://go.dev/play/p/b7oBGW6_i3i
@hdr1210 are you sure that uuidStr = "e3e70682-c209-4cac-629f-6fbed82c07cd" is uuid v4?
Thanks for the quick reply. I found out that the google package validates the uuid as correct, but apparently this address is invalid. The first character in the fourth segment should be a 8 , 9 , a, b, c or d.