sql-migrate
sql-migrate copied to clipboard
Build optimizations?
Of all the dependencies in my project, sql-migrate
is the slowest to build on a clean run. I think this was because of the references to all the database drivers included.
Is there a way to speed this up?
What helps a lot is running go install github.com/mattn/go-sqlite3
. Same thing probably applies for the other database engines.
This doesn't help you for a clean compile (it's all the cgo stuff in there that makes it slow), but avoids it for subsequent compiles.
How about injecting the db engines with sub packages, the way it's done with init()
, sql
pkg and all it's available drivers?
That way you don't have to worry about heavy pkgs like sqlite.
Example:
import (
"github.com/rubenv/sql-migrate"
_ "github.com/rubenv/sql-migrate/sqlite3"
_ "github.com/mattn/go-sqlite3"
)
Had a quick look and it seemed it's only config.go
and migrate.go
that imports all engines in the same place, so it feels pretty easy to split them up?