hugo: Concrete go + hugo modules conflict proposal: Add modfile property also for hugo
I’m happy to try to work on this as a PR, but want first your opinion, especially @bep.
As stated in #6115 both go and hugo think they’re the owner of the go.mod file. As commented in https://github.com/gohugoio/hugo/issues/6115#issuecomment-521823167, one using hugo should follow its spec (This is not the place to discuss this decision). Learned how hugo mod works and knowing how go mod works, this issue is very possibly solvable.
Since go1.14 they added the -modfile
property allowing you to decide which go.mod file to use. How about hugo modules config get a property with the exact same meaning and propagates that to go commands and further hugo module specific functions?
# config.yaml
# ...
module:
modfile: hugo.mod # default: go.mod
Result: The developer can opt in to use a separate go mod file for hugo and thus keeping the default go.mod for his other purpose.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 21 (10 by maintainers)
I am not sure, but according to the release notes linked in https://github.com/gohugoio/hugo/issues/6115#issuecomment-571426244 it sounds to be their aim
That explains why there are still (some) hard go.mod strings. Unsure about vendoring but in a quick glance hugo has also the custom _vendor folder (but don’t know full context yet). Also that option should only be used if such “main” go.mod exists.
I’ll have a check in the coming days and crosscheck with the mod client in hugo. But it sounds like if there is a way it’s worth a try. And if we/I find a need for something, we can voice our use case in the upstream issue.