#791·mockery

Feature request: pre-commit hooks

Author: liveFreeOrCodeCreated Jul 2, 2024Updated Feb 6, 2026

PLEASE READ

DO NOT submit tickets without first using the latest version of Golang, clearing your local golang package cache, and re-building mockery using the latest Golang version and the latest version of mockery. Please provide evidence this has been done in your issue. Failure to provide this evidence will likely result in your issue being closed.

Description

It would be nice to have supported pre-commit hooks capable of generating mocks as part of the normal CD process. Currently I accomplish this as a local hook, but that local hook uses my local golang installation, and if I have a mockery version installed already, the "additional_dependencies" won't be honored.

yaml
repos:
  - repo: local
    hooks:
      - id: generate-mocks
        name: generate mocks
        language: golang
        additional_dependencies:
          - github.com/vektra/mockery/[email protected]
        entry: mockery
        pass_filenames: false

Mockery Version

latest

Golang Version

go version go1.22.4 linux/amd64

NOTE: Please upgrade to the latest golang version before submitting tickets!