Show HN: Go library for concise, unambiguous and URL-safe UUIDs
github.com
github.com
I'm actually pretty surprised, as I do this quite often and it's rare that something gets 100% across the board on the first try. Not that it's necessarily difficult, but I find people normally don't use all 3 of "gofmt -s", "golint", and "go vet". Anyway, nicely done.
To lessen ambiguity even more, there's Crockford Encoding[0]. Results in longer strings, but there's no case distinction, and the similar looking characters decode the same. Looks like you can get mostly Crockford Encoding using this library by changing the character set (which is why said "the defaults" above). The check digit in Crockford Encoding is a huge win for when these are dictated/transcribed, but may need to be URL-encoded.
// Note that this will create a new UUID each time its .String() method
// is invoked.
fmt.Printf("%s", u) // Cekw67uyMpBGZLRP2HFVbe
fmt.Printf("%s", u) // 4pUYNRFHTG3YVgThPZvCgC
Just imagine an user using u directly instead of assigning to a var: token := "secret" + u
othertoken := "app" + uuuid_generator would be far less likely to be misused than u.
For whatever reason, however, descriptive variables are not very popular in the Go community.