Closed dodoao closed 2 years ago
Same
Did you follow the instructions in https://grpc.io/docs/languages/go/quickstart/ to install protoc-gen-go-grpc
?
It would also be worth checking your protoc-gen-go
version. According to the quickstart, it should be
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
Did you follow the instructions in https://grpc.io/docs/languages/go/quickstart/ to install
protoc-gen-go-grpc
?
Same. But what confuses me is that the code still runs normally.
version:
❯ protoc-gen-go-grpc --version
protoc-gen-go-grpc 1.1.0
❯ protoc-gen-go --version
protoc-gen-go.exe v1.26.0
Did you follow the instructions in https://grpc.io/docs/languages/go/quickstart/ to install
protoc-gen-go-grpc
?
I did . I think you can look here: github.com/grpc/grpc-go/blob/master/examples/route_guide/routeguide/route_guide.pb.go. Line 70
This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.
This is an issue with your protoc-gen-go
version, not protoc-gen-go-grpc
, since it's the messages and not the services that are affected. Make sure you are using the latest generator from google.golang.org/protobuf
(https://github.com/protocolbuffers/protobuf-go) and make sure protoc
is running that version (it looks in your path IIRC) by looking at the output file and ensuring the proper version is shown at the top in the comments.
I am currently experiencing the same issue, it only happens when generating under Apple Silicone (darwin/arm64). I use a docker image with the following versions:
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.19.1
I'm going to close this, as it's likely either:
go.mod
)Either way, this repo owns the code generator for the grpc stubs only, and the above errors are related to the base protobuf message generation/usage. If you're still having trouble, please try stack overflow or the protobuf repo (https://github.com/protocolbuffers/protobuf-go) for help.
If you are following some instructions we publish (e.g. https://grpc.io/docs/languages/go/quickstart/) and find there is an error there, please let us know.
Hi, thanks for your time, but I recently occured with the same problem in my GoLand IDE.
The GoLand said exactly the same as @dodoao commented above:
Cannot use 'ms' (type messageState) as the type protoreflect.Message Type does not implement 'protoreflect.Message' __need the method: ProtoMethods() methods have the method: ProtoMethods() *protoiface.Methods__
The same notice also shows up in file "google.golang.org/protobuf@v1.27.1/internal/impl/message_reflect.go":
I had my go of version:1.17.3 and protoc-gen-go of version:v1.27.1
I tracked method ProtoMethods
which messageState
implemented, and finally found that the method return value is pointer of type protoiface.Methods
, while the interfae protoreflect.Message
requires the return value of method ProtoMethods
be pointer of type protoreflect.methods
.
I found comments of protoreflect.Message.ProtoMethods
said:
The returned methods type is identical to "google.golang.org/protobuf/runtime/protoiface".Methods.
but I couldnt figure out how it comes type protoiface.Methods
is identical to type protoreflect.methods
, although these two have the same fields. Maybe it's the reason why my IDE couldnt recognize type messageState
as implementation of interface protoreflect.Message
?
As I said in the comment directly above, this is not the right repo for this issue. This is a message, generated by protoc-gen-go
, not protoc-gen-go-grpc
.
If you are following some instructions we publish (e.g. https://grpc.io/docs/languages/go/quickstart/) and find there is an error there, please let us know.
As I said in the comment directly above, this is not the right repo for this issue. This is a message, generated by
protoc-gen-go
, notprotoc-gen-go-grpc
.If you are following some instructions we publish (e.g. https://grpc.io/docs/languages/go/quickstart/) and find there is an error there, please let us know.
ok, that's my fault, but thanks. have a nice day btw
I think it's GoLand's problem. I got this message today after upgrading to 2021.3, but it was fine after downgrading to 2021.2.4.
My Environment:
macOS 12.0.1
go 1.17.3
libprotoc 3.17.3 / 3.19.1
protoc-gen-go v1.27.1
me too
same here 👍
same here
same here
I'm locking this thread since the problem is resolved. Please file a new issue if there are other questions. Thanks!
NOTE: if you are reporting is a potential security vulnerability or a crash, please follow our CVE process at https://github.com/grpc/proposal/blob/master/P4-grpc-cve-process.md instead of filing an issue here.
Please see the FAQ in our main README.md, then answer the questions below before submitting your issue.
What version of gRPC are you using?
libprotoc 3.19.1
What version of Go are you using (
go version
)?go version go1.17.3
What operating system (Linux, Windows, …) and version?
windows 10 /amd64
What did you do?
go to github.com/grpc/grpc-go/blob/master/examples/route_guide/routeguide/route_guide.pb.go. Line 70
run this code
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative route_guide.proto
Same resultWhat did you expect to see?
What did you see instead?