jmoiron / sqlx

general purpose extensions to golang's database/sql
http://jmoiron.github.io/sqlx/
MIT License
15.95k stars 1.07k forks source link

split integration tests into their own package #642

Open Blank-Xu opened 4 years ago

Blank-Xu commented 4 years ago

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.

Indribell commented 3 years ago

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.

arp242 commented 3 years ago

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".

jwendel commented 6 months ago

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.

krwu commented 3 months ago

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.