The runnable examples in the "examples" directory are not runnable or buildable

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Unknown
    • 2.7.0
    • Affects Version/s: None
    • Component/s: Docs Examples
    • None
    • None
    • Go Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      If I try to run the testable examples in the "/examples" directory, none of the tests will run or even build.

      ❯ go test go.mongodb.org/mongo-driver/v2/examples                                                      
      # go.mongodb.org/mongo-driver/v2/examples
      no required module provides package go.mongodb.org/mongo-driver/v2/examples; to add it:
              go get go.mongodb.org/mongo-driver/v2/examples
      FAIL    go.mongodb.org/mongo-driver/v2/examples [setup failed]
      FAIL
      

      We effectively have a directory of Go code that the Go toolchain doesn't recognize as Go code. When writing or modifying that code, we have no indication of whether the code is either correct or even valid Go. We could be offering these examples and have no idea that they don't compile or run.

      Definition of done

      • Answer the following unknown: Figure out where the examples in the "/examples" directory are actually used / who they are targeting in order to determine how to maintain them moving forward. Determine whether they should be merged with the internal docs directory.
      • Ensure any examples from the "/examples" directory are buildable and runnable.

      Pitfalls

      What should the implementer watch out for? What are the risks?

            Assignee:
            Qingyang Hu
            Reporter:
            Matt Dale
            Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: