Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-344

isZero function should compare structs with DeepEquals

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Structs in Go can't be directly compared with simple equality if they contain slice, map, or function fields. Currently, if such a struct is passed through the BSON encoder and the isZero function is hit, a panic is triggered.

      Should instead use reflect.DeepEqual at this line: https://github.com/mongodb/mongo-go-driver/blob/master/bson/encode.go#L466

            Assignee:
            Unassigned Unassigned
            Reporter:
            thomas.delacour@mongodb.com Thomas Delacour (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: