Closed razonyang closed 11 months ago
I was a little puzzled about this, because everything worked fine for me, testing with my own project and your project, all without hickups. Then I copied and pasted your command "hugo mod get -u -v ./..." ... and boom ...
The thing is, the flag handling in "hugo mod get" is a little peculiar, as we pass on most of the flags to the go
command, which had a peculiar effect in your case.
Try running without the -v
flag:
hugo mod get -u ./...
Try running without the -v flag.
$ hugo mod get -u ./...
Update module in /home/razonyang/Projects/razonyang/hb-site
go: downloading github.com/razonyang/hb/modules/base v0.4.0
go: upgraded github.com/razonyang/hb/modules/base v0.3.9 => v0.4.0
$ hugo mod get -u ./...
Update module in /home/razonyang/Projects/razonyang/hb-site
$ cat go.mod | grep hugo-mod-bootstrap
// replace github.com/razonyang/hugo-mod-bootstrap => ../hugo-mod-bootstrap
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20200.20101 // indirect
github.com/razonyang/hugo-mod-bootstrap v0.4.0 // indirect
$ hugo mod get -u github.com/razonyang/hugo-mod-bootstrap
go: downloading github.com/razonyang/hugo-mod-bootstrap v0.5.1
go: upgraded github.com/razonyang/hugo-mod-bootstrap v0.4.0 => v0.5.1
Just tested this in another site, some modules haven't been upgraded until explicitly specify the module after hugo mod get -u
.
The v0.5.1 is released yesterday.
I'll try to test this in other environments.
I just tested this on the US (NY) Server, but same issue reached.
Full steps:
$ git clone https://github.com/razonyang/hb-site.git
Cloning into 'hb-site'...
remote: Enumerating objects: 639, done.
remote: Counting objects: 100% (639/639), done.
remote: Compressing objects: 100% (378/378), done.
remote: Total 639 (delta 204), reused 577 (delta 142), pack-reused 0
Receiving objects: 100% (639/639), 3.01 MiB | 36.64 MiB/s, done.
Resolving deltas: 100% (204/204), done.
$ cd hb-site
$ git checkout b13f5e34d46909a0dd1d35ebc8c2f5645b00f899
$ cat go.mod | grep razonyang/hugo-mod-bootstrap
// replace github.com/razonyang/hugo-mod-bootstrap => ../hugo-mod-bootstrap
github.com/razonyang/hugo-mod-bootstrap v0.5.1 // indirect
$ echo $HUGO_MODULE_PROXY
$ hugo mod get -u ./...
Update module in /root/hb-site
hugo: collected modules in 1970 ms
$ cat go.mod | grep razonyang/hugo-mod-bootstrap
// replace github.com/razonyang/hugo-mod-bootstrap => ../hugo-mod-bootstrap
github.com/razonyang/hugo-mod-bootstrap v0.5.1 // indirect
$ hugo mod get -u github.com/razonyang/hugo-mod-bootstrap
go: github.com/razonyang/hugo-mod-bootstrap upgrade => v0.6.4
$ hugo env
hugo v0.111.1-39a4a3cf676533859217805c36181c7a3dfa321c+extended linux/amd64 BuildDate=2023-03-02T10:08:26Z VendorInfo=gohugoio
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.20.1"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.2.4"
I realized that the modules not imported directly will not be updated.
The github.com/razonyang/hugo-mod-bootstrap
is imported by github.com/razonyang/hb/modules/bootstrap
, it works when I declare the module in site's configuration. hugo mod get -u ./...
seems won't update requirements of submodules.
$ hugo mod graph | grep razonyang/hugo-mod-bootstrap
github.com/razonyang/hb/modules/bootstrap@v0.1.0 github.com/razonyang/hugo-mod-bootstrap@v0.5.1
$ git diff config/_default/hugo.yml
diff --git a/config/_default/hugo.yml b/config/_default/hugo.yml
index db75644..bcba64f 100644
--- a/config/_default/hugo.yml
+++ b/config/_default/hugo.yml
@@ -11,6 +11,7 @@ module:
imports:
# site modules
- path: github.com/razonyang/hugo-mod-html
+ - path: github.com/razonyang/hugo-mod-bootstrap
- path: github.com/razonyang/hb/modules/progress-bar
- path: github.com/razonyang/hb/modules/back-to-top
- path: github.com/razonyang/hb/modules/base
$ hugo mod get -u
go: github.com/razonyang/hugo-mod-bootstrap upgrade => v0.6.4
I'm encountering similar issues, although in my repository the update command fails for direct dependencies too. The particular example contains a subfolder exampleSite
that references its parent with a module replacement (in exampleSite/config/_default/hugo.toml
).
[module]
replacements = 'github.com/gethinode/hinode -> ../..'
[[module.imports]]
path = "github.com/gethinode/hinode"
For some odd reason, the version of the module mod-flexsearch
is newer in the exampleSite than in the parent folder:
exampleSite/go.mod
: github.com/gethinode/mod-flexsearch v1.3.0 // indirect
go.mod
: github.com/gethinode/mod-flexsearch v1.2.0 // indirect
In this context, it appears that hugo mod get -u
works, but adding the recursive flag ./...
breaks it. I've created a repository branch to demonstrate the issue - hope it helps in tracking down the issue.
hugo v0.117.0-b2f0696cad918fb61420a6aff173eb36662b406e+extended darwin/arm64 BuildDate=2023-08-07T12:49:48Z VendorInfo=brew
First scenario
git clone https://github.com/gethinode/hinode.git hinode-scenario1 -b hugo-issue-10719 && cd hinode-scenario1
hugo mod get -u ./...
# Update module in [...]/hinode-scenario1/exampleSite
# hugo: downloading modules …
# hugo: collected modules in 2235 ms
hugo mod get github.com/gethinode/mod-flexsearch
# go: upgraded github.com/gethinode/mod-flexsearch v1.2.0 => v1.3.0
cd ..
Second scenario
git clone https://github.com/gethinode/hinode.git hinode-scenario2 -b hugo-issue-10719 && cd hinode-scenario2
hugo mod get -u
# go: upgraded github.com/gethinode/mod-flexsearch v1.2.0 => v1.3.0
@razonyang Was this resolved with https://github.com/gohugoio/hugo/pull/11573?
@jmooring thanks for reminding, I forgot this issue.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
Log
Reproduce Steps
I'm not sure if it's my environment issue.