Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func escapeString(s string) string { | ||
| if strings.Contains(s, "`") { | ||
| escaped := strings.ReplaceAll(s, "\\", "\\\\") | ||
| escaped = strings.ReplaceAll(escaped, "\"", "\\\"") | ||
| return `"` + escaped + `"` | ||
| } | ||
| if strings.Contains(s, "\\") { | ||
| return "`" + s + "`" | ||
| } |
There was a problem hiding this comment.
Escape strings with control characters correctly
The revised escapeString now hand-builds a double-quoted literal but only escapes backslashes and quotes. If a helper produces a string containing a newline, tab, or other control characters, the function will emit the raw character inside "…", which is invalid Go syntax and causes generated files to fail to compile. The previous implementation used strconv.Quote which handled these escape sequences. Consider delegating to strconv.Quote (or adding explicit escapes for control characters) whenever you return a double-quoted literal.
Useful? React with 👍 / 👎.
Summary
test/Testing
https://chatgpt.com/codex/tasks/task_e_68fe00ea00bc83258faa701c8c4152a8