uber-go/mock

GoMock is a mocking framework for the Go programming language.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 21 minutes ago
Added to GitGenius on September 20th, 2026
Created on May 3rd, 2023
Open Issues & Pull Requests: 112 (+0)
GitHub issues: Enabled
Number of forks: 177
Total Stargazers: 3,406 (+0)
Total Subscribers: 8 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 42
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 620 days
Stale 30+ days: 39
Stale 90+ days: 35

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • bug (5)
  • enhancement (4)
  • documentation (1)
  • good first issue (1)
  • refactor (1)
  • release (1)
  • wishlist (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

GoMock is a mocking framework for the Go programming language. It integrates with Go's built-in testing package to generate mock implementations of interfaces, enabling developers to isolate units under test and verify their behavior through mock assertions.

The tool solves the problem of creating and managing mock objects in Go tests by automatically generating mock implementations from interface definitions. Rather than writing mocks by hand, developers specify which interfaces to mock and the mockgen command generates the corresponding mock code. The framework supports three modes of operation: archive mode for generating mocks from compiled package archives, source mode for generating from Go source files, and package mode for generating from import paths and interface names. Generated mocks integrate with Go's testing package and provide a recorder mechanism for setting expectations and verifying method calls.

GoMock suits any Go project that uses interfaces and wants to reduce boilerplate in unit tests. It is particularly valuable for projects with many interfaces or complex mock setups where hand-written mocks would be tedious. The tool supports customization through flags like -mock_names for renaming generated mocks, -imports for controlling package imports in generated code, and -aux_files for resolving embedded interfaces across multiple source files. The README does not compare the tool to alternatives.

The project is actively maintained at Uber following a fork from an earlier Google-maintained repository. The tool supports all Go versions covered by the official Go release policy, staying current with language developments. The project welcomes contributions through GitHub issues and pull requests, indicating openness to community involvement.