mirror of
https://github.com/google/uuid.git
synced 2025-09-16 09:16:30 +02:00
remove redundant nil checks in UUID.String() and UUID.URN()
This commit is contained in:
4
uuid.go
4
uuid.go
@@ -79,7 +79,7 @@ func Equal(uuid1, uuid2 UUID) bool {
|
||||
// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
// , or "" if uuid is invalid.
|
||||
func (uuid UUID) String() string {
|
||||
if uuid == nil || len(uuid) != 16 {
|
||||
if len(uuid) != 16 {
|
||||
return ""
|
||||
}
|
||||
var buf [36]byte
|
||||
@@ -98,7 +98,7 @@ func (uuid UUID) String() string {
|
||||
// URN returns the RFC 2141 URN form of uuid,
|
||||
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.
|
||||
func (uuid UUID) URN() string {
|
||||
if uuid == nil || len(uuid) != 16 {
|
||||
if len(uuid) != 16 {
|
||||
return ""
|
||||
}
|
||||
var buf [36 + 9]byte
|
||||
|
Reference in New Issue
Block a user