Go Mock Generator for VSCode is a Visual Studio Code extension that streamlines creating mocks for Go interfaces using mockgen. Generate mock files quickly while keeping your project’s package structure organized.
Key Features
Automatically generates mocks for Go interfaces from the active or selected file.
Saves mocks in /test/mocks while preserving the project’s package hierarchy.
Supports files inside internal or src, ignoring these directories when generating mocks.
Integrates directly into VSCode’s context menu (right-click in Explorer).
How to Use
Open a Go file containing interfaces.
Right-click the file in Explorer or the editor.
Select Go: Generate Mock with mockgen.
The mock file will be generated at /test/mocks/<package>/<file>_mock.go.