chore: use raw string () with regexp.MustCompile to avoid having to escape twice (#6396)

This commit is contained in:
guangwu 2023-11-11 06:16:47 +08:00 committed by GitHub
parent 997c7f9539
commit 8964fc2180
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,7 @@ func TestTruncatedCNAME(t *testing.T) {
handler := Handler{ handler := Handler{
Zones: []string{"."}, Zones: []string{"."},
Templates: []template{{ Templates: []template{{
regex: []*regexp.Regexp{regexp.MustCompile("^cname\\.test\\.$")}, regex: []*regexp.Regexp{regexp.MustCompile(`^cname\.test\.$`)},
answer: []*gotmpl.Template{gotmpl.Must(gotmpl.New("answer").Parse(up.Answer[0].String()))}, answer: []*gotmpl.Template{gotmpl.Must(gotmpl.New("answer").Parse(up.Answer[0].String()))},
qclass: dns.ClassINET, qclass: dns.ClassINET,
qtype: dns.TypeA, qtype: dns.TypeA,