Description
hugo mod tidy panics with an index-out-of-range error when go.mod contains a tool block (introduced in Go 1.24).
Hugo Version
Tested on v0.156.0 and v0.160.1. Also confirmed the bug exists on current master by reading the source.
Go Version
go version go1.26.0 darwin/arm64
To Reproduce
- Create a Hugo module project with a go.mod that includes a
tool block:
module example.com/mysite
go 1.26.0
require (
github.com/imfing/hextra v0.12.1 // indirect
)
tool (
github.com/gohugoio/hugo
)
- Run
hugo mod tidy
Expected Behaviour
hugo mod tidy completes successfully, ignoring the tool block.
Actual Behaviour
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
github.com/gohugoio/hugo/modules.(*Client).rewriteGoModRewrite(...)
modules/client.go:728 +0x428
Does this issue reproduce with the latest release?
Yes
Description
hugo mod tidy panics with an index-out-of-range error when go.mod contains a tool block (introduced in Go 1.24).
Hugo Version
Tested on v0.156.0 and v0.160.1. Also confirmed the bug exists on current master by reading the source.
Go Version
go version go1.26.0 darwin/arm64
To Reproduce
toolblock:hugo mod tidyExpected Behaviour
hugo mod tidycompletes successfully, ignoring the tool block.Actual Behaviour
Does this issue reproduce with the latest release?
Yes