uber-go / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
1.8k stars 103 forks source link

Relative path as parameter values for -source and -destination #174

Open Abhishekkarunakaran opened 2 months ago

Abhishekkarunakaran commented 2 months ago

Currently we have to pass the whole path of the files as values to the flags -source and -destination. eg: mockgen -source=D:\go_project\library_management\src\core\ports\repository.go -destination=D:\go_project\library_management\src\core\mocks\respository_mock.go (In windows)

To reduce this redundancy in type, we can use the relative path. Assuming mockgen is used from the targeted codebase.

Abhishekkarunakaran commented 2 months ago

Is there any particular reason to make it as what it is now?

r-hang commented 2 months ago

Hey @Abhishekkarunakaran, I see examples of relative paths being passed to the --source and --destination options for the mockgen command in the //go:generate comments of multiple files in the repository.

Abhishekkarunakaran commented 2 months ago

In my understanding, the relative path is only available in reflect mode, not in source mode.