golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.74k stars 1.58k forks source link

Incompatibility with 'google.golang.org/protobuf/proto' slice while using 'status.WithDetails' #1559

Closed squareheadc closed 1 year ago

squareheadc commented 1 year ago
**What version of protobuf and what language are you using?**
Version: google.golang.org/protobuf v1.31.0
Language: Go

**What did you do?**
I tried to use the `status.WithDetails(details ...proto.Message) (*Status, error)` method in the status package with a slice of `proto.Message`.

Here is the sample code snippets for this issue:
```go
var detail []proto.Message
// fill the detail slice
se.WithDetails(detail...)

What did you expect to see? I expected to successfully call the WithDetails method with a slice of proto.Message.

What did you see instead? The compilation failed with the following error:

cannot use e.Details (variable of type []protoreflect.ProtoMessage) as []protoiface.MessageV1 value in argument to se.WithDetails

Anything else we should know about your project / environment? Despite the deprecation of the github.com/golang/protobuf package, the status package still uses it, leading to this issue. It’s not currently possible to use the recommended google.golang.org/protobuf/proto.Message due to this. I believe this could be a potential problem for others who are also transitioning from github.com/golang/protobuf to the newer google.golang.org/protobuf.

puellanivis commented 1 year ago

I don’t see any status.WithDetails in https://pkg.go.dev/google.golang.org/grpc@v1.57.0/status which package are you using?

P.S.: Hm, oh wait, it’s on the type itself in https://pkg.go.dev/google.golang.org/grpc@v1.57.0/internal/status#Status

squareheadc commented 1 year ago

I apologize for the confusion and for raising the issue in the wrong project. I will close this issue and seek help in the appropriate project. Thank you and sorry for any inconvenience caused.