Unable to update modules those imported indirectly

Hi folks, I’m managing some modules, but unable to update all modules to latest version via hugo mod get -u.

Reproducing steps.

Cloning the test repo and print the deps.

$ git clone git@github.com:razonyang/hugo-mod-tests

$ cd hugo-mod-tests

$ hugo mod graph
github.com/razonyang/hugo-mod-tests github.com/razonyang/hugo-mod-bar@v0.2.0
github.com/razonyang/hugo-mod-bar@v0.2.0 github.com/razonyang/hugo-mod-foo@v0.2.0

Update modules and print the deps again

The hugo-mod-foo’s latest version is v0.3.0, but hugo mod get -u won’t pull the latest version.

$ hugo mod get -u

$ hugo mod graph
github.com/razonyang/hugo-mod-tests github.com/razonyang/hugo-mod-bar@v0.2.0
github.com/razonyang/hugo-mod-bar@v0.2.0 github.com/razonyang/hugo-mod-foo@v0.2.0

To confirm that it is not an environmental or network issue, I created a GitHub workflow that run every 5 min, the results are same as mine.

image

But it’s weird that update successfully after removing the require line from go.mod manually

$ git diff
diff --git a/go.mod b/go.mod
index bb3d1e4..bb27506 100644
--- a/go.mod
+++ b/go.mod
@@ -4,5 +4,4 @@ go 1.20

 require (
        github.com/razonyang/hugo-mod-bar v0.2.0 // indirect
-       github.com/razonyang/hugo-mod-foo v0.2.0 // indirect
 )

$ hugo mod get -u
go: added github.com/razonyang/hugo-mod-foo v0.3.0
hugo: collected modules in 1576 ms

$ hugo mod graph
github.com/razonyang/hugo-mod-tests github.com/razonyang/hugo-mod-bar@v0.2.0
github.com/razonyang/hugo-mod-bar@v0.2.0 github.com/razonyang/hugo-mod-foo@v0.3.0

Closed by commands/mod: update all active modules by razonyang · Pull Request #11573 · gohugoio/hugo · GitHub.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.