Open JungleYe opened 5 years ago
Hi. I think it is correct? With this example protofile:
message Message1{
repeated Message2 foo = 1 [(gogoproto.nullable) = false];
}
message Message2{
optional string bar = 1 [(gogoproto.nullable) = false];
}
In your case you have the option:
[(gogoproto.nullable) = false];
enabled. This means your struct slice is generated without a pointer and looks like this:
type Message1 struct {
Foo []Message2 `protobuf:"bytes,1,rep,name=foo" json:"foo"`
}
With this as the output:
&Message1{Foo:[{HelloWorld}],}
if you use:
[(gogoproto.nullable) = true];
Your struct would look like this:
type Message1 struct {
Foo []*Message2 `protobuf:"bytes,1,rep,name=foo" json:"foo,omitempty"`
}
And your string:
&Message1{Foo:[&Message2{Bar:HelloWorld,}],}
Is this second case the case you are pointing to where you expected another &
in your string?
@jmarais in my example
mt.Dt = "https://www.google.com/search?q=gogoproto&rlz=1234"
there is a character '&' between 'gogoproto' and 'rlz' the output lost the character '&':
//output : &MyTst{SS:[{https://www.google.com/search?q=**gogoprotorlz**=1234 {} [] 0}],XXX_unrecognized:[],}
Thanks for clarifying. I misunderstood your initial message.
I can recreate your problem. I will look into it.
here is my proto file:
here is my test code:
the test outputs lost the character '&'
maybe the problem is here
the this.SS is slice type,
&
should not be replaced with `` ?Bets Regards