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
cmd/go: accept a directory path to 'go mod edit' instead of just a file path #30173
Comments
Honestly, I'm a bit surprised that |
What is the impact of this? Can you give some examples of use-cases where needing to change directories to run |
Well basically that’s the difference between being able to use When you have a large existing |
I still don't understand the use-case. You can run something like If you want to actually examine the dependencies of your modules, the |
On my use case we only need the direct dependencies, and definitely do not want any magic call to the internet that makes the result depend on variable internet state, so As for find, yes that's another thing that would need adding in a shell wrapper. You can fix lots of things in shell or python wrappers, but it's much nicer when tools do the right natural thing without needing a wrapper. |
|
No one is asking you to add any feature, just to make existing functionality work without awkwardness. And the whole point of go mod edit is to help integrate go in third party workflows, if you didn't want this integration to happen why did you release go mod edit in the first place? |
The existing functionality is to accept a path to the |
go version go1.11 linux/amd64
go mod directory handling is a bit inconsistent
it will automatically drill down to the
go.mod
file even if you are several directory layers over it.go mod edit -fmt -json
will output the same info regardless of where you are within the modulebut, if you try to ask it the module info for a directory you're not in, it becomes dumb.
go mod edit -fmt -json dirpath
does not work you need to provide an exact go.mod pathgo mod edit -fmt -json dirpath/go.mod
It would be much nicer to have go mod behave the same, regardless of the implicit (you are inside the module) or explicit nature of the path in works on.
And I suppose there is some value in knowing you're at the exact module root or not, but should not this be handled by a --root flag that makes the command fail if the provided directory (implicit or explicit) is not the module root?
The text was updated successfully, but these errors were encountered: