Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/gf: gf gen pb did not escape the backtick in dc tag #3882

Closed
RyoJerryYu opened this issue Oct 23, 2024 · 0 comments · Fixed by #3890
Closed

cmd/gf: gf gen pb did not escape the backtick in dc tag #3882

RyoJerryYu opened this issue Oct 23, 2024 · 0 comments · Fixed by #3890
Assignees
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.

Comments

@RyoJerryYu
Copy link

Go version

go1.23.2 linux/amd64

GoFrame version

2.7.4

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

I run df gen pb in my project, where my .proto file have field comments containing ` as below:

message SomeMessage {
  // Some comment on field with `backtick` in the comment.
  string a_field = 1;
}

What did you see happen?

It generate codes be like below:

type SomeMessaage struct {
  // ...
  AField string `protobuf:"..." json:"..." dc:"Some comment on field with`backtick` in the comment"`
}

It is a syntax error, and it will lead to a build failed.

What did you expect to see?

It should generate something as below, for excaping the backtick:

type SomeMessaage struct {
  // ...
  AField string "protobuf:\"...\" json:\"...\" dc:\"Some comment on field with`backtick` in the comment\""
}
@RyoJerryYu RyoJerryYu added the bug It is confirmed a bug, but don't worry, we'll handle it. label Oct 23, 2024
@RyoJerryYu RyoJerryYu changed the title cmd/gf: gf gen pb did not escape the ` ` in dc` tag cmd/gf: gf gen pb did not escape the `` in dc` tag Oct 23, 2024
@RyoJerryYu RyoJerryYu changed the title cmd/gf: gf gen pb did not escape the `` in dc` tag cmd/gf: gf gen pb did not escape the backtick in dc tag Oct 23, 2024
@oldme-git oldme-git self-assigned this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.
Projects
None yet
2 participants