Skip to content

Commit

Permalink
bugfix - ignore go module stdErr messages
Browse files Browse the repository at this point in the history
ignore if prefix is 'go: downloading' or 'go: extracting'
  • Loading branch information
jonasdebeukelaer authored and dnephin committed Nov 3, 2018
1 parent fc6f8e9 commit 625b21f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions testjson/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ func readStderr(in io.Reader, handle errHandler, exec *Execution) chan error {
defer close(wait)
scanner := bufio.NewScanner(in)
for scanner.Scan() {
// TODO: remove this check if go module events stop being output as stdErr
if checkIsGoModuleEvent(scanner.Text()) {
continue
}

exec.addError(scanner.Text())
if err := handle(scanner.Text()); err != nil {
wait <- err
Expand All @@ -328,6 +333,17 @@ func readStderr(in io.Reader, handle errHandler, exec *Execution) chan error {
return wait
}

func checkIsGoModuleEvent(scannerText string) bool {
prefixes := [2]string{"go: extracting", "go: downloading"}

for _, prefix := range prefixes {
if strings.HasPrefix(scannerText, prefix) {
return true
}
}
return false
}

func parseEvent(raw []byte) (TestEvent, error) {
// TODO: this seems to be a bug in the `go test -json` output
if bytes.HasPrefix(raw, []byte("FAIL")) {
Expand Down

0 comments on commit 625b21f

Please sign in to comment.