Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Go Mock GeneratorNew to Visual Studio Code? Get it now.
Go Mock Generator

Go Mock Generator

Junior Schmidt

|
3 installs
| (1) | Free
Generate mocks for Go interfaces using mockgen
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Go Mock Generator for VSCode

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.

Sample

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

  1. Open a Go file containing interfaces.
  2. Right-click the file in Explorer or the editor.
  3. Select Go: Generate Mock with mockgen.
  4. The mock file will be generated at /test/mocks/<package>/<file>_mock.go.

Requirements

  • Go >= 1.20
  • Visual Studio Code
  • mockgen installed (you can install it with the following command):
go install github.com/golang/mock/mockgen@latest
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft