-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code generated by the trpc create command reports an error #42
Comments
I have updated the binaries to https://github.com/uber-go/mock/tree/main/gomock. You can delete the dependencies and run |
thanks, this solves part of the issue |
@tyanxie Hi, do you find any problem with the new binaries such as trpc-group/trpc-go#180? |
@WineChord Sorry, I didn't have any problems using the latest Then i extracted the core message: From this sentence, |
@tyanxie I reckon it is because my path information is built into the binary, which is causing the trouble. But when I marked out the required go/bin path, I was still not able to reproduce the user's error. Very curious. |
@WineChord I can't reproduce the user issue either. I traced that when some errors occur, Maybe the essential problem is that GOROOT is set incorrectly, but no matter what, we may not be able to continue troubleshooting now, unless the owner of that issue gives more detailed information, such as |
@tyanxie Some latest finding: trpc-group/trpc-go#180 (comment) |
Perfect!👍 |
What version of trpc-cmdline are you using?
v1.0.9
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
download the
docs/helloworld/helloworld.proto
file and runtrpc create -p helloworld.proto -o .
What did you expect to see?
hello_world_service_test.go
file can be executed directly without modification, even if it makes no sensehelloworld_mock.go
reported no errorWhat did you see instead?
hello_world_service_test.go
filego mod tidy
, thehelloworld_mock.go
file reported an errorMy thoughts 1
I used the
trpc setup
command to install themockgen
command.It looks like the installed
mockgen
isgithub.com/golang/mock/mockgen
, so the stub codehelloworld_mock.go
generated using thetrpc create
command introducedgithub.com/golang/mock
library.However, the
hello_world_service_test.go
andgo.mod
files tend to import thego.uber.org/mock
library, thus causing some of the errors. (In addition, I noticed that the manual installation of dependencies in theREADME.md
document also tends to installgo.uber.org/mock
)Regarding this issue, I think two points should be carefully considered:
mock
library.mockgen
libraries? Althoughgo.uber.org/mock
is now more recommended, some users also installgithub.com/golang/mock/mockgen
locally.My thoughts 2
For the
gomock.InOrder
function used in line 28 of the filehello_world_service_test.go
, the parameter it accepts is...any
, but it seems that the parameter currently passed in is...*gomock.Call
, That's why there is such an error.In short, I expect that the test code can be run directly after executing the
trpc create
command without modifying anything.The text was updated successfully, but these errors were encountered: