79339411

Date: 2025-01-08 13:50:04
Score: 1
Natty:
Report link

Since Dec 12, 2023 there is a new feature to validate directly by string: https://github.com/google/uuid/commit/9ee7366e66c9ad96bab89139418a713dc584ae29

var string anyUUID = "elmo"
err := uuid.Validate(anyUUID) // will result in an error

Live example: https://go.dev/play/p/QIzW63S0Oda

This is very useful when it comes to testing:

assert.NoError(t, uuid.Validate(anyUUID))
Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
Posted by: Kevin