From 0ca125ff2c15a10e8d42bdc2c9f1cea459bcca83 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 10 Apr 2017 16:42:28 +0000 Subject: [PATCH] Extract 'HasMode' as method on ipamConfig --- prog/weaver/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/prog/weaver/main.go b/prog/weaver/main.go index 2be9e1ac..2e736b87 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -53,7 +53,7 @@ type dnsConfig struct { func (c *ipamConfig) Enabled() bool { var ( hasPeerCount = c.PeerCount > 0 - hasMode = len(c.Mode) > 0 + hasMode = c.HasMode() hasRange = c.IPRangeCIDR != "" hasSubnet = c.IPSubnetCIDR != "" ) @@ -75,6 +75,10 @@ func (c *ipamConfig) Enabled() bool { return true } +func (c ipamConfig) HasMode() bool { + return len(c.Mode) > 0 +} + func (c *ipamConfig) parseMode() error { modeAndParam := strings.SplitN(c.Mode, "=", 2)