cmd/go: go test -json has inconsistent Time precision #44588
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes (go1.16)
What did you do?
Ran
go test -json
on a package, and attempted to sort the resulting JSON via jq using thePackage
andTime
fields.What did you expect to see?
I expected jq to sort the results correctly.
What did you see instead?
I noticed that the decimal precision of the
Time
field is inconsistent. My guess is that it is chopping off trailing zeros. However, this means that the resulting timestamps cannot be sorted properly. For example, we might get the following two entries:Since 'Z' > '1', this causes the "PASS" line to get sorted before the "RUN" line. This is especially a problem when dealing with older (< 1.6) versions of jq that do not perform a stable sort.
The text was updated successfully, but these errors were encountered: