Open
Conversation
toastwaffle
requested changes
Nov 3, 2025
Contributor
toastwaffle
left a comment
There was a problem hiding this comment.
I think #3412 fixes the same thing as this - @chrisnovakovic are you planning to push that forward?
Contributor
Yes, I'm planning on addressing the remaining comments in #3412 (which really amount to comments and error messages). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
str.format()function in Please was not properly handling escaped braces ({{and}}), which should be converted to single braces ({and}) according to Python's standard behavior. This caused issues when users tried to generate JSON or other text with literal braces in BUILD files.Bug Report: Issue #3356
Root Cause
The original implementation of
strFormat()in builtins.go only looked for{followed by}to identify placeholders for variable interpolation. It did not check if braces were escaped by doubling them ({{or}}), which is the standard Python syntax for literal braces.Solution
Modified the
strFormat()function (lines 585-672 in builtins.go) to implement a proper state machine that handles:{{): Convert to single{}}): Convert to single}{name}): Still interpolates variables (unchanged)${{var}}): Special case for Please - converts to${var}(unchanged)Example Behavior
Before the fix:
After the fix:
Real-world use case (from issue #3356):
Output:
{ "name": "my_app", "version": "1.0.0" }