From 4be19fb04a6f6df5852013c86213d1fba7c32d54 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Tue, 17 Nov 2015 17:57:29 -0700 Subject: [PATCH] Dont append to slices in mergeStruct --- agent.go | 2 ++ config.go | 11 ++++++----- plugins/apache/apache.go | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/agent.go b/agent.go index 47c2293cc30dc..a291eeccfe6e9 100644 --- a/agent.go +++ b/agent.go @@ -176,11 +176,13 @@ func (a *Agent) LoadPlugins(filters []string, config *Config) ([]string, error) var names []string for name, plugin := range config.PluginsDeclared() { + fmt.Println("Declared plugin: ", plugin) if sliceContains(name, filters) || len(filters) == 0 { config, err := config.ApplyPlugin(name, plugin) if err != nil { return nil, err } + fmt.Println("Applied plugin: ", plugin) a.plugins = append(a.plugins, &runningPlugin{name, plugin, config}) names = append(names, name) diff --git a/config.go b/config.go index 1181e109b3e56..02d157eaee395 100644 --- a/config.go +++ b/config.go @@ -405,11 +405,12 @@ func mergeStruct(base, overlay interface{}, fields []string) error { overlayValue.Type(), field) } baseFieldValue := findField(field, baseValue) - if overlayFieldValue.Kind() == reflect.Slice { - baseFieldValue.Set(reflect.AppendSlice(baseFieldValue, overlayFieldValue)) - } else { - baseFieldValue.Set(overlayFieldValue) - } + baseFieldValue.Set(overlayFieldValue) + // if overlayFieldValue.Kind() == reflect.Slice { + // baseFieldValue.Set(reflect.AppendSlice(baseFieldValue, overlayFieldValue)) + // } else { + // baseFieldValue.Set(overlayFieldValue) + // } } return nil } diff --git a/plugins/apache/apache.go b/plugins/apache/apache.go index 3cebecb22ecc4..b46e7ab7d71c1 100644 --- a/plugins/apache/apache.go +++ b/plugins/apache/apache.go @@ -34,6 +34,7 @@ func (n *Apache) Description() string { func (n *Apache) Gather(acc plugins.Accumulator) error { var wg sync.WaitGroup var outerr error + fmt.Println(n.Urls) for _, u := range n.Urls { addr, err := url.Parse(u)