add support for emoji compilation in formatted arguments #32
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.
I have some structs that implement
String() string
, whereString()
could return something that contains an emoji. However, when doing something like:this happens because arguments to
Printf
or anything that takes...interface{}
are compiled separately argument-by-argument (example), and only compiles emojis if it is astring
:there are 2 ways to support this:
compileValues
, check forString()
via type assertion and compile thatSprint
or the required variation of it before compiling, and makecompile
the last step before a print in every casethis PR implements the 2nd method, which I think is the cleanest and most consistent way to do it - if you prefer the other way, or have other ideas, I would be happy to implement it.
thanks!