From 3018594d8885b580df72ceb9d0936d25e888b07f Mon Sep 17 00:00:00 2001 From: Bryan Matsuo Date: Sun, 28 Feb 2016 00:52:46 -0800 Subject: [PATCH 1/3] misc godoc fixes Fairly simple typos. The only peculiar thing is the godoc comment for UUID.Version(). --- dce.go | 2 +- uuid.go | 3 +-- version1.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dce.go b/dce.go index 8523659..19aed6b 100644 --- a/dce.go +++ b/dce.go @@ -61,7 +61,7 @@ func (uuid UUID) Domain() Domain { 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 { return binary.BigEndian.Uint32(uuid[0:4]) diff --git a/uuid.go b/uuid.go index 18e71b1..3152414 100644 --- a/uuid.go +++ b/uuid.go @@ -67,7 +67,7 @@ func Parse(s string) (UUID, error) { return uuid, nil } -// ParseBytes is like Parse, exect it parses a byte slice instead of a string. +// ParseBytes is like Parse, except it parses a byte slice instead of a string. func ParseBytes(b []byte) (UUID, error) { // Parsing a string is actually faster than parsing a byte slice as it // is cheaper to slice a string. Further, it is not safe to convert @@ -129,7 +129,6 @@ func (uuid UUID) Variant() Variant { } // Version returns the version of uuid. -// valid. func (uuid UUID) Version() Version { return Version(uuid[6] >> 4) } diff --git a/version1.go b/version1.go index 6fe1cd2..a681953 100644 --- a/version1.go +++ b/version1.go @@ -13,7 +13,7 @@ import ( // 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. +// return the current NewUUID returns an error. // // In most cases, New should be used. func NewUUID() (UUID, error) { From edbe6ec0cc826be984fb7ba1fcf7f43a875e5f59 Mon Sep 17 00:00:00 2001 From: Bryan Matsuo Date: Sun, 28 Feb 2016 01:03:09 -0800 Subject: [PATCH 2/3] make receiver names for marshal.go methods consistent with other UUID methods --- marshal.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/marshal.go b/marshal.go index 435ca7c..7e993cd 100644 --- a/marshal.go +++ b/marshal.go @@ -10,33 +10,33 @@ import ( ) // MarshalText implements encoding.TextMarshaler. -func (u UUID) MarshalText() ([]byte, error) { +func (uuid UUID) MarshalText() ([]byte, error) { var js [36]byte - encodeHex(js[:], u) + encodeHex(js[:], uuid) return js[:], nil } // UnmarshalText implements encoding.TextUnmarshaler. -func (u *UUID) UnmarshalText(data []byte) error { +func (uuid *UUID) UnmarshalText(data []byte) error { // See comment in ParseBytes why we do this. // id, err := ParseBytes(data) id, err := Parse(*(*string)(unsafe.Pointer(&data))) if err == nil { - *u = id + *uuid = id } return err } // MarshalBinary implements encoding.BinaryMarshaler. -func (u UUID) MarshalBinary() ([]byte, error) { - return u[:], nil +func (uuid UUID) MarshalBinary() ([]byte, error) { + return uuid[:], nil } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (u *UUID) UnmarshalBinary(data []byte) error { +func (uuid *UUID) UnmarshalBinary(data []byte) error { if len(data) != 16 { return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) } - copy(u[:], data) + copy(uuid[:], data) return nil } From 9ce06d2d1de3e4f18408f34e3d87f90c44822476 Mon Sep 17 00:00:00 2001 From: Bryan Matsuo Date: Sun, 28 Feb 2016 01:20:19 -0800 Subject: [PATCH 3/3] small change to NewUUID return docs --- version1.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version1.go b/version1.go index a681953..9020bd5 100644 --- a/version1.go +++ b/version1.go @@ -13,7 +13,7 @@ import ( // 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 an error. +// return the current NewUUID returns NIL and an error. // // In most cases, New should be used. func NewUUID() (UUID, error) {