How to validate UUID v4 in Go?

Regex is expensive. The following approach is ~18x times faster than the regex version.

Use something like https://godoc.org/github.com/google/uuid#Parse instead.

import "github.com/google/uuid"

func IsValidUUID(u string) bool {
    _, err := uuid.Parse(u)
    return err == nil
 }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)