StringToGoString takes an arbitrary string and converts it to a valid Go string literal, including the quotes. For instance, `foo "bar"` would be converted to `"foo \"bar\""`. strconv.Quote escapes backslashes, newlines and other control characters too, so untrusted spec text cannot break out of th
(in string)
| 910 | // strconv.Quote escapes backslashes, newlines and other control characters too, |
| 911 | // so untrusted spec text cannot break out of the generated string literal. |
| 912 | func StringToGoString(in string) string { |
| 913 | return strconv.Quote(in) |
| 914 | } |
| 915 | |
| 916 | // StringToGoComment renders a possible multi-line string as a valid Go-Comment. |
| 917 | // Each line is prefixed as a comment. |
no outgoing calls