1
0
mirror of https://github.com/google/uuid.git synced 2024-11-24 08:32:23 +02:00
Commit Graph

127 Commits

Author SHA1 Message Date
Charlie Lukman
512b657a42
feat: add public matcher function for custom error type invalidLengthError (#78) 2021-03-30 20:36:51 -05:00
jackterm
bfb86fa49a
Add NewString Func (#73)
* added utility func

* updated docs & function call
2021-01-22 12:20:15 -06:00
Yusuf Turhan Papurcu
b5d0d36c98
hash.go hash error covered and linter error fixed (#71)
* hash.go hash error covered and linter error fixed

Error covered without change function definition

* Update hash.go
2021-01-14 18:27:13 -06:00
Steven Kaufman
93777840be
Update sql.go (#72)
Added a single period so that the documentation doesn't look weird. Boy, I hope the tests pass.
2021-01-14 18:24:32 -06:00
Mitsuo Heijo
85223faccf
Reduce custom error allocation (#70)
Zero allocation by using non-pointer error.

related #69

name               old time/op    new time/op    delta
ParseBadLength-16    15.4ns ± 0%     3.5ns ± 0%   ~     (p=1.000 n=1+1)

name               old alloc/op   new alloc/op   delta
ParseBadLength-16     8.00B ± 0%     0.00B        ~     (p=1.000 n=1+1)

name               old allocs/op  new allocs/op  delta
ParseBadLength-16      1.00 ± 0%      0.00        ~     (p=1.000 n=1+1)
2021-01-04 13:17:18 -06:00
Joe Wreschnig
edef28d0c8
Use a custom error type for invalid lengths, replacing fmt.Errorf (#69)
* Add benchmarks for different kinds of invalid UUIDs

Also add a test case for too-short UUIDs to ensure behavior doesn’t
change.

* Use a custom error type for invalid lengths, replacing `fmt.Errorf`

This significantly improves the speed of failed parses due to wrong
lengths. Previously the `fmt.Errorf` call dominated, making this the
most expensive error and more expensive than successfully parsing:

    BenchmarkParse-4                 29226529        36.1 ns/op
    BenchmarkParseBadLength-4         6923106       174 ns/op
    BenchmarkParseLen32Truncated-4   26641954        38.1 ns/op
    BenchmarkParseLen36Corrupted-4   19405598        59.5 ns/op

When the formatting is not required and done on-demand, the failure per
se is much faster:

    BenchmarkParse-4                 29641700        36.3 ns/op
    BenchmarkParseBadLength-4        58602537        20.0 ns/op
    BenchmarkParseLen32Truncated-4   30664791        43.6 ns/op
    BenchmarkParseLen36Corrupted-4   18882410        61.9 ns/op
2020-12-30 13:35:21 -06:00
Andrey Abramov
0e4e311974
Fix race in NewUUID() (#64)
* Fixed race in NewUUID()

* Remove unnecessary variable
2020-07-02 13:56:42 -05:00
Tomáš Procházka
cb32006e48
refactor (*UUID).UnmarshalText (#58)
Now it's easier to set breakpoint on error for debugging.
2020-05-19 09:17:26 -05:00
Andy Pan
bd45158498
Resolved code issues of gofmt and golint (#55)
* Resolved code issues of gofmt and golint

Code quality: https://goreportcard.com/report/github.com/google/uuid

* Fix typo

* Update comment
2020-03-30 20:53:17 -05:00
pborman
7c63a14153
Merge pull request #53 from KosToZyB/master
Update README.md
2020-03-11 20:34:31 -05:00
Veselkov Konstantin
c78a2f96be
Update README.md 2020-03-04 18:59:31 +04:00
pborman
c2e93f3ae5
Merge pull request #44 from trabetti/master
Allow concurrent, re-creatable usage
2019-04-16 12:24:45 -05:00
talis
f00b2048a8 remove uuid_source 2019-03-13 22:16:45 +02:00
talis
e23e7efa9b use strings.NewReader() instead of math/rand.Rand 2019-02-28 16:21:34 +02:00
talis
dc0f88720f Merge branch 'master' of https://github.com/google/uuid 2019-02-28 15:02:10 +02:00
talis
63b66ddfe0 reused version4 NewRandom() and added better testing 2019-02-28 14:59:24 +02:00
Paul Borman
0cd6bf5da1 Add darkfeline's change to set ifname if no interface is found. 2019-02-27 15:05:49 -06:00
talis
caad4a1123 simplify test 2019-02-26 09:40:33 +02:00
talis
005951d400 added source to enable concurrent reproducible usage 2019-02-20 09:43:18 +02:00
pborman
9b3b1e0f5f
Merge pull request #38 from dmitris/go-mod
add go.mod file
2018-09-17 09:00:05 -05:00
Dmitry Savintsev
364ba63b46 add go.mod file 2018-09-17 15:06:12 +02:00
pborman
2768d47f00
Merge pull request #37 from google/borman
Add new parsing support
2018-09-17 07:36:52 -05:00
Paul Borman
16ca3eab7d Add parsing support for:
{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Resolves issue #24
2018-09-09 18:38:29 -05:00
pborman
e704694aed
Merge pull request #35 from OrlovEvgeny/master
edit slice
2018-08-28 13:15:55 -05:00
pborman
7cf75050e9
Merge pull request #26 from martinlindhe/mustparse
add MustParse(), which returns an UUID or panics
2018-08-28 13:14:23 -05:00
Paul Borman
d460ce9f8d Remove leftover comment.
Fix reamde to no longer say this is experimental.
The API is not going to change.
2018-08-27 15:42:32 -05:00
oj
81e4ea7833 edit slice 2018-08-24 16:43:38 +03:00
pborman
dec09d789f
Merge pull request #28 from elliott5/gopherjs
remove "net" dependency when targeting JS via GopherJS
2017-11-29 11:10:14 -08:00
Elliott Stoneham
a4243a3813 remove net when targeting JS 2017-11-29 12:54:27 +00:00
pborman
4ebdd04351
Merge pull request #27 from martinlindhe/master
fix some typos and trivial 'go vet'
2017-11-22 08:26:18 -08:00
Martin Lindhe
9c6b41367e fix some typos 2017-11-22 06:47:31 +01:00
Martin Lindhe
bb91e0b0e2 remove false claim about NewRandom() panic, pointed out in https://github.com/google/uuid/issues/12\#issue-232965368 2017-11-22 06:30:19 +01:00
Martin Lindhe
3d673cf3cf add MustParse(), which returns an UUID or panics 2017-11-22 06:20:00 +01:00
Martin Lindhe
1f1ba6fb7a make 'go vet' happy 2017-11-22 06:14:10 +01:00
pborman
8c31c18f31
Merge pull request #23 from loderunner/master
add FromBytes constructor
2017-11-13 08:03:52 -08:00
Charles Francoise
5c50970d1d add FromBytes constructor 2017-11-10 21:33:01 +01:00
pborman
e367a344cb Merge pull request #22 from kortschak/constant
Remove never-true conditional
2017-10-19 10:36:51 -07:00
kortschak
5b5a8cb7c5 Remove never-true conditional 2017-10-19 15:34:32 +10:30
pborman
7e072fc3a7 Merge pull request #17 from Kerrigan29a/patch-1
A little error in the documentation of dce.go
2017-08-14 07:36:39 -07:00
Javier Escalada
3e2a039c14 A little error in the documentation of dce.go
I think that could be an error in the documentation of [NewDCEGroup](281f560d28/dce.go (L53)) and [NewDCEPerson](281f560d28/dce.go (L45))
2017-08-12 17:57:52 +01:00
pborman
281f560d28 Merge pull request #16 from KonstantinCodes/typos
Typos suggested by @corburn
2017-07-28 10:43:18 -07:00
Konstantin Scheumann
0614758b5f Typos suggested by @corburn 2017-07-28 14:14:46 +02:00
pborman
b7be3e3c4c Merge pull request #15 from sjeandeaux/test/data-egals-data
[test] change data != data by data != uuid
2017-07-24 08:24:35 -07:00
Stéphane Jeandeaux
cdf9b51fe8 [test] compare two slices of bytes thanks @maknihamdi 2017-07-23 17:01:55 +02:00
pborman
1c6adf5cd1 Merge pull request #13 from oreqizer/patch-1
version4: Typo in 'New' doc
2017-07-10 07:57:55 -07:00
Boris
264af6d852 version4: Typo in 'New' doc
Remove redundant 'is'.
2017-07-07 12:56:32 +02:00
pborman
6a5e285548 Merge pull request #11 from thatguystone/master
Support NULLs in Scan()
2017-03-06 06:51:42 -08:00
Andrew Stone
3694829644 sql: Support nil values 2017-03-03 14:59:38 -08:00
Andrew Stone
c96242ef50 sql: Remove redundant type asserts 2017-03-03 14:58:01 -08:00
pborman
064e2069ce Update .travis.yml 2016-11-28 11:12:14 -08:00