Skip to content

fix(go): handle EOF correctly in model download example of golang bidings#3671

Merged
ggerganov merged 1 commit into
ggml-org:masterfrom
Lumberj3ck:fix/go-model-download
Mar 16, 2026
Merged

fix(go): handle EOF correctly in model download example of golang bidings#3671
ggerganov merged 1 commit into
ggml-org:masterfrom
Lumberj3ck:fix/go-model-download

Conversation

@Lumberj3ck
Copy link
Copy Markdown
Contributor

The Download function inside of golang bindings examples had bug in its read loop:

Data loss on final read: Go's io.Reader contract allows Read to return n > 0
bytes and io.EOF simultaneously (last chunk + end of stream). The original code
checked the error before processing the written bytes, so the final chunk could be
silently dropped and the model file is never fully downloaded.

Before: write happens only if err == nil, and io.EOF propagates as an error to the
caller.
After: bytes are written first (if any), then io.EOF is handled as successful
completion.

@ggerganov ggerganov merged commit 79218f5 into ggml-org:master Mar 16, 2026
DakodaStemen pushed a commit to DakodaStemen/whisper.cpp that referenced this pull request Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants