jmattheis / goverter

Generate type-safe Go converters by simply defining an interface
https://goverter.jmattheis.de/
MIT License
496 stars 46 forks source link

[Questions] The underlying data types are consistent, can they be converted? #48

Closed shuqingzai closed 1 year ago

shuqingzai commented 1 year ago

Have you read the project readme?

Describe your question A clear and concise description of what the question is. Include errors and go source files.

greeter.go

type Greeter struct {
    Status      int32
}

the greeter.pb.go generated by the protobuf file

type GreeterStatus int32

type GreeterSaveBodyContext struct {
    state         protoimpl.MessageState
    sizeCache     protoimpl.SizeCache
    unknownFields protoimpl.UnknownFields

    Status GreeterStatus `protobuf:"varint,1,opt,name=status,proto3,enum=greeter.v1.GreeterStatus" json:"status,omitempty"`
}

this fails to generate code