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

import golangLogo from "../../../images/ci-insights/golang/logo.svg"
import CommonTroubleshootingTips from "./_common-troubleshooting-tips.mdx"
import GhaMergifyCiQuarantineSetup from "./_gha_mergify_ci_quarantine_setup.mdx"
import IntegrationLogo from "../../../../components/IntegrationLogo.astro"
import MergifyCIUploadStep from "../../../../components/MergifyCIUploadStep.astro"
import CIInsightsSetupNote from "../../../../components/CIInsightsSetupNote.astro"
import MergifyCIUploadStepMatrix from "../../../../components/MergifyCIUploadStepMatrix.astro"

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

This guide shows how to generate JUnit reports from your Go tests and upload
them to **CI Insights** using a GitHub Actions 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 GitHub Actions Workflow

<CIInsightsSetupNote />

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

For example, in your workflow file:

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

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

<GhaMergifyCiQuarantineSetup />

## Verify and Review in CI 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 CI Insights.

You can then review your test results, including any failures or flaky tests,
directly in the [CI Insights
dashboard](https://dashboard.mergify.com/ci-insights/jobs).

## Troubleshooting Tips

<ul>
  <CommonTroubleshootingTips />
</ul>
