That problem is a little bit surprising because the Go code generator is implemented as a plugin in a separate repo, and shouldn't therefore be affected by a protoc upgrade. Did you upgrade your Go protoc plugin at the same time?
As a side note, sorry for the confusion but we decided not to increment the major version from 3 to 4 yet. We published artifacts for 4.0.0-rc1 and 4.0.0-rc2 but there will not be a 4.0 release in the immediate future. We are going to release 3.13.0 soon instead. On Sat, Aug 8, 2020 at 3:31 AM rajegun <rgun...@gmail.com> wrote: > Hello there, > > We are currently using protoc 3.6.1 and planning to migrate to 4.x > > During our POC on this migration we found timestamp returned using our > existing code has differed from the format we were using, digging further > we dont know what exactly caused the problem. > > Timeformat received with 3.6.1 => "time": "2020-07-31T07:13:07.396733914Z", > > Timeformat received with 4.0.0 => "time": { > "seconds": "1596871176", > "nanos": 363018229 > }, > > Code: > > *partner.proto* > *------------------------------------------------* > message ResponsePartnerEmployeeList { > ...... > google.protobuf.Timestamp time = 3; > } > > *partner*.*pg.go file (protoc 3.6.1 version created)* > ----------------------------------------------- > timestamp "github.com/golang/protobuf/ptypes/timestamp" > > type ResponseList struct { > ..... > Time *timestamp.Timestamp > `protobuf:"bytes,3,opt,name=time,proto3" json:"time,omitempty"` > > XXX_NoUnkeyedLiteral struct{} `json:"-"` > XXX_unrecognized []byte `json:"-"` > XXX_sizecache int32 `json:"-"` > } > > *partner*.*pg.go file (protoc 4.0.0 version created)* > ----------------------------------------------- > timestamp "github.com/golang/protobuf/ptypes/timestamp" > > type ResponseList struct { > state protoimpl.MessageState > sizeCache protoimpl.SizeCache > unknownFields protoimpl.UnknownFields > > ....... > Time *timestamp.Timestamp `protobuf:"bytes,3,opt,name=time,proto3" > json:"time,omitempty"` > } > ----------------------------------------------- > > > *utils.go file (time data is updated here to the structure)* > > import pb "github.com/xxxxx/proto/partner" > import "github.com/golang/protobuf/ptypes" > > func GenerateResponse(errorCode Error, mesg ...string) *pb.ResponseList { > *time, _ := ptypes.TimestampProto(time.Now())* > > return &pb.ResponseList{ > .... > .... > .... > * Time: time,* > } > > --------------------- > > Problem in the time format received, this affects our application which > expects the data in 3.6.1 format > > Timeformat received with *3.6.1 => "time": > "2020-07-31T07:13:07.396733914Z",* > > Timeformat received with > > > * 4.0.0 => "time": { "seconds": "1596871176", "nanos": 363018229 },* > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to protobuf+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/3a10f37f-0fee-48c8-bced-05d45af4a5b9o%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/3a10f37f-0fee-48c8-bced-05d45af4a5b9o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CADqAXr4Fe8P07ZsaWg%2BouXJ9D48Fn8xH6ASNZp-wwzGX0tZ0%2BA%40mail.gmail.com.