zeroshade commented on code in PR #2764:
URL: https://github.com/apache/iceberg-go/pull/2764#discussion_r4743918448


##########
internal/uuid/uuid.go:
##########
@@ -38,3 +38,7 @@ func MustParse(s string) UUID { return uuid.MustParse(s) }
 
 // FromBytes returns the UUID held in b, which must be exactly 16 bytes long.
 func FromBytes(b []byte) (UUID, error) { return uuid.FromBytes(b) }
+
+// NewV7 returns a time-ordered (version 7) UUID. It panics if the random
+// source fails, as New does.
+func NewV7() UUID { return uuid.Must(uuid.NewV7()) }

Review Comment:
   nit: nothing stops someone from importing `github.com/google/uuid` again 
outside this package, and the build-tag swap would then silently miss that 
file. A `depguard` rule in `.golangci.yml` that denies it everywhere except 
`internal/uuid` would catch it in lint. There's no depguard config today, so 
this could be a small follow-up.



##########
table/table.go:
##########
@@ -326,7 +326,7 @@ func (t *Table) Refresh(ctx context.Context) error {
 }
 
 func validateTableUUID(identifier Identifier, expected, actual uuid.UUID) 
error {
-       if expected == uuid.Nil || actual == uuid.Nil || expected == actual {
+       if expected == (uuid.UUID{}) || actual == (uuid.UUID{}) || expected == 
actual {

Review Comment:
   nit: `== (uuid.UUID{})` now appears about ten times (table/view/udf 
builders, here, tests). The stdlib has `uuid.Nil()` as a function, so a `func 
Nil() UUID` (or `IsZero`) in `internal/uuid` would work on both sides of the 
swap and read better. Fine to leave for the build-tag follow-up.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to