Commit 3080a94
Refactor GUID layout, API, and fix correctness issues
- Expand GUID from 26 to 28 characters by dropping the redundant
decrement counter and growing the random field from 4 to 10 base36
chars (~51.7 bits of entropy, up from ~20.7 bits)
- Change default prefix bytes from 'nw' to 'id'
- Make New() return (GUID, error) instead of panicking; add MustNew()
- Make SetGlobalPrefixBytes() return error instead of panicking;
add MustSetGlobalPrefixBytes(); fix bug where invalid input
permanently consumed the sync.Once
- Replace channel-based counter locking with sync.Mutex
- Fix data races on globalPrefix and globalGenerator using atomic.Value
- Fix defaultFingerprint TOCTOU race with sync.Once
- Fix counter wraparound off-by-one (> to >=)
- Fix Parse accepting negative values via base36 minus prefix
(switched to ParseUint, found by fuzz testing)
- Expand signer to fold all 28 GUID bytes into the hash
- Simplify SetTime to plain integer division
- Replace interface{} with any
- Fix CRLF newline separator in CLI to LF
- Replace generateAsync channel/context pattern with indexed goroutines
- Remove testify dependency, zero external dependencies
- Add CLI integration tests, concurrent generation tests, fuzz tests
- Rewrite README for current API and layout
- Remove stale GODOC.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 571fdcb commit 3080a94
12 files changed
Lines changed: 857 additions & 1010 deletions
File tree
- cmd/guid
- testdata/fuzz/FuzzParse
This file was deleted.
0 commit comments