Closed espadrine closed 5 years ago
I suggest you move your site into its own root.
It does look pretty heavily hardcoded. IIUC it would be subtle to detect whether the go.mod
is a Hugo module or something else. Oh well.
Thanks for your work on Hugo! You may close this issue if you believe it would be impossible to fix.
You may close this issue if you believe it would be impossible to fix.
I didn't say that, I just gave you a tip for a workaround.
What we cannot currently do is change it to hugo.mod
or something (that would be nice, but go.mod
is hardcoded in 123 different places in the Go source).
What we could probably do is to improve the "is this a Hugo Module" logic.
Currently, it is simply: Is there a go.mod
file in the project.
We could probably change that to "go.mod + any module imports (e.g. theme imports with module paths)".
Nicely done! Thanks a lot!
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.
Reproduction
hugo server
does serve the website.touch go.mod
hugo server
Expected behavior
Hugo serves the website still.
Actual behavior
Hugo fails to serve the website with the following error:
(More commonly, the
go.mod
will not actually be empty; the render may then fail with the messagego: error loading module requirements
for instance, which feels like it ought to be decoupled.)Use case
We have a project where we maintain the documentation alongside the code. Had we developed the project in any other language than Go, we would have had no issue. But the project is in Go, and therefore we now started to work on supporting Go modules, which required having a
go.mod
. Old versions of Hugo worked fine (such as v0.54.0), but new versions don't.References
Hugo Static Site Generator v0.57.2/extended darwin/amd64 BuildDate: unknown