diff options
Diffstat (limited to 'src/uuid.go')
-rw-r--r-- | src/uuid.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/uuid.go b/src/uuid.go index 8b953f8..6c4b8f6 100644 --- a/src/uuid.go +++ b/src/uuid.go @@ -4,7 +4,9 @@ import ( "crypto/rand" "encoding/hex" "errors" + "fmt" "io" + "os" "strings" ) @@ -100,3 +102,17 @@ func FromString(str string) (UUID, error) { return [ByteCount]byte(data), nil } + + + +func Main() { + if len(os.Args) < 2 { + fmt.Println(New().String()) + } else { + _, err := FromString(strings.TrimSpace(os.Args[1])) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(3) + } + } +} |