googlearchive / code-prettify

An embeddable script that makes source-code snippets in HTML prettier.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang run-on string when backticks appear to be escaped

coreyog opened this issue · comments

Originally posted on MetaSO.

I came across this answer's code snippet. In Golang, strings enclosed in backticks are taken as a raw string. It doesn't parse for escape sequences. The code formatter erroneously colors the rest of the code as if it were in a multi-line string literal.

This is true even if you explicitly specify the language as golang. Java's formatter gets it right. Java doesn't use backtick strings so it's not a fair comparison.

snippet