Want a UUID generator for your Go code? It’s likely you’ll need one sometime. Well here’s a short code snippet and a review of one of the available UUID libraries available.
The library is avaliable at https://github.com/satori/go.uuid.
With test coverage this library supports the following UUID types. I’ll elaborate on what each of these types are after a code snippet or two.
- Version 1, based on timestamp and MAC address (RFC 4122)
- Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1)
- Version 3, based on MD5 hashing (RFC 4122)
- Version 4, based on random numbers (RFC 4122)
- Version 5, based on SHA-1 hashing (RFC 4122)
First step. Get the library.
go get github.com/satori/go.uuid
Obviously it isn’t Monday. But sometimes you go to a show on Sunday and you’re recovering on Monday and writing a blog entry just isn’t a priority. But in that vein, here’s the line up for the Bound by the Road Tour I dived into the pit for this last Sunday!