Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't treat debug messages as errors #336

Merged
merged 2 commits into from Jul 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion testjson/execution.go
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