Hugo mod init 命令不创建 mod 文件

Hugo mod init command does not create mod file

我刚刚在 Ubuntu 18.04 上通过 snap 安装了 hugo v0.62.2/extended。我安装了 Go 1.13.5。在我的项目目录中 运行:

hugo mod init

未生成 go.mod 文件。详细命令的输出如下:

INFO 2020/01/18 20:41:23 No translation bundle found for default language "en" INFO 2020/01/18 20:41:23 Translation func for language en not found, use default. INFO 2020/01/18 20:41:23 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language. INFO 2020/01/18 20:41:23 Using config file:

如何生成 go.mod 文件或找出未生成文件的原因?

hugo mod init 应该猜测模块路径,但如果您显式传递它会更容易。

参见“Hugo modules" from by Jon Arne Viksås

hugo mod init test-dummy

YES IT WAS test-dummy.
I think it’s more appropriate to name the module as your Hugo site name.

The command could output something like this:

go: creating new go.mod: module test-dummy information: a new file go.mod was created

我在 commands/mod.go 中没有看到任何最近的变化。

通过软件中心安装 hugo 时似乎有问题。这就是我安装它的方式。我卸载了它,然后在我的 /usr/local/bin 文件夹中安装了 linux binary release,现在 hugo mod init 确实生成了 go.mod 文件