MCPcopy
hub / github.com/google/uuid / MustParse

Function MustParse

uuid.go:194–200  ·  uuid.go::MustParse

MustParse is like Parse but panics if the string cannot be parsed. It simplifies safe initialization of global variables holding compiled UUIDs.

(s string)

Source from the content-addressed store, hash-verified

192// MustParse is like Parse but panics if the string cannot be parsed.
193// It simplifies safe initialization of global variables holding compiled UUIDs.
194func MustParse(s string) UUID {
195 uuid, err := Parse(s)
196 if err != nil {
197 panic(`uuid: Parse(` + s + `): ` + err.Error())
198 }
199 return uuid
200}
201
202// FromBytes creates a new UUID from a byte slice. Returns an error if the slice
203// does not have a length of 16. The bytes are copied from the slice.

Callers 10

hash.goFile · 0.85
TestScanFunction · 0.85
TestValueFunction · 0.85
TestNullUUIDValueFunction · 0.85
TestNullUUIDMarshalTextFunction · 0.85
TestNullUUIDMarshalJSONFunction · 0.85
json_test.goFile · 0.85

Calls 2

ParseFunction · 0.85
ErrorMethod · 0.45

Tested by 8

TestScanFunction · 0.68
TestValueFunction · 0.68
TestNullUUIDValueFunction · 0.68
TestNullUUIDMarshalTextFunction · 0.68
TestNullUUIDMarshalJSONFunction · 0.68