git404hub

what is mock fr?

golang/mock — explained in plain English

Analysis updated 2026-06-24

9,366GoAudience · developerComplexity · 2/5Setup · moderate

tl;dr

An archived Go testing tool that auto-generates fake implementations of interfaces so you can test one piece of code without starting real databases or services, use the community fork at go.uber.org/mock for new projects.

vibe map

mindmap
  root((GoMock))
    How it works
      mockgen reads interfaces
      Generates fake code
      gomock sets expectations
    Test features
      Call count checks
      Argument matching
      Return value control
    Integration
      Go testing package
      go generate support
    Status
      Archived June 2023
      Use go.uber.org/mock

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Auto-generate mock implementations of Go interfaces with the mockgen tool so you never write fake code by hand.

VIBE 2

Set strict expectations in tests such as a function must be called exactly once with a specific argument and fail automatically if it is not.

VIBE 3

Wire mockgen into go:generate so mocks are regenerated automatically whenever an interface definition changes.

what's the stack?

Go

how it stacks up fr

golang/mocksosedoff/pgwebbytedance/sonic
Stars9,3669,3569,382
LanguageGoGoGo
Setup difficultymoderateeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · moderate time til it works · 30min

Repository is archived, new projects should use the maintained community fork at go.uber.org/mock.

License terms not stated in the explanation.

in plain english

GoMock is a testing tool for Go programs. The README states upfront that this repository is no longer maintained as of June 2023, and anyone looking for an actively supported version should use the community fork at go.uber.org/mock instead. For those who encounter this codebase: when developers write software, they often need to test one piece of code in isolation, without relying on other pieces that might be slow, unreliable, or not yet built. A common approach is to replace those dependencies with fakes called mocks, objects that pretend to be the real thing and let you specify exactly what they should return during a test. GoMock automates the creation of those fakes. The workflow has two parts. First, a command-line tool called mockgen reads your Go interface definitions and automatically generates the fake implementation code, so you do not have to write it by hand. Second, the gomock library provides functions you use inside your tests to set expectations, such as "this method should be called exactly once with the value 99 and should return 101." If the code under test calls the fake in any other way, the test fails automatically. The mockgen tool can read interfaces directly from source files or by analyzing your code through Go's reflection system. It produces standard Go source files you check into your project alongside your other code. This project was maintained by the Go team at Google and integrates with Go's built-in testing package. It works in any Go project and can be combined with code generation directives so mocks are regenerated automatically when interfaces change. Because the repository is archived, new projects should use the maintained fork mentioned above.

prompts (copy fr)

prompt 1
I have a Go interface called UserRepository with GetUser and SaveUser methods. Use mockgen to generate a mock, then write a test that expects GetUser to be called once with ID 42 and return a specific test user.
prompt 2
Show me how to add a go:generate directive so running go generate regenerates all gomock mocks in my project when interfaces change.
prompt 3
My Go service calls an external payment API. Write a gomock test that verifies my checkout function calls Charge exactly once and retries once on a network error.

Frequently asked questions

what is mock fr?

An archived Go testing tool that auto-generates fake implementations of interfaces so you can test one piece of code without starting real databases or services, use the community fork at go.uber.org/mock for new projects.

What language is mock written in?

Mainly Go. The stack also includes Go.

What license does mock use?

License terms not stated in the explanation.

How hard is mock to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is mock for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.