Hi, I use Hugo module to install theme, but every time I execute hugo mod get
, it’s always slow. How can I diagnose it?
Thanks.
Hi, I use Hugo module to install theme, but every time I execute hugo mod get
, it’s always slow. How can I diagnose it?
Thanks.
I would guess that slow means that it does not use the cache for some reason.
What I would recommend you do as a start is to set the HUGO_CACHEDIR
env var to some directory that you know exist and is writable. If you then run Hugo you should see files pulled into HUGO_CACHEDIR/modules
.
Thank you. I found that upgrade module via hugo mod get
always fail, but it’s weird that go get
works fine.
$ HUGO_CACHEDIR=$PWD/vendor hugo mod get github.com/razonyang/hugo-theme-bootstrap@master
hugo: downloading modules …
go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git ls-remote -q origin in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': Error in the HTTP2 framing layer
hugo: collected modules in 138063 ms
WARN 2022/07/09 16:15:41 failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git ls-remote -q origin in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': Error in the HTTP2 framing layer
*errors.errorString
$ GOPROXY=https://goproxy.cn HUGO_CACHEDIR=$PWD/vendor hugo mod get github.com/razonyang/hugo-theme-bootstrap@master
hugo: downloading modules …
go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
hugo: collected modules in 1140149 ms
WARN 2022/07/09 16:43:05 failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
*errors.errorString
go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Error: failed to get ["-d" "github.com/razonyang/hugo-theme-bootstrap@master"]: failed to execute 'go [get -d github.com/razonyang/hugo-theme-bootstrap@master]': failed to execute binary "go" with args [get -d github.com/razonyang/hugo-theme-bootstrap@master]: go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
*errors.errorString
$ GOPROXY=https://goproxy.cn go get -d github.com/razonyang/hugo-theme-bootstrap@master
go: downloading github.com/razonyang/hugo-theme-bootstrap v1.0.0-alpha.1.0.20220709075819-a5c93d6e6a09
go: upgraded github.com/razonyang/hugo-theme-bootstrap v1.0.0-alpha.1.0.20220708160018-560a68166b0a => v1.0.0-alpha.1.0.20220709075819-a5c93d6e6a09
The previous commands hang for more than 5 minutes and fail, but go get
executed within 10 seconds.
It’s hard to debug this looking at logs only, but I can give you one tip:
Hugo does not respect the GOPROXY
env var (for good reasons). If you want to use a Go proxy server, set the module.proxy config (or via HUGO_MODULE_PROXY
).
Thanks a lot . Replace GOPROXY
with HUGO_MODULE_PROXY
works as expected.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.