diff options
| author | 2026-02-21 02:07:45 +0800 | |
|---|---|---|
| committer | 2026-02-21 02:07:45 +0800 | |
| commit | 0591334a91e75fb48a081f3130d9633ef0523c5c (patch) | |
| tree | bcc70622c8aec7ce97f7fdfd8a8563dac5102068 /object/ident.go | |
| parent | object: Reformat (diff) | |
| signature | No signature | |
object: Right, I could use Cut here
Diffstat (limited to 'object/ident.go')
| -rw-r--r-- | object/ident.go | 8 |
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") } |
