ref: 4a461d214e1a0ea6361516da36b30328ced1917c
parent: aa048b1320e5ae4a72a1927476460955a8727c52
author: Runxi Yu <me@runxiyu.org>
date: Sat Mar 7 09:23:34 EST 2026
objectid: Add Zero
--- a/objectid/objectid.go
+++ b/objectid/objectid.go
@@ -59,6 +59,16 @@
return bytes.Compare(left.RawBytes(), right.RawBytes())
}
+// Zero returns the all-zero object ID for the specified algorithm.
+func Zero(algo Algorithm) ObjectID {+ id, err := FromBytes(algo, make([]byte, algo.Size()))
+ if err != nil {+ panic(err)
+ }
+
+ return id
+}
+
// ParseHex parses an object ID from hex for the specified algorithm.
func ParseHex(algo Algorithm, s string) (ObjectID, error) {var id ObjectID
--
⑨