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

Allow only 0 or 1 options structs in all APIs that accept variadic options args

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • 2.0.0
    • None
    • None
    • None
    • Major Change

    Description

      Currently we maintain many Merge*Options functions that merge options structs together. These are used to merge possibly many options structs passed to functions that accept a variadic argument of 0 or more options structs. While that function signature has the benefit of allowing users to pass or not pass options, maintaining the Merge*Options functions adds a significant maintenance burden and has resulted in numerous bugs. Very few users pass multiple options structs (maybe no users), so there's no major need to support passing more than 1 options struct. Instead, return an error if 2 or more options structs are passed and remove all Merge*Options functions.

      Definition of done:

      • For all functions that accept a variadic argument for function options structs, accept either 0 or 1 structs. If the user passes 2 or more structs, return an InvalidArgumentError.
      • Remove all Merge*Options options struct merging functions in all packages.

      Attachments

        Activity

          People

            qingyang.hu@mongodb.com Qingyang Hu
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: