Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-2719 Remove unnecessary errors from bson.Encoder/bson.Decoder. #1525

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

qingyang-hu
Copy link
Collaborator

@qingyang-hu qingyang-hu commented Jan 20, 2024

GODRIVER-2719

Summary

  • Remove the errors returned by bson.NewEncoder/bson.NewDecoder and New*ValueWriter/New*ValueReader.
  • Rename bson.NewBSONValueWriter to bson.NewValueWriter.
  • Rename NewBSONDocumentReader to NewValueReader.
  • Remove NewBSONValueReader.

Background & Motivation

The PR proposes to let subsequent calls panic with a "nil pointer dereference" rather than panic explicitly for nil function arguments as the ticket description suggests because 1, it is what the Go "encoding/json" library does; 2, it is will be difficult to maintain the consistency of the panic information/style.

Copy link
Contributor

mongodb-drivers-pr-bot bot commented Jan 20, 2024

API Change Report

./bson

incompatible changes

##NewDecoder: changed from func(./bson/bsonrw.ValueReader) (*Decoder, error) to func(./bson/bsonrw.ValueReader) *Decoder

./bson/bsonrw

incompatible changes

NewBSONDocumentReader: removed
NewBSONValueWriter: removed
NewExtJSONValueWriter: changed from func(io.Writer, bool, bool) (ValueWriter, error) to func(io.Writer, bool, bool) ValueWriter

compatible changes

NewValueReader: added
NewValueWriter: added

@qingyang-hu qingyang-hu force-pushed the godriver2719 branch 4 times, most recently from b770d14 to 642f3b0 Compare January 23, 2024 16:30
@qingyang-hu qingyang-hu marked this pull request as ready for review January 23, 2024 18:39
@qingyang-hu qingyang-hu requested a review from a team as a code owner January 23, 2024 18:39
@qingyang-hu qingyang-hu requested review from prestonvasquez and matthewdale and removed request for a team January 23, 2024 18:39
@qingyang-hu qingyang-hu changed the title GODRIVER-2719 Remove unnecessary errors from bson.Encoder\bson.Decoder. GODRIVER-2719 Remove unnecessary errors from bson.Encoder/bson.Decoder. Jan 23, 2024
@qingyang-hu qingyang-hu marked this pull request as draft January 23, 2024 20:17
@qingyang-hu qingyang-hu marked this pull request as ready for review January 24, 2024 14:36
Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@qingyang-hu qingyang-hu merged commit 6109bd1 into mongodb:master Jan 25, 2024
36 of 40 checks passed
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.

3 participants