Skip to content

Commit

Permalink
Update indirect dependencies from update-mod-version script (riverq…
Browse files Browse the repository at this point in the history
…ueue#540)

This is driven by [1] and the same bug we'd noticed in another project
previously too. Until now, `update-mod-version` hadn't been updating
versions on indirect dependencies, and `rivershared` in the CLI had been
indirect, thereby causing it to try and resolve v0.11.2 instead of
v0.11.3.

Here, update the script so that indirect dependencies are updated as
well.

[1] riverqueue#538
  • Loading branch information
brandur authored and tigrato committed Dec 18, 2024
1 parent 6ce199f commit 3311e0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rivershared/cmd/update-mod-version/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func parseAndUpdateGoModFile(filename, version string) (bool, error) {
fmt.Printf("%s\n", filename)

for _, require := range modFile.Require {
if require.Indirect || !strings.HasPrefix(require.Mod.Path, "github.com/riverqueue/river") {
if !strings.HasPrefix(require.Mod.Path, "github.com/riverqueue/river") {
continue
}

Expand Down
7 changes: 6 additions & 1 deletion rivershared/cmd/update-mod-version/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ require (
github.com/riverqueue/river/riverdriver v0.0.0-00010101000000-000000000000
github.com/riverqueue/river/riverdriver/riverdatabasesql v0.0.0-00010101000000-000000000000
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.0.12
)
require (
github.com/riverqueue/river/rivershared v0.0.12 // indirect
)`

func TestParseAndUpdateGoModFile(t *testing.T) {
Expand Down Expand Up @@ -60,7 +64,7 @@ func TestParseAndUpdateGoModFile(t *testing.T) {

versions := make([]module.Version, 0, len(modFile.Require))
for _, require := range modFile.Require {
if require.Indirect || !strings.HasPrefix(require.Mod.Path, "github.com/riverqueue/river") {
if !strings.HasPrefix(require.Mod.Path, "github.com/riverqueue/river") {
continue
}

Expand All @@ -71,6 +75,7 @@ func TestParseAndUpdateGoModFile(t *testing.T) {
{Path: "github.com/riverqueue/river/riverdriver", Version: "v0.0.13"},
{Path: "github.com/riverqueue/river/riverdriver/riverdatabasesql", Version: "v0.0.13"},
{Path: "github.com/riverqueue/river/riverdriver/riverpgxv5", Version: "v0.0.13"},
{Path: "github.com/riverqueue/river/rivershared", Version: "v0.0.13"},
}, versions)

// Running again is allowed and should be idempontent. This time it'll
Expand Down

0 comments on commit 3311e0d

Please sign in to comment.