Skip to content

Handle codegen edge cases#2

Merged
AeonDave merged 1 commit intomainfrom
codex/verify-readme-and-test-coverage
Oct 26, 2025
Merged

Handle codegen edge cases#2
AeonDave merged 1 commit intomainfrom
codex/verify-readme-and-test-coverage

Conversation

@AeonDave
Copy link
Copy Markdown
Owner

Summary

  • skip blank lines when applying generation directives and avoid invalid raw literals when the replacement contains backticks
  • allow helper functions with multiple return values by capturing only the first result in the generated program
  • surface clearer errors when standard library detection fails and add regression tests under test/

Testing

  • go test ./...

https://chatgpt.com/codex/tasks/task_e_68fe00ea00bc83258faa701c8c4152a8

@AeonDave AeonDave merged commit cec5eb2 into main Oct 26, 2025
2 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 216 to 224
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 + "`"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant