pressly / goose

A database migration tool. Supports SQL migrations and Go functions.
http://pressly.github.io/goose/
Other
6.14k stars 494 forks source link

Modular dependencies architecture #778

Open MistaTwista opened 2 weeks ago

MistaTwista commented 2 weeks ago

Hey guys, I have an issue with dependencies conflict in a project that having old clickhouse library as its own dependency. Is there any roadmap plans where dependencies of a goose are connectable packages so if I use goose for PG migrations I can use any Clickhouse driver without an issues? I understand that it's not so easy problem, but may be for next major update or something?

mfridman commented 2 weeks ago

Yeah, this is a bit unfortunate. I opened an issue to track splitting this project into 2 modules (library and cli):

https://github.com/pressly/goose/issues/664

But I'm also waiting to see how the new Go toolchain will evolve which may alleviate these sort of issues

MistaTwista commented 5 days ago

Thanks for the info) How do you plan to use toolchain for such things? If i'm right toolchain is giving you opportunity to select exact go tooling version, but problems are from unused dependencies. Is there any proposal from the go team that might help? Do I need to move my questions to #664 ?

mfridman commented 3 days ago

How do you plan to use toolchain for such things?

This will be automatically handled by the Go toolchain, so in my ideal world I could keep the goose project pinned to a minimum version that lags 2 versions behind the current release. E.g., at the time of this writing the current version is go1.22 and so we support go1.22, go1.21 and go.1.20. And the toolchain should correctly compile code and switching as needed (in your project). We'll see if this works out as intended, and it's behavior that'll come with later go version, so not a solution at the moment.

The current challenge is that the latest version of CilckHouse driver (as an example) has pinned to go1.21

https://github.com/ClickHouse/clickhouse-go/blob/v2.26.0/go.mod#L3

And in order to pull in this dependency, we'd need to bump the minimum supported version from go1.20 to go1.21.

This is the dilemma I currently have.

In a few months we'll bump the dependencies, so this is a temporary problem. Would even consider doing it sooner.

mfridman commented 19 hours ago

I upgraded the minimum go version to 1.21, and pulled in the latest ClickHouse version (v2.26.0) in https://github.com/pressly/goose/pull/787

If you pull from master or pin to 0d8add824f25e26a6500e54000e592592b81409e or later, it should hopefully resolve your issue.