golang-petname 2.12
Major modernization release for Go 1.20+ compatibility.
π Library Features
- β Synced wordlists with petname 2.10 (removed peacock, cockatoo, woodcock)
- β
Deprecated
NonDeterministicMode()for Go 1.20+ auto-seeding - β Added Generator API for custom random sources
- β Maintained 100% backward compatibility
- β Achieved 100% test coverage
π οΈ CLI Improvements
- β
Removed deprecated
rand.Seed()calls for Go 1.20+ compatibility - β
Removed unnecessary
timeandmath/randimports - β Simplified and modernized codebase
π§ͺ Testing
- Comprehensive test suite (100% coverage)
- Tests for backward compatibility
- Tests for deterministic behavior and concurrency
- All tests pass with race detection
π Documentation
- Updated examples to remove deprecated
rand.Seed()calls - Added note about Go 1.20+ automatic seeding
- Added usage examples for new Generator API
π Closed Issues
- #4: init() moved to CLI (confirmed fixed)
- #7: Docker image available (documented)
- #8: fork licensing resolved
- #10: random generation works by default (Go 1.20+)
- #15: updated for Go 1.20+ auto-seeding
- #19: offensive names removed
- #20: Generator API for custom rand sources
π¦ Installation
```bash
go get github.com/dustinkirkland/golang-petname@2.12
```
π» Usage Examples
Basic usage (backward compatible):
```go
import "github.com/dustinkirkland/golang-petname"
name := petname.Generate(2, "-") // "happy-dolphin"
```
New Generator API (deterministic):
```go
import (
"math/rand"
"github.com/dustinkirkland/golang-petname"
)
gen := petname.New(rand.New(rand.NewSource(42)))
name := gen.Generate(2, "-") // Always: "guiding-dodo"
```
Thread-safe concurrent use:
```go
// Each goroutine gets its own generator
gen := petname.New(rand.New(rand.NewSource(time.Now().UnixNano())))
name := gen.Generate(2, "-")
```