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

cmd/go: go list needs a -fmt -json mode like go mod edit #30503

Closed
nim-nim opened this issue Mar 1, 2019 · 2 comments
Closed

cmd/go: go list needs a -fmt -json mode like go mod edit #30503

nim-nim opened this issue Mar 1, 2019 · 2 comments

Comments

@nim-nim
Copy link

nim-nim commented Mar 1, 2019

$ go version
go version go1.12 linux/amd64
$ go list -json ./...
go: finding github.com/…

	fatal: unable to access 'https://github.com/…': Could not resolve host: github.com

→ No useful output. I don’t care if some json fields would be better populated with network access, just because you ask json output does not mean you will use every single json field.

Ironically, go mod edit does not have this module-induced problem

$ go mod edit -fmt -json go.mod

→ just works.

Lastly:

$ GO111MODULE=off go list -json ./...

→ works but GO111MODULE is going away and in off mode go list does not list the go.mod files that could be fed to go mod edit -fmt -json for parsing

go list -json needs a pure passive mode that does not change files on disk or attempts to download other things, similar to go mode edit -json -fmt

@ianlancetaylor ianlancetaylor changed the title go list needs a -fmt -json mode like go mod edit cmd/go: go list needs a -fmt -json mode like go mod edit Mar 1, 2019
@bcmills
Copy link
Contributor

bcmills commented Mar 1, 2019

-fmt is the wrong name for the flag, since it's not actually formatting anything.

Beyond that, I think this is a dup of #29452.

@bcmills bcmills closed this as completed Mar 1, 2019
@nim-nim
Copy link
Author

nim-nim commented Mar 4, 2019

-fmt is the wrong name for go mod edit too, it's not really a formatting option, it's a “passive static read only mode no update no internet access no clever anything, just read existing available files as they are without changing them or completing them or whatever and report”

@golang golang locked and limited conversation to collaborators Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants