Fix errcheck violations in chat persist.go
Handle error returns from it.Close() by explicitly ignoring them with _ = pattern in defer statements Co-authored-by: cognitive-glitch <152830360+cognitive-glitch@users.noreply.github.com>
copilot-swe-agent[bot] committed
Oct 22, 2025 at 17:15 UTC
da7573990897e621fe06ee040d6fc542bb99df73
2 files changed
+2
-2
chat
Binary files /dev/null and b/chat differ
sdk/go/examples/chat/persist.go
+2
-2
@@ -37,7 +37,7 @@ func openMessageStore(dir string) (*messageStore, error) {
37
if err != nil {
38
return nil, err
39
}
40
- defer it.Close()
40
+ defer func() { _ = it.Close() }()
41
if it.Last() {
42
if len(it.Key()) >= 8 {
43
s.next = binary.BigEndian.Uint64(it.Key()[:8]) + 1
@@ -67,7 +67,7 @@ func (s *messageStore) LoadAll() ([]message, error) {
67
if err != nil {
68
return nil, err
69
}
70
- defer it.Close()
70
+ defer func() { _ = it.Close() }()
71
out := make([]message, 0, 256)
72
for it.First(); it.Valid(); it.Next() {
73
var m message