Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 452 Bytes

string-escape.md

File metadata and controls

23 lines (17 loc) · 452 Bytes

Use Raw String Literals to Avoid Escaping

Go supports raw string literals, which can span multiple lines and include quotes. Use these to avoid hand-escaped strings which are much harder to read.

BadGood
wantError := "unknown name:\"test\""
wantError := `unknown error:"test"`