Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Support customizing generated mock package name #631

@dr-dime

Description

@dr-dime

Currently, mockgen allows specifying the generated mock package name with -package or a
generated package name with mock_ prefix will be used. However, when generating mock files
as package tests in scripts, this flag is very difficult to use.

In which case, the generated file shares the same package name as the package being mocked.
So we need to use tools (eg. grep) to extract the package name first, then pass it to mockgen.

This seems odd as mockgen already has the package name internally, and relies on external
tools for this are just a recipe for trouble.

I propose to introduce another flag to customize the generated mock package name, by default
it uses "mock_%s" which is the current behavior, and can be changed to other formats to allow
scripting usages.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions