The go-uuid
library is NOT RFC4122 compliant. The variant bits are not set correctly. There have been several attempts by community members to have this fixed but pull requests for the fix are not being accepted.
You can generate UUIDs using the Go uuid library I rewrote based on the go-uuid
library. There are several fixes and improvements. This can be installed with:
go get github.com/twinj/uuid
You can generate random (version 4) UUIDs with:
import "github.com/twinj/uuid"
u := uuid.NewV4()
The returned UUID type is an interface and the underlying type is an array.
The library also generates v1 UUIDs and correctly generates v3 and 5 UUIDs. There are several new methods to help with printing and formatting and also new general methods to create UUIDs based off of existing data.