---
title: Go Integration with Mergify
description: Report your test results from Go tests to Mergify
---

<IntegrationLogo src={golangLogo} alt="Golang logo" />

This guide shows how to generate JUnit reports from your Go tests and upload
them to **Test Insights** using your CI workflow.

## Generate a JUnit Report with Go Tests

By default, `go test` does not output JUnit-format reports. To generate one,
pipe the verbose test output into a tool like
[go-junit-report](https://github.com/jstemmer/go-junit-report) or use
[gotestsum](https://github.com/gotestyourself/gotestsum).

### Using go-junit-report

```bash
go test -v ./... 2>&1 | go-junit-report > junit.xml
```

### Using gotestsum

```bash
gotestsum --junitfile junit.xml
```

## Update Your CI Workflow

### GitHub Actions

<CIInsightsSetupNote />

After generating the JUnit report, add a step to upload the results to Test
Insights using the `mergifyio/gha-mergify-ci` action.

For example, in your workflow file:

```yaml
- name: Run Go Tests and Generate JUnit Report
  id: tests
  continue-on-error: true
  run: go test -v ./... 2>&1 | go-junit-report > junit.xml
```

<MergifyCIUploadStep reportPath="junit.xml" />
<MergifyCIUploadStepMatrix reportPath="junit.xml" />

<GhaMergifyCiQuarantineSetup />

### Buildkite

<BuildkiteCIUploadStep reportPath="junit.xml" />
<BuildkiteCIUploadStepMatrix reportPath="junit.xml" />

<BuildkiteCIQuarantineSetup />

### Any CI (Mergify CLI)

<MergifyCliUploadStep reportPath="junit.xml" testCommand="go test -v ./... 2>&1 | go-junit-report > junit.xml" />

## Verify and Review in Test Insights

After pushing these changes:

1. Your GitHub Actions workflow will execute your Go tests.
2. A JUnit report (junit.xml) is generated.
3. The Mergify CI action uploads the report to Test Insights.

<ReviewInTestInsights />

## Troubleshooting Tips

<ul>
  <CommonTroubleshootingTips />
</ul>
