diff -Nru golang-github-google-uuid-0.2/dce.go golang-github-google-uuid-1.1.1/dce.go --- golang-github-google-uuid-0.2/dce.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/dce.go 2019-02-27 21:05:49.000000000 +0000 @@ -42,7 +42,7 @@ // NewDCEPerson returns a DCE Security (Version 2) UUID in the person // domain with the id returned by os.Getuid. // -// NewDCEPerson(Person, uint32(os.Getuid())) +// NewDCESecurity(Person, uint32(os.Getuid())) func NewDCEPerson() (UUID, error) { return NewDCESecurity(Person, uint32(os.Getuid())) } @@ -50,7 +50,7 @@ // NewDCEGroup returns a DCE Security (Version 2) UUID in the group // domain with the id returned by os.Getgid. // -// NewDCEGroup(Group, uint32(os.Getgid())) +// NewDCESecurity(Group, uint32(os.Getgid())) func NewDCEGroup() (UUID, error) { return NewDCESecurity(Group, uint32(os.Getgid())) } diff -Nru golang-github-google-uuid-0.2/debian/changelog golang-github-google-uuid-1.1.1/debian/changelog --- golang-github-google-uuid-0.2/debian/changelog 2018-05-30 01:48:22.000000000 +0000 +++ golang-github-google-uuid-1.1.1/debian/changelog 2019-09-24 02:56:39.000000000 +0000 @@ -1,3 +1,11 @@ +golang-github-google-uuid (1.1.1-1) unstable; urgency=medium + + * New upstream release. + * Standards-Version: 4.4.0. + * DH & compat to version 12. + + -- Dmitry Smirnov Tue, 24 Sep 2019 12:56:39 +1000 + golang-github-google-uuid (0.2-1) unstable; urgency=medium * Initial release (Closes: #900385). diff -Nru golang-github-google-uuid-0.2/debian/compat golang-github-google-uuid-1.1.1/debian/compat --- golang-github-google-uuid-0.2/debian/compat 2018-05-30 01:04:18.000000000 +0000 +++ golang-github-google-uuid-1.1.1/debian/compat 2019-09-24 02:54:25.000000000 +0000 @@ -1 +1 @@ -11 +12 diff -Nru golang-github-google-uuid-0.2/debian/control golang-github-google-uuid-1.1.1/debian/control --- golang-github-google-uuid-0.2/debian/control 2018-05-30 01:07:47.000000000 +0000 +++ golang-github-google-uuid-1.1.1/debian/control 2019-09-24 02:54:23.000000000 +0000 @@ -1,12 +1,12 @@ Source: golang-github-google-uuid Section: devel Priority: optional +Standards-Version: 4.4.0 Maintainer: Debian Go Packaging Team Uploaders: Dmitry Smirnov -Build-Depends: debhelper (>= 11~), +Build-Depends: debhelper (>= 12~), dh-golang, golang-any -Standards-Version: 4.1.4 Homepage: https://github.com/google/uuid Vcs-Browser: https://salsa.debian.org/go-team/packages/golang-github-google-uuid Vcs-Git: https://salsa.debian.org/go-team/packages/golang-github-google-uuid.git diff -Nru golang-github-google-uuid-0.2/go.mod golang-github-google-uuid-1.1.1/go.mod --- golang-github-google-uuid-0.2/go.mod 1970-01-01 00:00:00.000000000 +0000 +++ golang-github-google-uuid-1.1.1/go.mod 2019-02-27 21:05:49.000000000 +0000 @@ -0,0 +1 @@ +module github.com/google/uuid diff -Nru golang-github-google-uuid-0.2/hash.go golang-github-google-uuid-1.1.1/hash.go --- golang-github-google-uuid-0.2/hash.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/hash.go 2019-02-27 21:05:49.000000000 +0000 @@ -27,7 +27,7 @@ func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { h.Reset() h.Write(space[:]) - h.Write([]byte(data)) + h.Write(data) s := h.Sum(nil) var uuid UUID copy(uuid[:], s) diff -Nru golang-github-google-uuid-0.2/marshal.go golang-github-google-uuid-1.1.1/marshal.go --- golang-github-google-uuid-0.2/marshal.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/marshal.go 2019-02-27 21:05:49.000000000 +0000 @@ -15,8 +15,6 @@ // UnmarshalText implements encoding.TextUnmarshaler. func (uuid *UUID) UnmarshalText(data []byte) error { - // See comment in ParseBytes why we do this. - // id, err := ParseBytes(data) id, err := ParseBytes(data) if err == nil { *uuid = id diff -Nru golang-github-google-uuid-0.2/node.go golang-github-google-uuid-1.1.1/node.go --- golang-github-google-uuid-0.2/node.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/node.go 2019-02-27 21:05:49.000000000 +0000 @@ -5,16 +5,14 @@ package uuid import ( - "net" "sync" ) var ( - nodeMu sync.Mutex - interfaces []net.Interface // cached list of interfaces - ifname string // name of interface being used - nodeID [6]byte // hardware for version 1 UUIDs - zeroID [6]byte // nodeID with only 0's + nodeMu sync.Mutex + ifname string // name of interface being used + nodeID [6]byte // hardware for version 1 UUIDs + zeroID [6]byte // nodeID with only 0's ) // NodeInterface returns the name of the interface from which the NodeID was @@ -39,26 +37,18 @@ } func setNodeInterface(name string) bool { - if interfaces == nil { - var err error - interfaces, err = net.Interfaces() - if err != nil && name != "" { - return false - } - } - - for _, ifs := range interfaces { - if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { - copy(nodeID[:], ifs.HardwareAddr) - ifname = ifs.Name - return true - } + iname, addr := getHardwareInterface(name) // null implementation for js + if iname != "" && addr != nil { + ifname = iname + copy(nodeID[:], addr) + return true } // We found no interfaces with a valid hardware address. If name // does not specify a specific interface generate a random Node ID // (section 4.1.6) if name == "" { + ifname = "random" randomBits(nodeID[:]) return true } @@ -94,9 +84,6 @@ // NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is // not valid. The NodeID is only well defined for version 1 and 2 UUIDs. func (uuid UUID) NodeID() []byte { - if len(uuid) != 16 { - return nil - } var node [6]byte copy(node[:], uuid[10:]) return node[:] diff -Nru golang-github-google-uuid-0.2/node_js.go golang-github-google-uuid-1.1.1/node_js.go --- golang-github-google-uuid-0.2/node_js.go 1970-01-01 00:00:00.000000000 +0000 +++ golang-github-google-uuid-1.1.1/node_js.go 2019-02-27 21:05:49.000000000 +0000 @@ -0,0 +1,12 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build js + +package uuid + +// getHardwareInterface returns nil values for the JS version of the code. +// This remvoves the "net" dependency, because it is not used in the browser. +// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. +func getHardwareInterface(name string) (string, []byte) { return "", nil } diff -Nru golang-github-google-uuid-0.2/node_net.go golang-github-google-uuid-1.1.1/node_net.go --- golang-github-google-uuid-0.2/node_net.go 1970-01-01 00:00:00.000000000 +0000 +++ golang-github-google-uuid-1.1.1/node_net.go 2019-02-27 21:05:49.000000000 +0000 @@ -0,0 +1,33 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !js + +package uuid + +import "net" + +var interfaces []net.Interface // cached list of interfaces + +// getHardwareInterface returns the name and hardware address of interface name. +// If name is "" then the name and hardware address of one of the system's +// interfaces is returned. If no interfaces are found (name does not exist or +// there are no interfaces) then "", nil is returned. +// +// Only addresses of at least 6 bytes are returned. +func getHardwareInterface(name string) (string, []byte) { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil { + return "", nil + } + } + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + return ifs.Name, ifs.HardwareAddr + } + } + return "", nil +} diff -Nru golang-github-google-uuid-0.2/README.md golang-github-google-uuid-1.1.1/README.md --- golang-github-google-uuid-0.2/README.md 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/README.md 2019-02-27 21:05:49.000000000 +0000 @@ -1,7 +1,3 @@ -**This package is currently in development and the API may not be stable.** - -The API will become stable with v1. - # uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) The uuid package generates and inspects UUIDs based on [RFC 4122](http://tools.ietf.org/html/rfc4122) diff -Nru golang-github-google-uuid-0.2/seq_test.go golang-github-google-uuid-1.1.1/seq_test.go --- golang-github-google-uuid-0.2/seq_test.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/seq_test.go 2019-02-27 21:05:49.000000000 +0000 @@ -16,7 +16,7 @@ // TestClockSeqRace tests for a particular race condition of returning two // identical Version1 UUIDs. The duration of 1 minute was chosen as the race -// condition, before being fixed, nearly always occured in under 30 seconds. +// condition, before being fixed, nearly always occurred in under 30 seconds. func TestClockSeqRace(t *testing.T) { if !*regressions { t.Skip("skipping regression tests") diff -Nru golang-github-google-uuid-0.2/sql.go golang-github-google-uuid-1.1.1/sql.go --- golang-github-google-uuid-0.2/sql.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/sql.go 2019-02-27 21:05:49.000000000 +0000 @@ -13,35 +13,36 @@ // Currently, database types that map to string and []byte are supported. Please // consult database-specific driver documentation for matching types. func (uuid *UUID) Scan(src interface{}) error { - switch src.(type) { + switch src := src.(type) { + case nil: + return nil + case string: // if an empty UUID comes from a table, we return a null UUID - if src.(string) == "" { + if src == "" { return nil } // see Parse for required string format - u, err := Parse(src.(string)) - + u, err := Parse(src) if err != nil { return fmt.Errorf("Scan: %v", err) } *uuid = u - case []byte: - b := src.([]byte) + case []byte: // if an empty UUID comes from a table, we return a null UUID - if len(b) == 0 { + if len(src) == 0 { return nil } // assumes a simple slice of bytes if 16 bytes // otherwise attempts to parse - if len(b) != 16 { - return uuid.Scan(string(b)) + if len(src) != 16 { + return uuid.Scan(string(src)) } - copy((*uuid)[:], b) + copy((*uuid)[:], src) default: return fmt.Errorf("Scan: unable to scan type %T into UUID", src) diff -Nru golang-github-google-uuid-0.2/sql_test.go golang-github-google-uuid-1.1.1/sql_test.go --- golang-github-google-uuid-0.2/sql_test.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/sql_test.go 2019-02-27 21:05:49.000000000 +0000 @@ -10,9 +10,9 @@ ) func TestScan(t *testing.T) { - var stringTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d479" - var badTypeTest int = 6 - var invalidTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d4" + stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479" + badTypeTest := 6 + invalidTest := "f47ac10b-58cc-0372-8567-0e02b2c3d4" byteTest := make([]byte, 16) byteTestUUID := Must(Parse(stringTest)) @@ -90,6 +90,17 @@ t.Error("UUID was not nil after scanning empty byte slice") } } + + uuid = UUID{} + err = (&uuid).Scan(nil) + if err != nil { + t.Fatal(err) + } + for _, v := range uuid { + if v != 0 { + t.Error("UUID was not nil after scanning nil") + } + } } func TestValue(t *testing.T) { diff -Nru golang-github-google-uuid-0.2/time.go golang-github-google-uuid-1.1.1/time.go --- golang-github-google-uuid-0.2/time.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/time.go 2019-02-27 21:05:49.000000000 +0000 @@ -86,7 +86,7 @@ return int(clockSeq & 0x3fff) } -// SetClockSeq sets the clock sequence to the lower 14 bits of seq. Setting to +// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to // -1 causes a new sequence to be generated. func SetClockSequence(seq int) { defer timeMu.Unlock() @@ -100,9 +100,9 @@ randomBits(b[:]) // clock sequence seq = int(b[0])<<8 | int(b[1]) } - old_seq := clockSeq + oldSeq := clockSeq clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant - if old_seq != clockSeq { + if oldSeq != clockSeq { lasttime = 0 } } diff -Nru golang-github-google-uuid-0.2/uuid.go golang-github-google-uuid-1.1.1/uuid.go --- golang-github-google-uuid-0.2/uuid.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/uuid.go 2019-02-27 21:05:49.000000000 +0000 @@ -1,4 +1,4 @@ -// Copyright 2016 Google Inc. All rights reserved. +// Copyright 2018 Google Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -35,20 +35,43 @@ var rander = rand.Reader // random function -// Parse decodes s into a UUID or returns an error. Both the UUID form of -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded. +// Parse decodes s into a UUID or returns an error. Both the standard UUID +// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the +// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex +// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. func Parse(s string) (UUID, error) { var uuid UUID - if len(s) != 36 { - if len(s) != 36+9 { - return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) - } + switch len(s) { + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36: + + // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: if strings.ToLower(s[:9]) != "urn:uuid:" { return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) } s = s[9:] + + // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + case 36 + 2: + s = s[1:] + + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + case 32: + var ok bool + for i := range uuid { + uuid[i], ok = xtob(s[i*2], s[i*2+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return uuid, errors.New("invalid UUID format") } @@ -58,11 +81,11 @@ 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} { - if v, ok := xtob(s[x], s[x+1]); !ok { + v, ok := xtob(s[x], s[x+1]) + if !ok { return uuid, errors.New("invalid UUID format") - } else { - uuid[i] = v } + uuid[i] = v } return uuid, nil } @@ -70,15 +93,29 @@ // ParseBytes is like Parse, except it parses a byte slice instead of a string. func ParseBytes(b []byte) (UUID, error) { var uuid UUID - if len(b) != 36 { - if len(b) != 36+9 { - return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) - } + switch len(b) { + case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) } b = b[9:] + case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + b = b[1:] + case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + var ok bool + for i := 0; i < 32; i += 2 { + uuid[i/2], ok = xtob(b[i], b[i+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { return uuid, errors.New("invalid UUID format") } @@ -88,15 +125,32 @@ 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} { - if v, ok := xtob(b[x], b[x+1]); !ok { + v, ok := xtob(b[x], b[x+1]) + if !ok { return uuid, errors.New("invalid UUID format") - } else { - uuid[i] = v } + uuid[i] = v } return uuid, nil } +// MustParse is like Parse but panics if the string cannot be parsed. +// It simplifies safe initialization of global variables holding compiled UUIDs. +func MustParse(s string) UUID { + uuid, err := Parse(s) + if err != nil { + panic(`uuid: Parse(` + s + `): ` + err.Error()) + } + return uuid +} + +// FromBytes creates a new UUID from a byte slice. Returns an error if the slice +// does not have a length of 16. The bytes are copied from the slice. +func FromBytes(b []byte) (uuid UUID, err error) { + err = uuid.UnmarshalBinary(b) + return uuid, err +} + // Must returns uuid if err is nil and panics otherwise. func Must(uuid UUID, err error) UUID { if err != nil { @@ -123,7 +177,7 @@ } func encodeHex(dst []byte, uuid UUID) { - hex.Encode(dst[:], uuid[:4]) + hex.Encode(dst, uuid[:4]) dst[8] = '-' hex.Encode(dst[9:13], uuid[4:6]) dst[13] = '-' @@ -176,7 +230,7 @@ return fmt.Sprintf("BadVariant%d", int(v)) } -// SetRand sets the random number generator to r, which implents io.Reader. +// SetRand sets the random number generator to r, which implements io.Reader. // If r.Read returns an error when the package requests random data then // a panic will be issued. // diff -Nru golang-github-google-uuid-0.2/uuid_test.go golang-github-google-uuid-1.1.1/uuid_test.go --- golang-github-google-uuid-0.2/uuid_test.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/uuid_test.go 2019-02-27 21:05:49.000000000 +0000 @@ -8,6 +8,7 @@ "bytes" "fmt" "os" + "runtime" "strings" "testing" "time" @@ -58,12 +59,22 @@ {"f47ac10b-58cc-4372-e567-0e02b2c3d479", 4, Future, true}, {"f47ac10b-58cc-4372-f567-0e02b2c3d479", 4, Future, true}, + {"f47ac10b158cc-5372-a567-0e02b2c3d479", 0, Invalid, false}, {"f47ac10b-58cc25372-a567-0e02b2c3d479", 0, Invalid, false}, {"f47ac10b-58cc-53723a567-0e02b2c3d479", 0, Invalid, false}, {"f47ac10b-58cc-5372-a56740e02b2c3d479", 0, Invalid, false}, {"f47ac10b-58cc-5372-a567-0e02-2c3d479", 0, Invalid, false}, {"g47ac10b-58cc-4372-a567-0e02b2c3d479", 0, Invalid, false}, + + + {"{f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, RFC4122, true}, + {"{f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, Invalid, false}, + + {"f47ac10b58cc037285670e02b2c3d479", 0, RFC4122, true}, + {"f47ac10b58cc037285670e02b2c3d4790", 0, Invalid, false}, + {"f47ac10b58cc037285670e02b2c3d47", 0, Invalid, false}, } var constants = []struct { @@ -121,6 +132,25 @@ } } +func TestFromBytes(t *testing.T) { + b := []byte{ + 0x7d, 0x44, 0x48, 0x40, + 0x9d, 0xc0, + 0x11, 0xd1, + 0xb2, 0x45, + 0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2, + } + uuid, err := FromBytes(b) + if err != nil { + t.Fatalf("%s", err) + } + for i := 0; i < len(uuid); i++ { + if b[i] != uuid[i] { + t.Fatalf("FromBytes() got %v expected %v\b", uuid[:], b) + } + } +} + func TestConstants(t *testing.T) { for x, tt := range constants { v, ok := tt.c.(fmt.Stringer) @@ -246,7 +276,7 @@ if err != nil { t.Errorf("Parse returned unexpected error %v", err) } - if data != data { + if data != uuid { t.Errorf("%s: decoded to %s, expected %s", text, uuid, data) } } @@ -286,7 +316,7 @@ case t1 > t2 && q1 == q2: t.Error("time reversed") case t1 < t2 && q1 != q2: - t.Error("clock sequence chaned unexpectedly") + t.Error("clock sequence changed unexpectedly") } } @@ -302,8 +332,10 @@ if !SetNodeInterface("") { t.Error("SetNodeInterface failed") } - if ni := NodeInterface(); ni == "" { - t.Error("NodeInterface returned an empty string") + if runtime.GOARCH != "js" { + if ni := NodeInterface(); ni == "" { + t.Error("NodeInterface returned an empty string") + } } ni := NodeID() @@ -328,7 +360,7 @@ } if ni := NodeInterface(); ni != "user" { - t.Errorf("got inteface %q, want %q", ni, "user") + t.Errorf("got interface %q, want %q", ni, "user") } } @@ -372,8 +404,10 @@ nid := []byte{1, 2, 3, 4, 5, 6} SetNodeInterface("") s := NodeInterface() - if s == "" || s == "user" { - t.Errorf("NodeInterface %q after SetInteface", s) + if runtime.GOARCH != "js" { + if s == "" || s == "user" { + t.Errorf("NodeInterface %q after SetInterface", s) + } } node1 := NodeID() if node1 == nil { @@ -424,7 +458,7 @@ type badRand struct{} func (r badRand) Read(buf []byte) (int, error) { - for i, _ := range buf { + for i := range buf { buf[i] = byte(i) } return len(buf), nil @@ -435,13 +469,13 @@ uuid1 := New() uuid2 := New() if uuid1 != uuid2 { - t.Errorf("execpted duplicates, got %q and %q", uuid1, uuid2) + t.Errorf("expected duplicates, got %q and %q", uuid1, uuid2) } SetRand(nil) uuid1 = New() uuid2 = New() if uuid1 == uuid2 { - t.Errorf("unexecpted duplicates, got %q", uuid1) + t.Errorf("unexpected duplicates, got %q", uuid1) } } @@ -471,7 +505,6 @@ return Parse(*(*string)(unsafe.Pointer(&b))) } - func BenchmarkParseBytesUnsafe(b *testing.B) { for i := 0; i < b.N; i++ { _, err := parseBytesUnsafe(asBytes) diff -Nru golang-github-google-uuid-0.2/version1.go golang-github-google-uuid-1.1.1/version1.go --- golang-github-google-uuid-0.2/version1.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/version1.go 2019-02-27 21:05:49.000000000 +0000 @@ -13,7 +13,7 @@ // or SetNodeInterface then it will be set automatically. If the NodeID cannot // be set NewUUID returns nil. If clock sequence has not been set by // SetClockSequence then it will be set automatically. If GetTime fails to -// return the current NewUUID returns Nil and an error. +// return the current NewUUID returns nil and an error. // // In most cases, New should be used. func NewUUID() (UUID, error) { diff -Nru golang-github-google-uuid-0.2/version4.go golang-github-google-uuid-1.1.1/version4.go --- golang-github-google-uuid-0.2/version4.go 2016-11-28 19:12:14.000000000 +0000 +++ golang-github-google-uuid-1.1.1/version4.go 2019-02-27 21:05:49.000000000 +0000 @@ -6,7 +6,7 @@ import "io" -// New is creates a new random UUID or panics. New is equivalent to +// New creates a new random UUID or panics. New is equivalent to // the expression // // uuid.Must(uuid.NewRandom()) @@ -14,12 +14,12 @@ return Must(NewRandom()) } -// NewRandom returns a Random (Version 4) UUID or panics. +// NewRandom returns a Random (Version 4) UUID. // // The strength of the UUIDs is based on the strength of the crypto/rand // package. // -// A note about uniqueness derived from from the UUID Wikipedia entry: +// A note about uniqueness derived from the UUID Wikipedia entry: // // Randomly generated UUIDs have 122 random bits. One's annual risk of being // hit by a meteorite is estimated to be one chance in 17 billion, that