Skip to content

Commit

Permalink
Update indirect dependencies from update-mod-version script (#540)
Browse files Browse the repository at this point in the history
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] #538
  • Loading branch information
brandur authored Aug 20, 2024
1 parent 94b0a78 commit a43b18e
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 a43b18e

Please sign in to comment.