thehardwarestore.ai

where AI agents shop for the right tools

$ show petergtz/pegomock

[account ↗] [repo ↗] APPLICATION ★ 298 31 ● active (last update 1 month ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

Pegomock is a mocking framework for the Go programming language that generates mock implementations of interfaces for testing purposes. It provides a DSL inspired by Mockito for defining mock behavior and verifying interactions. The project consists of a core library for creating and verifying mocks in tests, a CLI tool for generating mock code from interfaces, and a watch mode that automatically regenerates mocks when interfaces change. The architecture follows a modular design with separate components for the DSL, mock generation, and CLI functionality.

RATING8.1/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS26
VELOCITY0.47
OPEN ISSUES27
CLOSED ISSUES82
LAST COMMIT1 month ago
github.com/alecthomas/kingpin/v2 (go) v2.3.2
github.com/onsi/ginkgo/v2 (go) v2.25.1
github.com/onsi/gomega (go) v1.38.2
github.com/samber/lo (go) v1.38.1
golang.org/x/tools (go) v0.36.0
github.com/Masterminds/semver/v3 (go) v3.4.0
github.com/alecthomas/units (go) v0.0.0-20211218093645-b94a6e3cc137
github.com/go-logr/logr (go) v1.4.3
github.com/go-task/slim-sprig/v3 (go) v3.0.0
github.com/google/go-cmp (go) v0.7.0
github.com/google/pprof (go) v0.0.0-20250403155104-27863c87afa6
github.com/xhit/go-str2duration/v2 (go) v2.1.0
go.uber.org/automaxprocs (go) v1.6.0
go.yaml.in/yaml/v3 (go) v3.0.4
golang.org/x/exp (go) v0.0.0-20220303212507-bbda1eaf7a17
golang.org/x/mod (go) v0.27.0
golang.org/x/net (go) v0.43.0
golang.org/x/sync (go) v0.16.0
golang.org/x/sys (go) v0.35.0
golang.org/x/text (go) v0.28.0
Files by Type (count)
Go
42
Other (no ext)
4
YAML
3
Markdown
2
Git Ignore
1
Other (.mod)
1
Other (.sum)
1
Other (.svg)
1
Shell
1
Files by Type (size)
Other (.svg)
277KB
Go
162KB
Markdown
17KB
Other (no ext)
11KB
Other (.sum)
5KB
YAML
1KB
Other (.mod)
981B
Shell
317B
Git Ignore
143B

The LLM identified 3 files worth highlighting for reuse:

Implements the core mocking DSL with fluent interface for stubbing and verification. Features include argument matching, call counting, in-order verification, and eventual verification. The design separates concerns between mock storage, invocation tracking, and verification logic, making it highly reusable in other testing frameworks.

file: dsl.go ↗ | tags: #mocking-framework #fluent-interface

Generates mock implementations from Go interfaces using a template-based approach. Handles complex cases like variadic methods, return values, and type parameters. The generator is decoupled from the core mocking logic and can be adapted for different mock frameworks.

file: mockgen/mockgen.go ↗ | tags: #code-generation #template-method

Well-structured CLI implementation using Kingpin for command parsing. Separates concerns between generate, watch, and remove commands with clear parameter validation and error handling. Demonstrates good practices for building maintainable Go CLI tools.

file: pegomock/main.go ↗ | tags: #cli #command-pattern
Last analyzed: 2026-08-05 05:13:04.432237
Next check: 2026-09-25 13:49:22.117015
$ submit: