[GODRIVER-769] Remove use of internal package from connstring package Created: 16/Jan/19  Updated: 28/Oct/23  Resolved: 24/Jan/19

Status: Closed
Project: Go Driver
Component/s: Internal
Affects Version/s: None
Fix Version/s: 0.3.0

Type: Bug Priority: Critical - P2
Reporter: Yifan Sun Assignee: Divjot Arora (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 18.04


Attachments: PNG File image-2019-01-16-13-27-20-888.png    

 Description   

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!

 



 Comments   
Comment by Githook User [ 24/Jan/19 ]

Author:

{'email': 'divjot.arora@10gen.com', 'name': 'Divjot Arora', 'username': 'divjotarora'}

Message: Remove testing dependency from internal

GODRIVER-769

Change-Id: I6cd5f9e1f48b2256f6308b6f59e9a2ba945c260b
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/ceee14bded1c58ee34ace29896831314b856095a

Generated at Thu Feb 08 08:34:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.