diff options
author | EuAndreh <eu@euandre.org> | 2024-09-28 06:23:46 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-09-28 06:23:46 -0300 |
commit | 0739cb4590b6eaf33fdd9a4e5946914845a6729d (patch) | |
tree | 9c7c6913c0964689459885dabbe58087351a3b7d /src/guuid.go | |
parent | Makefile: "var version" -> "const Version" (diff) | |
download | uuid-0739cb4590b6eaf33fdd9a4e5946914845a6729d.tar.gz uuid-0739cb4590b6eaf33fdd9a4e5946914845a6729d.tar.xz |
src/guuid.go: Rename XxxError to ErrXxx
Diffstat (limited to 'src/guuid.go')
-rw-r--r-- | src/guuid.go | 15 |
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 } } |