How to Mock Fellow Gophers While Avoiding HR
summary
Mocks cause cross-team breakage when exported: gomock gets archived, Uber forks it, CI fails because controller types differ. Advice is concrete: don't export mocks, put package-only mocks in a file like thing_mock_test.go or in an internal/mock package, and deduplicate shared fakes there. For generators, install them per-module (not global), commit generated files or define a reproducible go:generate or team build target, and ensure test imports point to the same mock package so CI stays stable.
AI-written summary · about
related talks
50mThe best mock in the world: examining mock generation tools in Go
50mThe Best Mock in the World: Examining Tools for Generating Mocks in Go
25mFakes over Mocks: Shift your paradigm and identify monolithic code
52mPlease don’t mock me
04mMocking in Go: Using interfaces for fun and profits
36mTo Mock or Not to Mock
45mStop Using Mocks (for a while)
48mClimbing the Testing Pyramid: From Real Service to Interface Mocks in Go
