-
Notifications
You must be signed in to change notification settings - Fork 114
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
env: fix a bunch of escaping/parsing edge cases #308
Conversation
e25772b
to
f297e4c
Compare
parseAndCompare(t, `FOO="bar\n\ b\az"`, "FOO", "bar\n\\ b\az") | ||
parseAndCompare(t, `FOO="bar\\\n\ b\az"`, "FOO", "bar\\\n\\ b\az") | ||
parseAndCompare(t, `FOO="bar\\r\ b\az"`, "FOO", "bar\\r\\ b\az") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. It was buggy here before! It was stripping \
characters on "unknown" escape sequences, which is...not desirable 🙈
* Handle standard escape sequences based on XSI/XBD https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html * Fix parsing with escaped quotes at end of quoted value * Handle key whose name starts with `export` (require whitespace between `export` keyword when stripping) * Fix parsing of unquoted values with embedded `#` (require a space before starting an inline comment) * Use correct parser methods throughout all test cases * Eliminate a lot of unused code that was not working right Signed-off-by: Milas Bowman <milas.bowman@docker.com>
f297e4c
to
e3531d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IHMO no need to support Golang 1.17
anymore and to avoid breaking changes in downstream repositories we should not remove exported methods.
@@ -1,6 +1,6 @@ | |||
module github.com/compose-spec/compose-go | |||
|
|||
go 1.17 | |||
go 1.18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🫣 Ho I didn't check we were still using 1.17 here 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
f3671f6
to
300f36b
Compare
\
for non-escape sequences (e.g.\j
should still be\j
, notj
)export
(require whitespace betweenexport
keyword when stripping)#
(require a space before starting an inline comment)