Replace in go.mod works but HUGO_MODULE_REPLACEMENTS env var doesn't work

I use it every day, so I’m sure it works, but I guess there are some caveats worth knowing:

  • Using HUGO_MODULE_REPLACEMENTS is the same as manually editing the path in your module config in config.toml – which is not the same as a replacement inside go.mod
  • I suspect your problem is a path confusion issue, as relative paths resolves relative to themeDir – I notice in one shell script I use for this purpose is that I use absolute paths on the right side of the fence, which I suspect is easier to reason about.
  • Go 1.18 (soon to be released) comes with a concept of workspaces (go.workspace files), which should make (cross fingers!) this situation much cleaner/better. That would be files that you would (normally) put in .gitignore.
2 Likes