summaryrefslogtreecommitdiff
path: root/src/guuid.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/guuid.go')
-rw-r--r--src/guuid.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/guuid.go b/src/guuid.go
index 0d20021..267affb 100644
--- a/src/guuid.go
+++ b/src/guuid.go
@@ -16,16 +16,13 @@ const (
uuidEncodedLength = (UUIDByteCount * 2) + uuidDashCount
)
-
var (
dashIndexes = []int { 8, 13, 18, 23 }
emptyUUID = UUID {}
-)
-var (
- BadLengthError = errors.New("guuid: str isn't of the correct length")
- BadDashCountError = errors.New("guuid: Bad count of dashes in string")
- BadDashPositionError = errors.New("guuid: Bad char in string")
+ ErrBadLength = errors.New("guuid: str isn't of the correct length")
+ ErrBadDashCount = errors.New("guuid: Bad count of dashes in string")
+ ErrBadDashPosition = errors.New("guuid: Bad char in string")
)
@@ -85,16 +82,16 @@ func (uuid UUID) String() string {
func FromString(str string) (UUID, error) {
if len(str) != uuidEncodedLength {
- return emptyUUID, BadLengthError
+ return emptyUUID, ErrBadLength
}
if strings.Count(str, "-") != uuidDashCount {
- return emptyUUID, BadDashCountError
+ return emptyUUID, ErrBadDashCount
}
for _, idx := range dashIndexes {
if str[idx] != '-' {
- return emptyUUID, BadDashPositionError
+ return emptyUUID, ErrBadDashPosition
}
}