Over the past few months I’ve been working, somewhat on the down low, as I get settled into Seattle, the daily flow, and life slightly north of Portland. I’ve gotten a solid footing on things now and am ready to announce what exactly I’m up to. Nothing is hugely surprising to anyone I’ve shared a beer or bike ride with in the last half a year, but for those I haven’t had the pleasure, here’s the details.
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