diff options
Diffstat (limited to '')
-rw-r--r-- | src/guuid.go | 16 | ||||
-rw-r--r-- | tests/guuid.go | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/guuid.go b/src/guuid.go index 267affb..b8cf5fe 100644 --- a/src/guuid.go +++ b/src/guuid.go @@ -11,9 +11,9 @@ import ( const ( - UUIDByteCount = 16 - uuidDashCount = 4 - uuidEncodedLength = (UUIDByteCount * 2) + uuidDashCount + ByteCount = 16 + dashCount = 4 + encodedLength = (ByteCount * 2) + dashCount ) var ( @@ -27,7 +27,7 @@ var ( -type UUID [UUIDByteCount]byte +type UUID [ByteCount]byte @@ -56,7 +56,7 @@ func NewBytes() []byte { } func (uuid UUID) String() string { - dst := [uuidEncodedLength]byte { + dst := [encodedLength]byte { 0, 0, 0, 0, 0, 0, 0, 0, '-', @@ -81,11 +81,11 @@ func (uuid UUID) String() string { } func FromString(str string) (UUID, error) { - if len(str) != uuidEncodedLength { + if len(str) != encodedLength { return emptyUUID, ErrBadLength } - if strings.Count(str, "-") != uuidDashCount { + if strings.Count(str, "-") != dashCount { return emptyUUID, ErrBadDashCount } @@ -101,5 +101,5 @@ func FromString(str string) (UUID, error) { return emptyUUID, err } - return [UUIDByteCount]byte(data), nil + return [ByteCount]byte(data), nil } diff --git a/tests/guuid.go b/tests/guuid.go index c351bba..f4d182c 100644 --- a/tests/guuid.go +++ b/tests/guuid.go @@ -177,7 +177,7 @@ func test_NewBytes() { }) testing("we get the correct byte count", func() { - assertEq(len(NewBytes()), UUIDByteCount) + assertEq(len(NewBytes()), ByteCount) }) } |