nomino/generators_examples_test.go

21 lines
331 B
Go
Raw Normal View History

2025-03-11 16:54:03 -05:00
package nomino
import "fmt"
func ExampleWithGenerator_custom_generator() {
gen := func() (string, error) {
return "hello", nil
}
option := WithGenerator(gen)
str, _ := Make(NewConfig(option))
fmt.Println(str)
str, _ = Make(NewConfig(option, WithoutExtension()))
fmt.Println(str)
// Output:
// hello.txt
// hello
}