aboutsummaryrefslogtreecommitdiff
path: root/object/ident.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-02-21 02:07:45 +0800
committerGravatar Runxi Yu2026-02-21 02:07:45 +0800
commit0591334a91e75fb48a081f3130d9633ef0523c5c (patch)
treebcc70622c8aec7ce97f7fdfd8a8563dac5102068 /object/ident.go
parentobject: Reformat (diff)
signatureNo signature
object: Right, I could use Cut here
Diffstat (limited to 'object/ident.go')
-rw-r--r--object/ident.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/object/ident.go b/object/ident.go
index e601802a..432a0977 100644
--- a/object/ident.go
+++ b/object/ident.go
@@ -39,16 +39,16 @@ func ParseIdent(line []byte) (*Ident, error) {
return nil, errors.New("object: ident: missing timestamp separator")
}
rest = rest[1:]
- sp := bytes.IndexByte(rest, ' ')
- if sp < 0 {
+ before, after, ok := bytes.Cut(rest, []byte{' '})
+ if !ok {
return nil, errors.New("object: ident: missing timezone separator")
}
- when, err := strconv.ParseInt(string(rest[:sp]), 10, 64)
+ when, err := strconv.ParseInt(string(before), 10, 64)
if err != nil {
return nil, fmt.Errorf("object: ident: invalid timestamp: %w", err)
}
- tz := rest[sp+1:]
+ tz := after
if len(tz) < 5 {
return nil, errors.New("object: ident: invalid timezone encoding")
}