Update GoTool for new tool support and better parsing.

Review Request #11570 — Created April 2, 2021 and updated

chipx86
ReviewBot
release-3.0.x
reviewbot

This updates GoTool to subclass the newer BaseTool, and to use the
newer features it offers (dependencies, improved file extension
handling, new mixin for full-repository support).

It also fixes a number of issues that could arise with parsing the
output from both go test and go vet. The original implementation
requested JSON payloads from both, but go vet's JSON payloads are not
guaranteed. Parser/compiler errors would result in standard errors, not
JSON payloads, causing our parsing to break.

The new implementation just parses the standard error output,
simplifying the code considerably. That will catch both forms of results

The go test parsing has been improved as well. We no longer make
assumptions that all lines of code can be joined into a single JSON
array, instead parsing each line individually. We combine results
indicating failed test runs along with results showing test output into
a single representation, and build comments from that (helping
developers see why tests failed). We also provide general comments if
we fail to find any useful results but do find errors, showing the
output that occurred.

Unit tests pass on Python 2.7 and 3.x.

Summary
Update GoTool for new tool support and better parsing.
Description From Last Updated

E501 line too long (80 > 79 characters)

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
  1. Ship It!
  2. 
      
Loading...