pressly / goose

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

Split goose into separate modules (same repository) #664

Open mfridman opened 10 months ago

mfridman commented 10 months ago

More of a thought at the moment, but wanted to jot this down.

Currently, the goose package and the CLI are tracked as a single Go module and versioned together (think single go.mod in the entire repository). However, there are some limitations to this approach:

Limitations

So, what I'm proposing is to add go.{mod|sum} files into ./cmd/goose and track the CLI and its dependencies as a separate module.

module github.com/pressly/goose/cmd/goose

For local development can use

  1. go work init (initialize a go.work file)
  2. go work use -r . (recursively add all modules, and sub-modules)

There are a few downsides to this approach through,

Cons

# before
go install github.com/pressly/goose/v3/cmd/goose@latest
# after
go install github.com/pressly/goose/cmd/goose/v3@latest

Pros

FelipeLema commented 7 months ago

My take is that, given how I've seen other code being organized, is that this tool supports "latest stable" Go version and previous versions are manually supported by backporting code and/or deactivating features.

my bet is that dependencies should follow this scheme, which sounds more likely to happen than them holding on to previous Go releases. At least, to me.

In this scheme, keeping separate branches sounds like a way to go. Something like having these binaries per goose release