buf
buf copied to clipboard
Preserve single quotes with buf format
before:
message LoginRequest {
string name = 1 [
(gogoproto.moretags) = 'binding:"required"',
(google.api.field_behavior) = REQUIRED
];
string passwd = 2 [
(gogoproto.moretags) = 'binding:"required"',
(google.api.field_behavior) = REQUIRED
];
}
after run buf format.
message LoginRequest {
string name = 1 [
(gogoproto.moretags) = "binding:\"required\"",
(google.api.field_behavior) = REQUIRED
];
string passwd = 2 [
(gogoproto.moretags) = "binding:\"required\"",
(google.api.field_behavior) = REQUIRED
];
}
it is alway use double quote for string, then Escape the double quote.
Thanks for the issue - we should be able to detect whether or not the string contains a double quote and preserve the format in the original source. I'll need to do a little bit of investigation to determine exactly where single quotes can be used in the prototext format (it could just be anywhere a double quote string is, but perhaps not).
is there any progress?
This will go out in the next release!