-
Notifications
You must be signed in to change notification settings - Fork 18k
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: list -json outputs concatenated JSON documents, not one single one #21280
Comments
We can document this for Go 1.10 but I don't think we should change it. That would unnecessarily break existing tools consuming this. For instance, encoding/json.Decoder will consume multiple concatenated JSON objects. |
Another way of describing "multiple concatenated JSON documents" is a that it's a JSON stream of objects. They are easy to parse. |
I was not aware of this -- there isn't really an issue, then, if it's simple to decode into |
@stevekuznetsov, see https://godoc.org/encoding/json#example-Decoder for an example. |
Right on, using that |
@stevekuznetsov There is github.com/kisielk/gotool which contains an exported copy of the Go tool's resolution of package paths ( |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
I ran
go list -json
on a project with multiple packages.What did you expect to see?
A JSON list:
What did you see instead?
Concatenated JSON documents:
The text was updated successfully, but these errors were encountered: