late-keyboard-89314
12/09/2022, 11:00 PMpants tailor ::
to generate my build files. But now, no matter what target I do such as pants check
or pants list
, I get a crash with the following:
15:53:39.68 [ERROR] 1 Exception encountered:
IncompleteJSONError: parse error: trailing garbage
mod", "GoVersion": "1.19" } { "Path": "<http://cloud.google.com/go|cloud.google.com/go>
(right here) ------^
happy-kitchen-89482
12/09/2022, 11:57 PM-ldebug
and --print-exception-stacktrace
so we can see more error context?late-keyboard-89314
12/10/2022, 1:05 AMijson
isn’t happy about it?late-keyboard-89314
12/10/2022, 1:06 AMpants.backend.experimental.go
as my only backend, as well.happy-kitchen-89482
12/10/2022, 1:42 AMgo list -json
returns multiple concatenated JSON objects, and we're not handling it well in some caseshappy-kitchen-89482
12/10/2022, 1:42 AMhappy-kitchen-89482
12/10/2022, 1:44 AMhappy-kitchen-89482
12/10/2022, 1:44 AMmultiple_values=True
in ijsonhappy-kitchen-89482
12/10/2022, 1:45 AMlate-keyboard-89314
12/10/2022, 3:22 AMhappy-kitchen-89482
12/10/2022, 7:20 AMhappy-kitchen-89482
12/10/2022, 7:21 AMhappy-kitchen-89482
12/10/2022, 7:21 AMfast-nail-55400
12/10/2022, 12:09 PMfast-nail-55400
12/10/2022, 12:09 PMfast-nail-55400
12/10/2022, 12:11 PMBased on some googling of the error, it looks like maybe there’s more than one top-level JSON object andisn’t happy about it?ijson
ijson
can handle multiple top-level objects just fine, that is why we use it since Pants knows the output has multiple top-level objects. The issue could be that the break between top-level objects is happening on the same line versus having an intervening newline between the } {
bitfast-nail-55400
12/10/2022, 12:11 PMfast-nail-55400
12/10/2022, 12:42 PMijson
handles newlines just fine:
% ./pex ijson==3.1.4
Python 3.10.7 (main, Oct 30 2022, 11:30:35) [Clang 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> with_newline = "{}\n{}"
>>> without_newline = "{}{}"
>>> import ijson
>>> list(ijson.items(with_newline, "", multiple_values=True))
[{}, {}]
>>> list(ijson.items(without_newline, "", multiple_values=True))
[{}, {}]
>>>
fast-nail-55400
12/10/2022, 12:43 PMfast-nail-55400
12/10/2022, 12:46 PMfast-nail-55400
12/10/2022, 1:33 PMfast-nail-55400
12/10/2022, 2:17 PMgo.mod
? If it can't be made public on an issue, feel free to share via DM.late-keyboard-89314
12/12/2022, 3:28 PMlate-keyboard-89314
12/12/2022, 3:28 PMgo.mod
is linked there in a gistlate-keyboard-89314
12/12/2022, 5:44 PMgo list
, it doesn’t make it through even one iteration. I’ve got another gist of the formatted output (generated by just writing what pants.backend.go.util_rules.third_party_pkg.analyze_module_dependencies
gets to a file after UTF-8 decoding. Here’s the gist (updated the issue as well): https://gist.github.com/jcrumb-u21/9c4f36108689722921dfd179e2013bd8