Bring naming of exported values inline with current Go practice.
diff --git a/dce.go b/dce.go
index 8523659..96a59fe 100644
--- a/dce.go
+++ b/dce.go
@@ -61,9 +61,9 @@
return Domain(uuid[9])
}
-// Id returns the id for a Version 2 UUID. Ids are only defined for Vrsion 2
+// ID returns the id for a Version 2 UUID. Ids are only defined for Version 2
// UUIDs.
-func (uuid UUID) Id() uint32 {
+func (uuid UUID) ID() uint32 {
return binary.BigEndian.Uint32(uuid[0:4])
}
diff --git a/hash.go b/hash.go
index 1e3ca79..4fc5a77 100644
--- a/hash.go
+++ b/hash.go
@@ -12,11 +12,11 @@
// Well known namespace IDs and UUIDs
var (
- NameSpace_DNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8"))
- NameSpace_URL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8"))
- NameSpace_OID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8"))
- NameSpace_X500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8"))
- NIL UUID // empty UUID, all zeros
+ NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8"))
+ NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8"))
+ NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8"))
+ NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8"))
+ Nil UUID // empty UUID, all zeros
)
// NewHash returns a new UUID derived from the hash of space concatenated with
diff --git a/marshal.go b/marshal.go
index 435ca7c..40c1f78 100644
--- a/marshal.go
+++ b/marshal.go
@@ -20,7 +20,7 @@
func (u *UUID) UnmarshalText(data []byte) error {
// See comment in ParseBytes why we do this.
// id, err := ParseBytes(data)
- id, err := Parse(*(*string)(unsafe.Pointer(&data)))
+ id, err := Parse(*(*string)(unsafe.Pointer(&data)))
if err == nil {
*u = id
}
diff --git a/uuid_test.go b/uuid_test.go
index cc961ad..b7cc24c 100644
--- a/uuid_test.go
+++ b/uuid_test.go
@@ -353,7 +353,7 @@
}
func TestMD5(t *testing.T) {
- uuid := NewMD5(NameSpace_DNS, []byte("python.org")).String()
+ uuid := NewMD5(NameSpaceDNS, []byte("python.org")).String()
want := "6fa459ea-ee8a-3ca4-894e-db77e160355e"
if uuid != want {
t.Errorf("MD5: got %q expected %q", uuid, want)
@@ -361,7 +361,7 @@
}
func TestSHA1(t *testing.T) {
- uuid := NewSHA1(NameSpace_DNS, []byte("python.org")).String()
+ uuid := NewSHA1(NameSpaceDNS, []byte("python.org")).String()
want := "886313e1-3b8a-5372-9b90-0c9aee199e5d"
if uuid != want {
t.Errorf("SHA1: got %q expected %q", uuid, want)
@@ -407,7 +407,7 @@
if v := uuid.Domain(); v != domain {
t.Errorf("%s: %s: expected domain %d, got %d", name, uuid, domain, v)
}
- if v := uuid.Id(); v != id {
+ if v := uuid.ID(); v != id {
t.Errorf("%s: %s: expected id %d, got %d", name, uuid, id, v)
}
}
@@ -471,12 +471,11 @@
return Parse(string(b))
}
-
// xtobb converts the the first two hex bytes of x into a byte.
func xtobb(x []byte) (byte, bool) {
- b1 := xvalues[x[0]]
- b2 := xvalues[x[1]]
- return (b1 << 4) | b2, b1 != 255 && b2 != 255
+ b1 := xvalues[x[0]]
+ b2 := xvalues[x[1]]
+ return (b1 << 4) | b2, b1 != 255 && b2 != 255
}
// parseBytes is the same as Parse, but with byte slices. It demonstrates
diff --git a/version4.go b/version4.go
index 453cb95..390dd2c 100644
--- a/version4.go
+++ b/version4.go
@@ -30,7 +30,7 @@
var uuid UUID
_, err := io.ReadFull(rander, uuid[:])
if err != nil {
- return NIL, err
+ return Nil, err
}
uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10