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

Remove use of internal package from connstring package

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 0.3.0
    • Affects Version/s: None
    • Component/s: Internal
    • Labels:
      None
    • Environment:
      Ubuntu 18.04

      The connstring package uses the internal package to wrap errors, but that package directly imports the testing package. Either we need to remove the code that's testing related from the internal package or we need to remove the use of the internal package from the connstring package. This dependency is currently causing the testing package to register it's flags which affects any user applications importing the driver.

      (original description below)


      I am using MongoDB go driver in my project. Everything works fine reading and writing the database. However, as I add MongoDB go driver as a dependency, the help message shows the unit testing commands like in the following screenshot. 

       

      This is a sign that the production code depends on the testing package. I then used godepgraph (https://github.com/kisielk/godepgraph)  to figure out which package depends on the testing package. I can identify that the internal package is where the problem is and this line (https://github.com/mongodb/mongo-go-driver/blob/422ba92f7d4e819d4f08b95ab7ca067f9612d437/internal/channel_connection.go#L11) suggests that the testing package is used in a file that is not ended with `_test`. 

       

      Am I using the mongodb-go-driver in a wrong way? Or if I am correct, can someone fix this problem? 

       

      Thanks!

       

            Assignee:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Reporter:
            sunyifan112358 Yifan Sun
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: