• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

testdata/corpus/H22-Aug-2018-

.gitignoreH A D22-Aug-2018244

.travis.ymlH A D22-Aug-2018340

LICENSEH A D22-Aug-20181.1 KiB

README.mdH A D22-Aug-20183.5 KiB

codec.goH A D22-Aug-20186.2 KiB

codec_test.goH A D22-Aug-20188.2 KiB

fuzz.goH A D22-Aug-20181.8 KiB

generator.goH A D22-Aug-20188.1 KiB

generator_test.goH A D22-Aug-20189.7 KiB

sql.goH A D22-Aug-20182.8 KiB

sql_test.goH A D22-Aug-20187 KiB

uuid.goH A D22-Aug-20185.5 KiB

uuid_test.goH A D22-Aug-20185.6 KiB

README.md

1# UUID
2
3[![License](https://img.shields.io/github/license/gofrs/uuid.svg)](https://github.com/gofrs/uuid/blob/master/LICENSE)
4[![Build Status](https://travis-ci.org/gofrs/uuid.svg?branch=master)](https://travis-ci.org/gofrs/uuid)
5[![GoDoc](http://godoc.org/github.com/gofrs/uuid?status.svg)](http://godoc.org/github.com/gofrs/uuid)
6[![Coverage Status](https://coveralls.io/repos/github/gofrs/uuid/badge.svg?branch=master)](https://coveralls.io/github/gofrs/uuid)
7[![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/uuid)](https://goreportcard.com/report/github.com/gofrs/uuid)
8
9Package uuid provides a pure Go implementation of Universally Unique Identifiers
10(UUID) variant as defined in RFC-4122. This package supports both the creation
11and parsing of UUIDs in different formats.
12
13This package supports the following UUID versions:
14* Version 1, based on timestamp and MAC address (RFC-4122)
15* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1)
16* Version 3, based on MD5 hashing of a named value (RFC-4122)
17* Version 4, based on random numbers (RFC-4122)
18* Version 5, based on SHA-1 hashing of a named value (RFC-4122)
19
20## Project History
21
22This project was originally forked from the
23[github.com/satori/go.uuid](https://github.com/satori/go.uuid) repository after
24it appeared to be no longer maintained, while exhibiting [critical
25flaws](https://github.com/satori/go.uuid/issues/73). We have decided to take
26over this project to ensure it receives regular maintenance for the benefit of
27the larger Go community.
28
29We'd like to thank Maxim Bublis for his hard work on the original iteration of
30the package.
31
32## License
33
34This source code of this package is released under the MIT License. Please see
35the [LICENSE](https://github.com/gofrs/uuid/blob/master/LICENSE) for the full
36content of the license.
37
38## Recommended Package Version
39
40We recommend using v2.0.0+ of this package, as versions prior to 2.0.0 were
41created before our fork of the original package and have some known
42deficiencies.
43
44## Installation
45
46It is recommended to use a package manager like `dep` that understands tagged
47releases of a package, as well as semantic versioning.
48
49If you are unable to make use of a dependency manager with your project, you can
50use the `go get` command to download it directly:
51
52```Shell
53$ go get github.com/gofrs/uuid
54```
55
56## Requirements
57
58Due to subtests not being supported in older versions of Go, this package is
59only regularly tested against Go 1.7+. This package may work perfectly fine with
60Go 1.2+, but support for these older versions is not actively maintained.
61
62## Usage
63
64Here is a quick overview of how to use this package. For more detailed
65documentation, please see the [GoDoc Page](http://godoc.org/github.com/gofrs/uuid).
66
67```go
68package main
69
70import (
71	"log"
72
73	"github.com/gofrs/uuid"
74)
75
76// Create a Version 4 UUID, panicking on error.
77// Use this form to initialize package-level variables.
78var u1 = uuid.Must(uuid.NewV4())
79
80func main() {
81	// Create a Version 4 UUID.
82	u2, err := uuid.NewV4()
83	if err != nil {
84		log.Fatalf("failed to generate UUID: %v", err)
85	}
86	log.Printf("generated Version 4 UUID %v", u2)
87
88	// Parse a UUID from a string.
89	s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
90	u3, err := uuid.FromString(s)
91	if err != nil {
92		log.Fatalf("failed to parse UUID %q: %v", s, err)
93	}
94	log.Printf("successfully parsed UUID %v", u3)
95}
96```
97
98## References
99
100* [RFC-4122](https://tools.ietf.org/html/rfc4122)
101* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01)
102