Skip to content

Commit

Permalink
Don't treat debug messages as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawka committed Jun 12, 2023
1 parent 90a35cf commit dba56c2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion testjson/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ func readStderr(config ScanConfig, execution *Execution) error {
if err := config.Handler.Err(line); err != nil {
return fmt.Errorf("failed to handle stderr: %v", err)
}
if isGoModuleOutput(line) {
if isGoModuleOutput(line) || isGoDebugOutput(line) {
continue
}
if strings.HasPrefix(line, "warning:") {
Expand Down Expand Up @@ -765,6 +765,20 @@ func isGoModuleOutput(scannerText string) bool {
return false
}

func isGoDebugOutput(scannerText string) bool {
prefixes := []string{
"HASH", // Printed when tests are running with `GODEBUG=gocachehash=1`.
"testcache:", // Printed when tests are running with `GODEBUG=gocachetest=1`.
}

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 dba56c2

Please sign in to comment.