Skip to content

Commit b7a8cc9

Browse files
committed
comments
1 parent 3f5394b commit b7a8cc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

id/uuid.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (u Base64UUID[U]) MarshalJSON() ([]byte, error) {
4545
if sub, err := u.AppendText(b[1:]); err != nil {
4646
return nil, err
4747
} else {
48-
b = b[:len(sub)+1]
48+
b = b[:len(sub)+1] // the appended text plus the " character.
4949
}
5050
b = append(b, '"')
5151

@@ -64,7 +64,7 @@ func (u *Base64UUID[U]) UnmarshalJSON(b []byte) error {
6464

6565
func (u Base64UUID[U]) AppendText(b []byte) ([]byte, error) {
6666
b = slices.Grow(b, base64UUIDEncodedLen)
67-
b = b[:len(b)+base64UUIDEncodedLen]
67+
b = b[:len(b)+base64UUIDEncodedLen] // safe since we already grew the buffer.
6868
Base64.Encode(b, u.Value[:])
6969
return b, nil
7070
}

0 commit comments

Comments
 (0)