google/uuid

UUID to []byte?

mudream4869 opened this issue ยท 2 comments

Is there any function to get []byte from a UUID instance, or I should write the code as below?

func getBytes(u uuid.UUID) []byte {
	b := make([]byte, 16)
	for i := range b {
		b[i] = u[i]
	}
	return b
}

b := uuidInstance[:]

also, might see MarshalBinary