Closed hori-ryota closed 4 weeks ago
If you have any advice on effectively standardizing the mockgen version across a team, it would be greatly appreciated.
Actually, not sure we should support it.
If you just want to fix the version, cannot you script -
go install go.uber.org/mock/mockgen@v0.4.0
gomockhandler -config=/path/to/gomockhandler.json mockgen
in your Makefile or whatever?
@sanposhiho Thank you for your response!
Using go install
sets the version of mockgen globally on the machine. This can lead to conflicts when developing multiple projects on a single machine.
While it's true that running go install
for each project during execution can fix the gomock version, it would be preferable to have a solution that is confined to each project and does not interfere with other projects.
Using go install sets the version of mockgen globally on the machine.
There are some known tricks for that specific problem. The one I often do is like - https://github.com/mercari/grpc-federation/blob/main/Makefile#L3-L5
Certainly, I can overwrite the PATH in the Makefile, so this approach will work! Thank you!
It seems like the issue I'm facing can be resolved with the method you taught me.
Cool, let's close the PR then.
/close
When using gomockhandler in a team setting, it is essential to standardize the version of mockgen. Currently, each team member needs to manually align their local version of mockgen.
By allowing the override of mockgen, we can specify the version as follows:
However, specifying the mockgen_cmd through gomockhandler options presents an issue because the go:generate directive does not support options with spaces (quotation will be ignored).
As a temporary workaround, I propose adding a setting to the configuration file that allows the override of the mockgen_cmd. This will enable team-wide consistency without the need for manual version alignment on each developer's machine.