Rich Enhanced Shell History - Contextual shell history for zsh and bash
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
resh/cmd/generate-uuid/main.go

26 lines
495 B

package main
import (
"fmt"
"os"
"github.com/google/uuid"
)
// Small utility to generate UUID's using google/uuid golang package
// Doesn't check arguments
// Exits with status 1 on error
func main() {
rnd, err := uuid.NewRandom()
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: could not get new random source: %v", err)
os.Exit(1)
}
id := rnd.String()
if id == "" {
fmt.Fprintf(os.Stderr, "ERROR: got invalid UUID from package")
os.Exit(1)
}
// No newline
fmt.Print(id)
}