diff --git a/tools/config/utils.go b/tools/config/utils.go index 4dcd2e479..ad35182b5 100644 --- a/tools/config/utils.go +++ b/tools/config/utils.go @@ -121,6 +121,7 @@ func StringLiteral(val string) (string, error) { case backslash: switch ch { case '\n': + state = normal case '\\': ans.WriteRune('\\') state = normal diff --git a/tools/config/utils_test.go b/tools/config/utils_test.go index 8e70dbfc3..4ce018f7c 100644 --- a/tools/config/utils_test.go +++ b/tools/config/utils_test.go @@ -18,6 +18,8 @@ func TestStringLiteralParsing(t *testing.T) { `abc`: `abc`, `a\nb\M`: "a\nb\\M", `a\x20\x1\u1234\123\12|`: "a \\x1\u1234\123\x0a|", + "a\\\nnb": "anb", + "a\\\n\\tb": "a\tb", } { actual, err := StringLiteral(q) if err != nil {