diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-08-30 12:59:20 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-08-30 12:59:20 +0900 |
| commit | d4fab811d3857c36f1d8271a940ffca113e012b7 (patch) | |
| tree | 6a3acb3f64d6b74669a3049754313394bc0e7599 /internal/store/segment.go | |
| parent | c2d900ec74e03e9c782cfe7b7ce06ff62cda6601 (diff) | |
internal/store: improve doc comments
This improves readability on narrow 3:2 display.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/store/segment.go')
| -rw-r--r-- | internal/store/segment.go | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/internal/store/segment.go b/internal/store/segment.go index 06849749..32c8a141 100644 --- a/internal/store/segment.go +++ b/internal/store/segment.go @@ -92,8 +92,14 @@ func (eh *EntryHandle) Load(v *hst.State) (hst.Enablements, error) { if v != nil { et, err = entryDecode(f, v) if err == nil && v.ID != eh.ID { - err = &hst.AppError{Step: "validate state identifier", Err: os.ErrInvalid, - Msg: fmt.Sprintf("state entry %s has unexpected id %s", eh.ID.String(), v.ID.String())} + err = &hst.AppError{ + Step: "validate state identifier", + Err: os.ErrInvalid, + Msg: fmt.Sprintf( + "state entry %s has unexpected id %s", + eh.ID.String(), v.ID.String(), + ), + } } } else { et, err = entryDecodeHeader(f) @@ -127,7 +133,10 @@ type Handle struct { // A non-nil error returned by Lock is of type [hst.AppError]. func (h *Handle) Lock() (unlock func(), err error) { if unlock, err = h.fileMu.Lock(); err != nil { - return nil, &hst.AppError{Step: "acquire lock on store segment " + strconv.Itoa(h.Identity), Err: err} + return nil, &hst.AppError{ + Step: "acquire lock on store segment " + strconv.Itoa(h.Identity), + Err: err, + } } return } @@ -174,8 +183,11 @@ func (h *Handle) Entries() (iter.Seq[*EntryHandle], int, error) { // this should never happen if ent.IsDir() { - eh.DecodeErr = &hst.AppError{Step: step, - Err: errors.New("unexpected directory " + strconv.Quote(ent.Name()) + " in store")} + eh.DecodeErr = &hst.AppError{ + Step: step, + Err: errors.New("unexpected directory " + + strconv.Quote(ent.Name()) + " in store"), + } goto out } @@ -186,7 +198,10 @@ func (h *Handle) Entries() (iter.Seq[*EntryHandle], int, error) { // this either indicates a serious bug or external interference if err := eh.ID.UnmarshalText([]byte(ent.Name())); err != nil { - eh.DecodeErr = &hst.AppError{Step: "decode store segment entry", Err: err} + eh.DecodeErr = &hst.AppError{ + Step: "decode store segment entry", + Err: err, + } goto out } |
