diff --git a/control/plugin/cpolicy/tree.go b/control/plugin/cpolicy/tree.go index ca925400d..a02bce80c 100644 --- a/control/plugin/cpolicy/tree.go +++ b/control/plugin/cpolicy/tree.go @@ -140,8 +140,8 @@ func (c *ConfigPolicy) Get(ns []string) *ConfigPolicyNode { } type keyNode struct { - Key []string - Node *ConfigPolicyNode + Key []string + *ConfigPolicyNode } func (c *ConfigPolicy) GetAll() []keyNode { @@ -149,9 +149,9 @@ func (c *ConfigPolicy) GetAll() []keyNode { ret := make([]keyNode, 0) for _, node := range c.config.GetAll() { key := node.Key - switch t := node.N.(type) { + switch t := node.Node.(type) { case *ConfigPolicyNode: - ret = append(ret, keyNode{Key: key, Node: t}) + ret = append(ret, keyNode{Key: key, ConfigPolicyNode: t}) } } return ret diff --git a/control/plugin/rpc/plugin.go b/control/plugin/rpc/plugin.go index ba33bbc96..ccf41be0e 100644 --- a/control/plugin/rpc/plugin.go +++ b/control/plugin/rpc/plugin.go @@ -27,7 +27,7 @@ func NewGetConfigPolicyReply(policy *cpolicy.ConfigPolicy) (*GetConfigPolicyRepl for _, node := range policy.GetAll() { key := strings.Join(node.Key, ".") - for _, rule := range node.Node.RulesAsTable() { + for _, rule := range node.RulesAsTable() { switch rule.Type { case cpolicy.BoolType: r := &BoolRule{ diff --git a/control/plugin_manager.go b/control/plugin_manager.go index 1ec6092d3..4dcb704af 100644 --- a/control/plugin_manager.go +++ b/control/plugin_manager.go @@ -362,8 +362,7 @@ func (p *pluginManager) LoadPlugin(details *pluginDetails, emitter gomit.Emitter if lPlugin.ConfigPolicy != nil { // Get plugin config defaults defaults := cdata.NewNode() - for _, kn := range lPlugin.ConfigPolicy.GetAll() { - cpolicy := kn.Node + for _, cpolicy := range lPlugin.ConfigPolicy.GetAll() { _, errs := cpolicy.AddDefaults(defaults.Table()) if len(errs.Errors()) > 0 { for _, err := range errs.Errors() { diff --git a/pkg/ctree/tree.go b/pkg/ctree/tree.go index 94e9c7b14..fbd9372d3 100644 --- a/pkg/ctree/tree.go +++ b/pkg/ctree/tree.go @@ -116,7 +116,7 @@ func (c *ConfigTree) Add(ns []string, inNode Node) { type keyNode struct { Key []string - N Node + Node } func (c *ConfigTree) GetAll() []keyNode { @@ -137,8 +137,8 @@ func (c *ConfigTree) getAll(node *node, key []string, res *[]keyNode) []keyNode } if node.Node != nil { k := keyNode{ - Key: key, - N: node.Node, + Key: key, + Node: node.Node, } *res = append(*res, k) }