From 68a495f144603e0268ca2016fa61f63654254617 Mon Sep 17 00:00:00 2001 From: Craig Peterson Date: Thu, 19 Oct 2017 10:27:10 -0400 Subject: [PATCH] actually return error on redeclaration --- caddyfile/parse.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/caddyfile/parse.go b/caddyfile/parse.go index c0ec2d4cd..3b06e8b88 100644 --- a/caddyfile/parse.go +++ b/caddyfile/parse.go @@ -100,10 +100,9 @@ func (p *parser) begin() error { if p.definedMacros == nil { p.definedMacros = map[string][]Token{} } - if p.definedMacros[name] != nil { - p.Errf("redeclaration of previously declared macro %s", name) + if _, found := p.definedMacros[name]; found { + return p.Errf("redeclaration of previously declared macro %s", name) } - // consume all tokens til matched close brace tokens, err := p.macroTokens() if err != nil {