mirror of
https://github.com/google/uuid.git
synced 2024-11-28 08:49:08 +02:00
remove redundant nil checks in UUID.String() and UUID.URN()
This commit is contained in:
parent
9e4836cc57
commit
0ec82b41c6
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
|
||||
|
Loading…
Reference in New Issue
Block a user