namegen

package
v1.50.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportedWordLists

func ExportedWordLists() ([]string, []string)

ExportedWordLists returns the adjectives and nouns slices for testing.

func Generate

func Generate() string

Generate returns a name string in YYYYMMDD-adjective-noun-NN format. It does NOT create a directory — it only generates the name string.

func GenerateAndCreate

func GenerateAndCreate(baseDir string, maxAttempts int) (string, error)

GenerateAndCreate creates a unique subdirectory inside baseDir and returns the full absolute path. It uses os.Mkdir (atomic) for the leaf to handle concurrent creation races. It retries up to maxAttempts times. On success, the directory exists on disk and is owned by this call. Returns error if maxAttempts exhausted or baseDir cannot be written.

func GenerateAndCreateWithFn

func GenerateAndCreateWithFn(baseDir string, maxAttempts int, generateFn func() string) (string, error)

GenerateAndCreateWithFn is like GenerateAndCreate but uses a custom name generation function — useful for deterministic testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL