From f55bab87b2daf260aba719eb59e7bcd4b11bb266 Mon Sep 17 00:00:00 2001 From: Solaris-star <820622658@qq.com> Date: Fri, 24 Jul 2026 00:06:10 +0800 Subject: [PATCH] docs: document uuid.Nil as the empty all-zero UUID The package-level comment "Well known namespace IDs and UUIDs" was applied to Nil in godoc, which is misleading. Give Nil its own doc comment describing the empty UUID (#112). Fixes #112 --- hash.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hash.go b/hash.go index d3bc00a..f4098fa 100644 --- a/hash.go +++ b/hash.go @@ -10,13 +10,15 @@ import ( "hash" ) -// Well known namespace IDs and UUIDs +// Well known namespace IDs. var ( NameSpaceDNS = MustParse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") NameSpaceURL = MustParse("6ba7b811-9dad-11d1-80b4-00c04fd430c8") NameSpaceOID = MustParse("6ba7b812-9dad-11d1-80b4-00c04fd430c8") NameSpaceX500 = MustParse("6ba7b814-9dad-11d1-80b4-00c04fd430c8") - Nil UUID // empty UUID, all zeros + + // Nil is the empty UUID, with all 128 bits set to zero. + Nil UUID // The Max UUID is special form of UUID that is specified to have all 128 bits set to 1. Max = UUID{ @@ -45,7 +47,7 @@ func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { // NewMD5 returns a new MD5 (Version 3) UUID based on the // supplied name space and data. It is the same as calling: // -// NewHash(md5.New(), space, data, 3) +// NewHash(md5.New(), space, data, 3) func NewMD5(space UUID, data []byte) UUID { return NewHash(md5.New(), space, data, 3) } @@ -53,7 +55,7 @@ func NewMD5(space UUID, data []byte) UUID { // NewSHA1 returns a new SHA1 (Version 5) UUID based on the // supplied name space and data. It is the same as calling: // -// NewHash(sha1.New(), space, data, 5) +// NewHash(sha1.New(), space, data, 5) func NewSHA1(space UUID, data []byte) UUID { return NewHash(sha1.New(), space, data, 5) }