Skip to content
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

Command "hugo mod get -u" does not accept global --source flag #12539

Open
fmunteanu opened this issue May 25, 2024 · 3 comments
Open

Command "hugo mod get -u" does not accept global --source flag #12539

fmunteanu opened this issue May 25, 2024 · 3 comments
Labels
Milestone

Comments

@fmunteanu
Copy link

fmunteanu commented May 25, 2024

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.126.1+extended darwin/arm64 BuildDate=2024-05-15T10:42:34Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes.

Issue

Running the Hugo module update does not accept the global --source flag:

$ hugo mod get -s ./docs -u
flag provided but not defined: -s
usage: go get [-t] [-u] [-v] [build flags] [packages]
Run 'go help get' for details.
Error: failed to get ["-d" "-s" "./docs" "-u"]: failed to execute 'go [get -d -s ./docs -u]': failed to execute binary "go" with args [get -d -s ./docs -u]: flag provided but not defined: -s
usage: go get [-t] [-u] [-v] [build flags] [packages]
Run 'go help get' for details.
 *errors.errorString

$ hugo mod get --source ./docs -u
flag provided but not defined: -source
usage: go get [-t] [-u] [-v] [build flags] [packages]
Run 'go help get' for details.
Error: failed to get ["-d" "--source" "./docs" "-u"]: failed to execute 'go [get -d --source ./docs -u]': failed to execute binary "go" with args [get -d --source ./docs -u]: flag provided but not defined: -source
usage: go get [-t] [-u] [-v] [build flags] [packages]
Run 'go help get' for details.
 *errors.errorString

I'm wondering if this is the expected behaviour, since the help clearly states I can use that flag:

Usage:
  hugo mod get [flags] [args]

Flags:
  -h, --help   help for get

Global Flags:
      --clock string               set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
      --config string              config file (default is hugo.yaml|json|toml)
      --configDir string           config dir (default "config")
      --debug                      debug output
  -d, --destination string         filesystem path to write files to
  -e, --environment string         build environment
      --ignoreVendorPaths string   ignores any _vendor for module paths matching the given Glob pattern
      --logLevel string            log level (debug|info|warn|error)
      --quiet                      build in quiet mode
      --renderToMemory             render to memory (mostly useful when running the server)
  -s, --source string              filesystem path to read files relative from
      --themesDir string           filesystem path to themes directory
  -v, --verbose                    verbose output

The recursive update works as intended:

$ hugo mod get -u ./...
Update module in /Users/floren/github/website/docs
Update module in /Users/floren/github/website/global

There are no issues running hugo mod tidy -s ./docs, for example.

@jmooring
Copy link
Member

This has come up before but we didn't log an issue:

https://discourse.gohugo.io/t/quiet-down-hugo-mod-get/47747/2

@bep bep removed the NeedsTriage label May 30, 2024
@bep bep added this to the v0.127.0 milestone May 30, 2024
@bep
Copy link
Member

bep commented May 30, 2024

I'm wondering if this is the expected behaviour, since the help clearly states I can use that flag:

No, but the hugo mod get command is a little special. We have a few tools that depends on external programs (e.g. go) that currently doesn't work well with the --source flag. I have never used the --source flag myself, so it's not on my "top 10" list of things to fix.

@bep
Copy link
Member

bep commented May 30, 2024

I did a quick check now, and we do set the Cmd.Dir to the value of --source when running the go commands via os/exec, so this should work if we fixed the flag handling.

@bep bep modified the milestones: v0.127.0, v0.128.0 Jun 8, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
@bep bep modified the milestones: v0.129.0, v0.131.0 Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants