From cf49ad2f63fdce6ed76c742274986f4bd972767c Mon Sep 17 00:00:00 2001 From: davidnewhall2 Date: Mon, 15 Jun 2020 02:20:48 -0700 Subject: [PATCH] whoops --- integrations/inputunifi/collector.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/integrations/inputunifi/collector.go b/integrations/inputunifi/collector.go index 113fe0fa..c6d89e5d 100644 --- a/integrations/inputunifi/collector.go +++ b/integrations/inputunifi/collector.go @@ -22,14 +22,13 @@ func (u *InputUnifi) isNill(c *Controller) bool { return c.Unifi == nil } -// newDynamicCntrlr creates and saves a controller (with auth cookie) for repeated use. +// newDynamicCntrlr creates and saves a controller definition for further use. // This is called when an unconfigured controller is requested. func (u *InputUnifi) newDynamicCntrlr(url string) (bool, *Controller) { u.Lock() defer u.Unlock() - c := u.dynamic[url] - if c != nil { + if c := u.dynamic[url]; c != nil { // it already exists. return false, c } @@ -39,7 +38,7 @@ func (u *InputUnifi) newDynamicCntrlr(url string) (bool, *Controller) { u.dynamic[url].Role = url u.dynamic[url].URL = url - return true, c + return true, u.dynamic[url] } func (u *InputUnifi) dynamicController(url string) (*poller.Metrics, error) {