-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Go Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Context
GODRIVER-3587 proposes reverting valueReader} to use in memory buffered reads, rather than the streaming solution implemented in v2. In Go, only implementations of the io.Reader should ever return io.EOF--and only to signal that no more data is available. Higher-level functions that consume a complete buffer (like json.Unmarshal and soon valueReader) shouldn't treat end-of-input as an io.EOF condition, but instead return their own parse-error types.
Definition of done
If the pattern in GODRIVER-3587 is accepted, the following methods should change io.EOF to something specific to the bson package: bufferedValueReader.(peek|discard|readSlice|regexLength).
Pitfalls
It's unclear what the errors should be, but it would be convenient for users if it was aligned to the json package as closely as possible.