2

So in my protobuf I have a message object

message HelloReply {
    int32 response = 1;
}

And I try to assign the response to a variable

var resp = 0
resp = helloReply.Response

I got an error saying

cannot use helloReply.Response (type int32) as type int in assignment

P.S I'm really new to Go and Protobuf. I'm sorry if this is too basic. I already search for the solution but I think I can't find the right keyword. So I really need your help guys :(

Hana Alaydrus
  • 2,225
  • 16
  • 19

1 Answers1

1

Create resp variable of int32 type and assign helloReply.Response to resp variable. Like this

var resp int32
resp = helloReply.Response
Himanshu
  • 12,071
  • 7
  • 46
  • 61