20 lines
		
	
	
	
		
			331 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			331 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 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
 | |
| }
 |