sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

split integration tests into their own package

Open Blank-Xu opened this issue 5 years ago • 5 comments

Would you mind to remove these packages from go.mod and go.sum?

github.com/go-sql-driver/mysql v1.4.0 github.com/lib/pq v1.0.0 github.com/mattn/go-sqlite3 v1.9.0

These three packages just used in test files and does not necessary to include in sqlx package.

Blank-Xu avatar Aug 06 '20 06:08 Blank-Xu

Indeed... We also looked at why so many dependencies are being included into our project, when we use the pure ( none CGO ) Go version of sqlite ( https://gitlab.com/cznic/sqlite ). Only to see that its all coming from sqlx.

Indribell avatar Sep 27 '20 20:09 Indribell

There isn't really any good solution for this; removing them means they will get re-added on go test, and you do want some versioning for test dependencies too. Modules also don't really have an option to list "test dependencies".

arp242 avatar Jan 24 '21 20:01 arp242

I'm wondering if the go.work file would be the way to go here. There could be the main library in one path, then all the tests in a separate path with its own go.mod file.

jwendel avatar Feb 13 '24 05:02 jwendel

Users can use sqlx with any database driver. However, the tests force them to install unnecessary MySQL, PostgreSQL or SQLite drivers, and the mattn/go-sqlite3 cause users have to enable CGO.

krwu avatar May 20 '24 07:05 krwu