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

Standardize passing of pointers for interface{} in option setters

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • None

    Description

      We have a number of setters in the driver that take an interface{} as a parameter and use it to set a field on the receiver that is also of type interface{}. Some of those setters do receiver.field = &value while others do receiver.field = value. If I'm not mistaken, because of automatic dereferencing, either seems to work (although I also thought Go does not automatically dereference pointers to interfaces). However, we should standardize how these setters set their field and determine if passing by pointer is ever needed (it might be because of other code that needs to modify the initial value).

      The driver uses pointer fields to allow "nil means unset" semantics in a lot of places, so I was assuming someone unintentionally followed the same pattern without realizing they were assigning to an interface{} field.

      Attachments

        Activity

          People

            Unassigned Unassigned
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: