-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hugo mod removes non-Hugo modules from go.mod #6115
Comments
Not that I know of, but I would be happy to be proven wrong. I would say that I cannot currently fix your problem, but I will think about it. |
OK , thinking a little I think I know what we can do. I have implemented my own "tidy logic" because Go does not understand Hugo's imports. We can adjust that so:
|
Sounds like a reasonable workaround. Shame Hugo can't use a different file. |
Or Mage. I have double-checked the Go source, and I will take another round on this and check what Go does with these files on regular use, but I suspect that it will be a variant of the above and that with your setup you cannot use "go mod tidy" as that will wipe out the non-Go entries. |
It's not Mage. It's
That certainly is very hardcoded. Oh well…
I'm not currently using Hugo modules. But it appears that the presence of a Also, wouldn't |
If this isn't getting added any time soon, could you make Hugo behave the same as Currently, it clears out |
Just run into this as well. I'm not quite sure how Hugo modules are implemented, but I suspect they should be using an approach similar to the way in which tool dependencies are declared? https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md i.e. the dependencies need to be declared in Go code if |
Which is exactly what Hugo does (if you replace "Go code" with "Hugo source"), which is also where the problem lies. |
I have "turned off" the tidy during regular builds. WIll be in Hugo 0.57.1. You will still see this problem if you do |
Just wanted to make sure we're talking about the same thing here: for So if you have dependencies declared in "Hugo source" then you will likely need to code generate a build-ignored // +build ignore
package hugodeps
import (
_ "example.com/hugo/dep"
) |
We're obviously not. This is not about |
I use mage to manage my sites (download data, publish via
rsync
, runpngquant
on resized images…), andgo mod
adds mage's dependencies togo.mod
.Hugo removes them every time I run it.
How do I get Hugo modules to play nice with regular Go modules? Is there an option to make it write its dependencies to, say,
hugo.mod
instead of thego.mod
file?The text was updated successfully, but these errors were encountered: