Skip to content

Bios-Marcel/go-petname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alternative to dustinkirklands golang-petname.

Verify Go Reference

!The API is incompatible with dustinkirkland/golang-petname!

The goal is to provide a low overhead alternative that'S well-maintained and simple to work with.

Usage

Add to your dependencies:

go get github.com/Bios-Marcel/go-petname

Call the Generate function:

// Results in word_word_word
petname.Generate(3, petname.Lower, petname.Underscore)

You can change the wordlists by calling SetNames, SetAdjectives and SetAdverbs. Note that by default, the short package is used as the source of words for all groups. The other packages available are medium and long.

Technically you can provide your own lists.

Generate wordlists

The wordlists are generated like this:

go run ./cmd/generate folder > target/words.go

Replace folder with the folder that contains adjectives.txt, adverbs.txt and names.txt.