Commit Graph

6 Commits

Author SHA1 Message Date
Josselin Costanzi 75cca531ea Fix potential non-random UUIDs
Use ReadFull to fetch random bytes from crypto/rand instead of calling
Read directly as Read may read less bytes than asked.

Fix satori/go.uuid#73
2018-04-04 18:55:56 +02:00
Maxim Bublis c596ec5726 Add more test cases.
Better coverage for faulty rand or missing network interfaces.
2018-01-03 17:27:13 +00:00
Maxim Bublis 0ef6afb2f6 Return enthropy errors from UUID generation.
This commit changes signature for `NewV1`, `NewV2` and `NewV4` functions
which from now will return `(UUID, error)` instead of `UUID`.
To emulate old behavior of panicking on enthropy errors one can wrap
a call into `Must` helper similar to:
```
u := uuid.Must(uuid.NewV4())
```

Closes #18.
2018-01-03 16:15:47 +00:00
Maxim Bublis f58768cc1a Add support for setting variant bits other than RFC4122. 2018-01-03 15:23:54 +00:00
Maxim Bublis 980eb8c1d5 Rewrite tests using gocheck. 2018-01-03 00:28:15 +00:00
Alexey Kudinkin b86a6b7dda Moved all generation related logic into `generator.go`.
Abstracted behind `Generator` interface for easy mocking in tests.
2018-01-02 20:21:13 +00:00