Help us shape the future of Go! Take the 2026 Go Developer Survey

gocov

module
v0.27.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0

README

gocov

coverage

Diff coverage, pull request comments and merge gates for GitHub, GitLab and Bitbucket Cloud — an open-source Coveralls/Codecov alternative. Use the hosted service at gocov.dev (public repos free forever, badge included), or self-host the same product: one Go binary plus Postgres.

Coverage on your pull requests in three steps

  1. Sign in at app.gocov.dev and pick the workspace gocov should track.
  2. Connect it to your forge — one click; on GitHub it is the same App install.
  3. Add one step after your tests, no secret needed (GitHub Actions shown):
permissions:
  id-token: write                 # the job proves its identity; nothing to paste
steps:
  - run: npx jest --coverage      # or go test -coverprofile, mvn verify, pytest --cov, ...
  - uses: gocov/gocov-action@v1
    with:
      files: coverage/lcov.info

The job's short-lived identity token replaces the upload secret; a GOCOV_TOKEN secret still works where a CI cannot mint one. The action downloads the CLI binary and checks its sha256, so there is no toolchain to install — the same lines work whatever your tests are written in; point files at whatever your test runner produced. Recipes for the rest: GitLab CI · Bitbucket Pipelines · any other CI · languages & formats

From then on every push carries its own coverage: a status and delta on the commit, a diff-coverage comment on the pull request, a gate that can block the merge, and a badge that is one line of markdown:

[![coverage](https://app.gocov.dev/badge/github/myworkspace/myrepo.svg)](https://app.gocov.dev/repos/github/myworkspace/myrepo?ref=badge)

What you get

  • Pull request surfaces: build statuses, PR/MR comments with diff coverage, GitHub check runs and Bitbucket Code Insights report cards with inline annotations on uncovered changed lines — see the tour
  • Coverage gate: per-repo minimums for total and diff coverage plus a drop tolerance; a failed gate pushes a FAILED status your forge's merge checks can block on
  • Any language: Go cover profiles, LCOV (Jest, Vitest, nyc, c8), JaCoCo XML (Maven, Gradle, Android), Cobertura XML (coverage.py/pytest-cov, coverlet, gcovr), Clover XML (PHPUnit, Istanbul) and SimpleCov resultsets (Ruby) — detected from the uploaded content, no flag needed
  • Web UI: repo list, per-file coverage, line-by-line source view with hit counts, coverage trend chart, SVG badge per repo, sign-in with your forge account — a React single-page app compiled at build time and embedded in the server binary, so running gocov is still one binary and Postgres

Self-hosting

The same product on your infrastructure, AGPL-3.0, no telemetry and no call home:

docker compose up

This starts Postgres and the server on http://localhost:8080 (migrations apply automatically). Then enable sign-in with your forge, sign in — the first screen registers your workspace and mints its upload token — and set GOCOV_TOKEN and GOCOV_SERVER in CI.

For a real instance, every release publishes ghcr.io/gocov/gocov-server for amd64 and arm64, and deploy/ has the production compose file: the pinned image behind Caddy (TLS included), Postgres external or bundled, one .env to fill in. The operator's guide — the secret key, your own GitHub App, backups, upgrades — is Self-hosting.

Documentation

The full documentation is at docs.gocov.dev, built from docs/ in this repository:

License

AGPL-3.0 — see LICENSE.

Directories

Path Synopsis
cmd
gocov command
gocov is the coverage uploader CLI, run inside CI:
gocov is the coverage uploader CLI, run inside CI:
gocov-preview command
Command gocov-preview is the web UI's development backend: it serves the UI and its JSON API from an in-memory store seeded with a synthetic upload history, so UI work needs neither Postgres nor OAuth.
Command gocov-preview is the web UI's development backend: it serves the UI and its JSON API from an in-memory store seeded with a synthetic upload history, so UI work needs neither Postgres nor OAuth.
gocov-server command
gocov-server runs the gocov API + web UI:
gocov-server runs the gocov API + web UI:
internal
auth
Package auth defines the sign-in provider seam for the web UI.
Package auth defines the sign-in provider seam for the web UI.
auth/bitbucket
Package bitbucket implements auth.Provider for Bitbucket Cloud using only the standard library.
Package bitbucket implements auth.Provider for Bitbucket Cloud using only the standard library.
auth/github
Package github implements auth.Provider for GitHub (cloud github.com) using only the standard library.
Package github implements auth.Provider for GitHub (cloud github.com) using only the standard library.
auth/gitlab
Package gitlab implements auth.Provider for GitLab (gitlab.com) using only the standard library.
Package gitlab implements auth.Provider for GitLab (gitlab.com) using only the standard library.
blobstore
Package blobstore abstracts raw-profile persistence so it can later move to object storage (S3/R2) without touching callers.
Package blobstore abstracts raw-profile persistence so it can later move to object storage (S3/R2) without touching callers.
blobstore/memory
Package memory provides an in-memory blobstore.Store for tests and the gocov-preview harness.
Package memory provides an in-memory blobstore.Store for tests and the gocov-preview harness.
blobstore/postgres
Package postgres implements blobstore.Store on a Postgres bytea column.
Package postgres implements blobstore.Store on a Postgres bytea column.
config
Package config declares every environment variable the gocov binaries read.
Package config declares every environment variable the gocov binaries read.
core
Package core is gocov's coverage logic, with no HTTP in it.
Package core is gocov's coverage logic, with no HTTP in it.
diffcov
Package diffcov computes diff coverage: which changed lines of a pull request are covered by tests.
Package diffcov computes diff coverage: which changed lines of a pull request are covered by tests.
forge
Package forge abstracts VCS-host integrations: Bitbucket, GitHub and GitLab each implement Forge in their own subpackage.
Package forge abstracts VCS-host integrations: Bitbucket, GitHub and GitLab each implement Forge in their own subpackage.
forge/bitbucket
Package bitbucket implements forge.Forge for Bitbucket Cloud.
Package bitbucket implements forge.Forge for Bitbucket Cloud.
forge/fake
Package fake provides a recording forge.Forge test double.
Package fake provides a recording forge.Forge test double.
forge/github
Package github implements forge.Forge for GitHub (cloud github.com).
Package github implements forge.Forge for GitHub (cloud github.com).
forge/gitlab
Package gitlab implements forge.Forge for GitLab (gitlab.com; a self-managed instance works through BaseURL but is not yet officially supported).
Package gitlab implements forge.Forge for GitLab (gitlab.com; a self-managed instance works through BaseURL but is not yet officially supported).
hosted
Package hosted holds shared constants for the hosted gocov service, so the CLI's default server and the onboarding page's "server is implicit" check stay in sync from a single source of truth.
Package hosted holds shared constants for the hosted gocov service, so the CLI's default server and the onboarding page's "server is implicit" check stay in sync from a single source of truth.
ignore
Package ignore matches coverage-report paths against the glob patterns a repo (or one upload) asks to leave out of its coverage: generated code, mocks, a dev harness under cmd/.
Package ignore matches coverage-report paths against the glob patterns a repo (or one upload) asks to leave out of its coverage: generated code, mocks, a dev harness under cmd/.
oidc
Package oidc verifies the OIDC identity tokens a CI runner mints for itself, so an upload can prove which repository it came from without a pasted secret.
Package oidc verifies the OIDC identity tokens a CI runner mints for itself, so an upload can prove which repository it came from without a pasted secret.
profile
Package profile defines the normalized coverage model shared by every coverage format, and the Parser interface that format-specific parsers implement.
Package profile defines the normalized coverage model shared by every coverage format, and the Parser interface that format-specific parsers implement.
rest
Package rest is the request plumbing the forge clients and the sign-in providers share: one place that builds a call, authorizes it, bounds what it reads back and turns a refused answer into an error every forge shapes the same way.
Package rest is the request plumbing the forge clients and the sign-in providers share: one place that builds a call, authorizes it, bounds what it reads back and turns a refused answer into an error every forge shapes the same way.
secretbox
Package secretbox seals short secrets for at-rest storage with AES-256-GCM (One-Click Connect).
Package secretbox seals short secrets for at-rest storage with AES-256-GCM (One-Click Connect).
server
Tokenless OIDC uploads: authenticating an upload that carries no bearer token and no fork-PR run claim, but a forge-minted OIDC identity token.
Tokenless OIDC uploads: authenticating an upload that carries no bearer token and no fork-PR run claim, but a forge-minted OIDC identity token.
store
Package store defines the storage interface and its domain types.
Package store defines the storage interface and its domain types.
store/memory
Package memory provides an in-memory store.Store for tests and the gocov-preview harness.
Package memory provides an in-memory store.Store for tests and the gocov-preview harness.
store/postgres
Package postgres implements store.Store on PostgreSQL via pgx.
Package postgres implements store.Store on PostgreSQL via pgx.
store/storetest
Package storetest is the contract suite every store.Store implementation runs: the same scenarios against postgres (production) and memory (the test double the handler tests stand on), so the two cannot drift apart unnoticed.
Package storetest is the contract suite every store.Store implementation runs: the same scenarios against postgres (production) and memory (the test double the handler tests stand on), so the two cannot drift apart unnoticed.
testpg
Package testpg provides disposable Postgres databases for integration tests.
Package testpg provides disposable Postgres databases for integration tests.
webui
Package webui embeds the built single-page web UI.
Package webui embeds the built single-page web UI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL