Hello there, please excuse the stupidity of my question.
I’m trying to switch from Java to Go and I was wondering if there is a way to create a UUID from a UTF-8 byte array of a string.
For example this is how I’d do it in Java: UUID.nameUUIDFromBytes((string).getBytes(Charsets.UTF_8));
I’ve tried the following Code and googled around for awhile but to no avail: bytes := make([]byte, 16) strings.NewReader(string).Read(bytes) print(fmt.Sprintf("%x-%x-%x-%x-%x", bytes[0:4], bytes[4:6], bytes[6:8], bytes[8:10], bytes[10:]))
But the UUID that it creates is much longer than in Java and is completely different characters.
Any help would be appreciated and again sorry if my question is stupidly simple to answer.
testing#123 isn’t a valid representation of any sort of UUID so I’m guessing there’s no standard to lean on here. The Go packages seams to just use the bytes straight up. The Java package does something else, not clear at all to me what by just looking at the UUID.