- edited description
Is it necessary to import sql drivers in lib/goose?
Specifically, https://bitbucket.org/liamstask/goose/src/8488cc47d90c8a502b1c41a462a6d9cc8ee0a895/lib/goose/migrate.go?at=master#cl-16
I am importing lib/goose
in to my applications for the migration functionality, and it ends up pulling all of these drivers.
This is undesirable because:
- BInary size
- It kills the ability to cross-compile, because the sqlite3 driver uses cgo...
../../liamstask/goose/lib/goose/dialect.go:5:2: C source files not allowed when not using cgo: sqlite3.c
[1]
I believe this can be avoided, because sql drivers are not needed for compilation, only for runtime.
In this case, cmd/goose
could be the one importing the drivers, leaving lib/goose
to be embedded in other applications without pulling in useless drivers with it (fwiw it worked in a fork for me)
That seems to make sense in my head, let me know what you think.
Thanks for your work.
--
- There is a single compile-time dependency on sqlite3 driver here: https://bitbucket.org/liamstask/goose/src/8488cc47d90c8a502b1c41a462a6d9cc8ee0a895/lib/goose/dialect.go?at=master#cl-119 , but maybe it is possible to get rid of it?
Comments (3)
-
reporter -
I'm having the same problem, would be nice to be able to cross compile. For now I'm building on a remote box.
-
+1, the SQL drivers should be imported in
cmd/goose
instead. - Log in to comment