Commit Graph

148 Commits

Author SHA1 Message Date
Maxim Bublis b2ce2384e1
Merge pull request #87 from HaraldNordgren/go_versions
Bump Go versions and use 1.n.x to get latest minor versions
2018-10-28 12:50:25 +00:00
Harald Nordgren 3df6b01db6 Bump Go versions and use 1.n.x to get latest minor versions 2018-10-28 00:08:22 +02:00
Maxim Bublis 8ccf5352a8 Fix CI config. 2018-10-16 19:40:21 +01:00
Maxim Bublis 8614ec4a1e Update build matrix to test against Go >= 1.6. 2018-10-16 19:35:04 +01:00
Maxim Bublis 4d30718d76
Merge pull request #72 from epels/feature/add-missing-return
Add missing return to README
2018-10-16 18:02:43 +01:00
Maxim Bublis d91630c851
Merge pull request #75 from josselin-c/master
Fix potential non-random UUIDs
2018-10-16 18:00:32 +01:00
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
Emile Pels 6b362869be Add missing return to README 2018-03-18 18:12:46 +01:00
Maxim Bublis 36e9d2ebbd Add test case for Must helper. 2018-01-03 17:44:51 +00:00
Maxim Bublis f6920249aa Use SVG badges. 2018-01-03 17:37:11 +00: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 063359185d Update copyright year. 2018-01-03 00:35:58 +00:00
Maxim Bublis 980eb8c1d5 Rewrite tests using gocheck. 2018-01-03 00:28:15 +00:00
Maxim Bublis 95d61fadb1 Moved codecs suport into `codec.go` 2018-01-03 00:28:15 +00:00
Maxim Bublis 2558856ae9 Moved database support into `sql.go`. 2018-01-02 20:56:48 +00:00
Maxim Bublis b27323f250 Use Must helper for namespace UUIDs initialization. 2018-01-02 20:38:35 +00:00
Maxim Bublis ceccb20d4a Merge pull request #62 from alexeykudinkin/gen-split
Abstracted generating logic behind `Generator` interface for easy
mocking in tests.
2018-01-02 20:22:47 +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
Maxim Bublis 508dbd67f2 Remove obsolete tests. 2018-01-02 18:15:32 +00:00
Maxim Bublis 57d18d3c55 Remove binary uuid AND and OR operations.
This functionality is pretty much misleading and non-standard.
2018-01-02 16:09:01 +00:00
Maxim Bublis 8be4f1c3d9 Merge pull request #54 from daskol/parse-from-string
Refactor UnmarshalText in order to parse hash-like UUID.
2018-01-02 15:43:10 +00:00
Daniel Bershatsky 23a7b8435b Refactor UnmarshalText in order to parse hash-like UUID. 2018-01-02 15:11:40 +00:00
Maxim Bublis 3b14077cbb
Merge pull request #55 from kevinburke/add-size
Add Size constant
2018-01-02 14:14:55 +00:00
Maxim Bublis afe01f2532
Merge pull request #52 from marclave/marc/feature/Must_helper_wrapper
Add must helper
2018-01-02 14:12:52 +00:00
Maxim Bublis bba152fbf2 Build against Go 1.9. 2018-01-02 14:07:02 +00:00
Maxim Bublis 2c3b1967c1
Merge pull request #51 from SCKelemen/patch-1
Update copyright year
2018-01-02 14:02:29 +00:00
Kevin Burke 0ca0c2cf9e
Add Size constant
If I want to account for the size of a UUID in bytes in my package,
it would be nice to be able to write `uuid.Size` (to make it clear to
readers why I'm adding this many bytes) instead of the magic number
"16".
2017-08-15 11:39:26 -07:00
marclave 1d213916d1 Add must helper
A Must function is idiomatic go; the benefit of having a must is to
panic when it is not a valid UUID vs error handle.
2017-06-28 09:57:42 -07:00
Samuel Kelemen 13ac7b16c2 Update Copyright Year, again 2017-06-12 10:33:36 -05:00
Maxim Bublis 5bf94b69c6 Merge pull request #45 from erizocosmico/patch-1
Add go 1.8 to travis matrix
2017-03-21 23:07:31 +00:00
Miguel Molina 1d9318df9b Add go 1.8 to travis matrix 2017-03-21 15:21:08 +01:00
Maxim Bublis b061729afc Make Go tip a fast-finish allowed feature for CI. 2016-09-27 11:08:44 +01:00
Maxim Bublis 8dc46065cf Merge pull request #37 from kevinburke/go-1.7
Add Go 1.7 and latest
2016-09-27 11:05:31 +01:00
Maxim Bublis ea50dc35f3 Merge pull request #36 from kevinburke/fix-vet
Fix errors reported by go vet
2016-09-27 11:01:08 +01:00
Kevin Burke 44ab8e0dc1 Add Go 1.7 and latest
Go 1.7 was released recently and it seems useful to test against the Go tip as
well, for people that run release candidates.
2016-08-23 20:53:48 -07:00
Kevin Burke e9dec51388 Fix errors reported by go vet
For the benchmark, `u.String()` or the loop could
potentially be optimized away by the compiler (see
http://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go for more
information). A format string in uuid_test.go has the wrong type.
2016-08-23 18:20:22 -07:00
Maxim Bublis 0aa62d5ddc Remove version check in UnmarshalText method. 2016-07-13 19:03:06 +01:00
Maxim Bublis 879c5887cd Add coverage badge. 2016-06-07 15:43:47 +01:00
Maxim Bublis 2d64dad091 Remove Go 1.0 and 1.1 from CI.
By this time they are probably so old already that noone uses them.
2016-06-07 15:37:55 +01:00
Maxim Bublis f8cc937423 Enable test coverage in CI. 2016-06-07 15:28:05 +01:00
Maxim Bublis fce4b1f106 Merge pull request #23 from jrouviere/master
Interpret SQL NULL values as uuid.Nil
2016-06-07 15:07:18 +01:00
Maxim Bublis 092be99594 Merge pull request #27 from Mjolnir42/master
Improve input validation in UnmarshalText
2016-06-07 15:05:07 +01:00
Jörg Pernfuß 561449c091 Handle braced format with trailing characters 2016-06-03 01:09:06 +00:00
Jörg Pernfuß 90e70752a6 Make UnmarshalText parse more strictly
With these updates, all updated tests are passed and
no invalid strings are converted to UUID.
2016-06-03 00:43:55 +00:00
Jörg Pernfuß b111a074d5 Update FromString tests: long and invalid strings
This adds two new tests for overly long and otherwise invalidly
formatted strings to the FromString tests.

The most failure case is the acceptance of arbitrarily long hex
strings and truncating the first 32 characters to a UUID.

--- FAIL: TestFromStringLong (0.00s)
        uuid_test.go:250: Should return error trying to parse too long string, passed 6ba7b810-9dad-11d1-80b4-00c04fd430c8=
        uuid_test.go:250: Should return error trying to parse too long string, passed 6ba7b810-9dad-11d1-80b4-00c04fd430c8}
        uuid_test.go:250: Should return error trying to parse too long string, passed 6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8
--- FAIL: TestFromStringInvalid (0.00s)
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b810-9dad11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad-11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d1-80b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d180b4-00c04fd430c8
2016-06-03 00:42:25 +00:00
Julien Rouviere cba34673b5 Introduce NullUUID type to handle NULL SQL values
NullUUID works similarly to NullString from the database/sql package, it represents a UUID that can be NULL, a Valid boolean indicates if the value was NULL or not.
2016-04-30 20:05:32 +01:00
Maxim Bublis f9ab0dce87 Merge pull request #21 from tomstokes/master
Fix UnmarshalText panic on invalid short uuid
2016-03-24 11:22:44 +00:00
Tom Stokes 89fb462add Fix UnmarshalText panic on invalid short uuid
Fixes satori/go.uuid#20
2016-03-23 10:37:25 -06:00