chore: add stdlib mock for io.Closer and update mockgen install instruction#586
chore: add stdlib mock for io.Closer and update mockgen install instruction#586aman-coder03 wants to merge 2 commits intouber:masterfrom
stdlib mock for io.Closer and update mockgen install instruction#586Conversation
thijmv
left a comment
There was a problem hiding this comment.
Thank you for the PR, a couple of comments.
| github.com/jmoiron/sqlx v0.0.0-20190319043955-cdf62fdf55f6 | ||
| github.com/mattn/go-sqlite3 v1.14.0 | ||
| github.com/opencontainers/go-digest v1.0.0 | ||
| github.com/opencontainers/image-spec v1.0.2 |
There was a problem hiding this comment.
Was this done accidentally?
| # mockgen must be installed on the system to make this work. | ||
| # Install it by running: | ||
| # `go get github.com/golang/mock/mockgen`. | ||
| # `go install go.uber.org/mock/mockgen@latest` |
There was a problem hiding this comment.
Let's revert this change as the project is currently setup to use github.com/golang/mock/mockgen meaning that mocks generated using Uber's fork would not compile without changes to go.mod.
| endef | ||
|
|
||
| .PHONY: mocks | ||
| mocks: |
There was a problem hiding this comment.
Please regenerate the mocks and commit the changes.
There was a problem hiding this comment.
thanks @thijmv , i will revert the Makefile comment and go.mod changes
for regenerating the mocks....i am on Windows and hitting compatibility issues running make mocks natively (the mockgen reflect mode builds a Linux binary). Could you confirm which version of mockgen and Go you used to generate the current mocks? that will help me match the output exactly
There was a problem hiding this comment.
Go >= 1.24 using github.com/golang/mock/mockgen@v1.6.0.
|
Can you update the PR description to accurately reflect the changes you are making? Here are two more possible improvements:
|
What
mocks/io/mock_closer.gogeneration to themake mockstarget in the Makefilego.uber.org/mock/mockgen@latest) instead of the archivedgithub.com/golang/mockgithub.com/opencontainers/image-specfrom indirect to direct dependency ingo.modWhy
mocks/io/mock_closer.gofile exists in the repo and is used in tests, but there was no correspondingmake mocksentry to regenerate it. This means anyone runningmake mockswould lose this file with no way to get it back, making the mock effectively unmanageable.mockgen install instruction pointed to
github.com/golang/mockwhich has been archived since June 2023. The maintained fork isgo.uber.org/mockfollows up on the discussion in #564
How to verify
Run
make mocks....mocks/io/mock_closer.gofile should now be regenerated correctly alongside all other mocks