fix data race in WriteGGUF (#10598)

err in the go routine should not be shared with the outer scope
This commit is contained in:
Daniel Hiltgen 2025-05-06 17:36:38 -07:00 committed by GitHub
parent fa393554b9
commit af31ccefc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -569,7 +569,7 @@ func WriteGGUF(f *os.File, kv KV, ts []*Tensor) error {
t := t t := t
w := io.NewOffsetWriter(f, offset+int64(t.Offset)) w := io.NewOffsetWriter(f, offset+int64(t.Offset))
g.Go(func() error { g.Go(func() error {
_, err = t.WriteTo(w) _, err := t.WriteTo(w)
return err return err
}) })
} }