plugin/template: fix formatting with go fmt (#5622)

Signed-off-by: Erik Johansson <ejohansson@spotify.com>

Signed-off-by: Erik Johansson <ejohansson@spotify.com>
This commit is contained in:
Erik Johansson 2022-09-15 12:48:38 -07:00 committed by GitHub
parent e93e932ce8
commit 0032be6a56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -151,10 +151,10 @@ func executeRRTemplate(server, view, section string, template *gotmpl.Template,
} }
func newTemplate(name, text string) (*gotmpl.Template, error) { func newTemplate(name, text string) (*gotmpl.Template, error) {
funcMap := gotmpl.FuncMap{ funcMap := gotmpl.FuncMap{
"parseInt": strconv.ParseUint, "parseInt": strconv.ParseUint,
} }
return gotmpl.New(name).Funcs(funcMap).Parse(text) return gotmpl.New(name).Funcs(funcMap).Parse(text)
} }
func (t template) match(ctx context.Context, state request.Request) (*templateData, bool, bool) { func (t template) match(ctx context.Context, state request.Request) (*templateData, bool, bool) {

View file

@ -284,7 +284,7 @@ func TestHandler(t *testing.T) {
qtype: dns.TypeANY, qtype: dns.TypeANY,
qname: "test.example.", qname: "test.example.",
expectedCode: dns.RcodeServerFailure, expectedCode: dns.RcodeServerFailure,
expectedErr: "template: answer:1:26: executing \"answer\" at <parseInt \"gg\" 16 8>: error calling parseInt: strconv.ParseUint: parsing \"gg\": invalid syntax", expectedErr: "template: answer:1:26: executing \"answer\" at <parseInt \"gg\" 16 8>: error calling parseInt: strconv.ParseUint: parsing \"gg\": invalid syntax",
verifyResponse: func(r *dns.Msg) error { verifyResponse: func(r *dns.Msg) error {
return nil return nil
}, },