You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with these examples, keep in mind that there are two escape sequences in each line, the one in the front, setting the color, and the one at the end, clearing the color.
What did you expect to see?
I would expect both \e and \033 to work the same way as they are used to do the same thing.
If someone is trying to colorize the console output of their tools, and they try to use \e, which fails, it feels counterintuitive for \033 to work.
What did you see instead?
A string containing \e yields a compiler error, whilst a string containing \033 works as expected.
This may somewhat be related to #11575. I don't know which category this belongs to.
The text was updated successfully, but these errors were encountered:
TLDR:
\033[
works as expected,\e[
yieldsunknown escape
although both do the same thing.What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
On Linux (and recent Windows versions), text on the console can be colored with escape sequences of the form
For more information, see https://misc.flogisoft.com/bash/tip_colors_and_formatting and https://en.wikipedia.org/wiki/Escape_sequences_in_C#ref_Note1.
For example, both
\e[31;44m
and\033[31;44m
should create red text on blue background.This does also work in C:
However, trying to create string which contains
\e
yields a compiler error: https://play.golang.org/p/5XhK4vANSqIThe very same code with
\033
works can compile and works as expected: https://play.golang.org/p/Wv3sJZBjrVIWhen working with these examples, keep in mind that there are two escape sequences in each line, the one in the front, setting the color, and the one at the end, clearing the color.
What did you expect to see?
I would expect both
\e
and\033
to work the same way as they are used to do the same thing.If someone is trying to colorize the console output of their tools, and they try to use
\e
, which fails, it feels counterintuitive for\033
to work.What did you see instead?
A string containing
\e
yields a compiler error, whilst a string containing\033
works as expected.This may somewhat be related to #11575. I don't know which category this belongs to.
The text was updated successfully, but these errors were encountered: