From 033d0d333e5c595285d2f3ad62c7a69f73ebefdd Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Sun, 12 Feb 2017 07:06:56 -0700 Subject: [PATCH] redundant condition --- controller/fence.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/controller/fence.go b/controller/fence.go index ebc2ecbd..22b5e2d9 100644 --- a/controller/fence.go +++ b/controller/fence.go @@ -192,14 +192,12 @@ func fenceMatch(hookName string, sw *scanWriter, fence *liveFenceSwitches, metas } } - msgs := make([][]byte, 0, 4) + var msgs [][]byte if fence.detect == nil || fence.detect[detect] { - if fence.detect == nil || fence.detect[detect] { - if len(res) > 0 && res[0] == '{' { - msgs = append(msgs, makemsg(details.command, group, detect, hookName, metas, details.key, details.timestamp, res[1:])) - } else { - msgs = append(msgs, res) - } + if len(res) > 0 && res[0] == '{' { + msgs = append(msgs, makemsg(details.command, group, detect, hookName, metas, details.key, details.timestamp, res[1:])) + } else { + msgs = append(msgs, res) } } switch detect {