-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
proto: cannot use m.ProtoMethods() (type *protoreflect.Message) as type *struct ... #1094
Comments
$ go get github.com/fullstorydev/grpcurl
go: downloading github.com/fullstorydev/grpcurl v1.5.1
go: github.com/fullstorydev/grpcurl upgrade => v1.5.1
go: downloading github.com/jhump/protoreflect v1.5.0 Can you give the exact steps to reproduce the error? |
go version : go11
go 1.13 is ok |
I'm extremely puzzled as to how you're getting that particular error, since I don't believe the Try dropping your Travis cache? |
Hi. I,ve already dropped cache and the same thing is happening. there is something else I could do? |
What versions of Go are you using? |
I Have Version 1.11 |
Per @relunctance's comment (#1094 (comment)), it seems to work on go1.13, but not go1.11. I wonder if the build problems have something to do with the lack of module support. At a base level, our unit tests checks that our tests all pass from go1.9 to go1.14. |
I've run the following on my workstation and I unfortunately cannot reproduce the problems: for GO in go1.9 go1.10 go1.11 go1.12 go1.13 go1.14; do
echo $GO
/bin/rm -rf /tmp/gopath
GOPATH=/tmp/gopath $GO get github.com/fullstorydev/grpcurl
done |
Hi I just updated my go version and it worked, thank you so much guys! |
I am working on a project with hyperledger-fabric 1.4 where I build and deploy a chaincode that has protobuf and its dependencies and I also started getting this error although everything worked fine before a recent docker update I have github.com/golang/protobuf v1.4.1 in my go.mod of my chaincode and when deploying it in the blockchain (so building the binary and deploying it in a separate docker container) it fails with a building error: Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 2 "# Hyperledger/AbstractDealChaincode/vendor/google.golang.org/protobuf/proto Unfortunately the images of hyperledger fabric used in my setup use go of versions 1.11 and 1.12 so I have no option of switching to go 1.13 |
I would love to fix this issue, but without a reproduction, we are unable to do anything about this. My best guess is that this is due a bug in the build cache introduced in go1.10. Can you try disabling the build cache? https://golang.org/doc/go1.11#gocache and https://golang.org/doc/go1.12#gocache |
I will try this soon as I will have to install a newer version of docker engine but for now I solved this problem for myself by downgrading the version of docker from the latest one (so from 19.03.08 to 19.03.05: https://docs.docker.com/engine/release-notes/), you may see there are latest releases had some updates with grpc. Thus you may reproduce the bug by installing the latest docker version and build anything with github.com/golang/protobuf v1.4.1 inside a container with go < 1.13 |
Hi, I use docker-compose for local tests for microservices and get same problem:
My Dockerfiles were:
I tried to change go version to 1.13 but nothing changed. I use Ubuntu btw, my colleague use Mac and it works on his machine |
Hello, I had exactly the same problem in docker as I described earlier. For me downgrading from latest version of docker fixed this problem |
What version of docker is ok? |
19.03.05 works for me |
Downgraded to 18.03.1, same problem |
Wut?
What is the full output of your |
I did not say that reflex is the problem. Actually I fixed problem by changing volumes and workdir in docker-compose file from:
to:
It fixed problem with protobuff error |
No, you did not say that reflex was the problem, but the only information you included in your post was the single error message line, and an apparently irrelevant Dockerfile, what are we supposed to assume from the inclusion of that Dockerfile?
So you were using the local |
go version 1.11 [gql@vxved ~/test/go/hbase]$ go get -v github.com/tsuna/gohbase
google.golang.org/protobuf/proto
# google.golang.org/protobuf/proto
../../../gopath/src/google.golang.org/protobuf/proto/proto_methods.go:18:23: cannot use m.ProtoMethods() (type *protoreflect.Message) as type *struct { pragma.NoUnkeyedLiterals; Flags uint64; Size func(struct { pragma.NoUnkeyedLiterals; Message protoreflect.Message; Flags uint8 }) struct { pragma.NoUnkeyedLiterals; Size int }; Marshal func(struct { pragma.NoUnkeyedLiterals; Message protoreflect.Message; Buf []byte; Flags uint8 }) (struct { pragma.NoUnkeyedLiterals; Buf []byte }, error); Unmarshal func(struct { pragma.NoUnkeyedLiterals; Message protoreflect.Message; Buf []byte; Flags uint8; Resolver interface { FindExtensionByName(protoreflect.FullName) (protoreflect.ExtensionType, error); FindExtensionByNumber(protoreflect.FullName, protowire.Number) (protoreflect.ExtensionType, error) } }) (struct { pragma.NoUnkeyedLiterals; Flags uint8 }, error); Merge func(struct { pragma.NoUnkeyedLiterals; Source protoreflect.Message; Destination protoreflect.Message }) struct { pragma.NoUnkeyedLiterals; Flags uint8 }; CheckInitialized func(struct { pragma.NoUnkeyedLiterals; Message protoreflect.Message }) (struct { pragma.NoUnkeyedLiterals }, error) } in return argument |
go version 1.13 |
I recommend that you avoid using vendor directories as they often cause type-variance issues where two types that should be identical are not. |
Docker 19 is the version where I see similar error |
Hi there ! I want to specify something different but maybe helpful. We also has this error today in our jenkins pipeline. After sometimes debugging , I found my Go module After we found the replace bug , we fix it and uses Go 1.11 to build our project , and now it also works. We use the I create a repo to reproduce this and here is the reproduce case: https://github.com/magejiCoder/issue-1094/runs/1981606218#step:4:10 |
It seems that this issue occurs due to the use of vendoring, which functionally carves out portions of the dependency tree and creates multiple versions of the "google.golang.org/protobuf" module be linked into a binary. Since these are different versions of the same module, then it means that the types will not be the same (i.e., See https://groups.google.com/g/golang-nuts/c/AnMr9NL6dtc/m/UnyUUKcMCAAJ about this fundamental flaw in the vendor feature. |
I am recently try to build a project which I had build it multiple times successfully. But recently I get this error while building grpcurl as part of build process, is there any imcompatible changes made to your repo?
/# Build grpcurl
go get github.com/fullstorydev/grpcurl
/# google.golang.org/protobuf/proto
/root/go/src/google.golang.org/protobuf/proto/proto_methods.go:18:23: cannot use m.ProtoMethods() (type *protoreflect.Message) as type *struct ...
The text was updated successfully, but these errors were encountered: