Skip to content

golang-petname 2.12

Latest

Choose a tag to compare

@dustinkirkland dustinkirkland released this 15 Feb 03:57

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 time and math/rand imports
  • βœ… 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, "-")
```