Skip to content

Unable to generate mocks for protobuf clients? #681

@leaanthony-sc

Description

@leaanthony-sc

Description

We have been using mockery (v2.10.6 - docker) successfully to generate mocks for protobuf clients but recently upgraded to v2.32.0 to try out the new packages configuration. It now appears to be impossible to generate protobuf client mocks. Running mockery in debug mode indicated that all source files were being skipped with the message DBG skipping file as auto-generated. Investigating further, I believe I've narrowed it down to this check in config.go. This appears to have been added as part of this commit which was intended to introduce the recursive option. The linked issue doesn't have any information with regards to now skipping auto generated code so it's not clear what the driver was for this change. There also does not appear to be a way around this limitation. I did search through the issue tracker prior to opening this but could not find anything related. Generating mocks for protobuf clients is not uncommon so I'm surprised this hasn't been raised already. Thanks for your time.

Mockery Version

v2.32.0 via docker image

Golang Version

v1.20.7

Installation Method

  • Binary Distribution
  • Docker
  • brew
  • go install
  • Other: [specify]

Steps to Reproduce

  1. Generate client protobuf
  2. Use mockery to try and generate a mock for the client

Expected Behavior

I would expect a mock to be generated like it did prior to the change on the 9th of April, or at least an option to allow it to be generated.

Actual Behavior

The file does not get processed due to a hard coded restriction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions