Skip to content

Commit

Permalink
remove direct pointer deref
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Jul 7, 2021
1 parent ef66122 commit 2f8637f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
5 changes: 1 addition & 4 deletions types/node_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ func (n *NodeDefinition) GetStartupConfig() string {
}

func (n *NodeDefinition) GetConfigDispatcher() *ConfigDispatcher {
if n == nil {
return nil
}
if n.Config == nil {
if n == nil || n.Config == nil {
return &ConfigDispatcher{}
}
return n.Config
Expand Down
16 changes: 8 additions & 8 deletions types/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@ func (t *Topology) GetNodeEnv(name string) map[string]string {
return utils.MergeStringMaps(
utils.MergeStringMaps(t.GetDefaults().GetEnv(),
t.GetKind(t.GetNodeKind(name)).GetEnv()),
ndef.Env)
ndef.GetEnv())
}
return nil
}

func (t *Topology) GetNodePublish(name string) []string {
if ndef, ok := t.Nodes[name]; ok {
if len(ndef.Publish) > 0 {
return ndef.Publish
if len(ndef.GetPublish()) > 0 {
return ndef.GetPublish()
}
if kdef, ok := t.Kinds[ndef.Kind]; ok && kdef != nil {
if len(kdef.Publish) > 0 {
return kdef.Publish
if kdef, ok := t.Kinds[ndef.GetKind()]; ok && kdef != nil {
if len(kdef.GetPublish()) > 0 {
return kdef.GetPublish()
}
}
return t.Defaults.Publish
return t.Defaults.GetPublish()
}
return nil
}
Expand All @@ -130,7 +130,7 @@ func (t *Topology) GetNodeLabels(name string) map[string]string {
return utils.MergeStringMaps(
utils.MergeStringMaps(t.Defaults.GetLabels(),
t.GetKind(t.GetNodeKind(name)).GetLabels()),
ndef.Labels)
ndef.GetLabels())
}
return nil
}
Expand Down

0 comments on commit 2f8637f

Please sign in to comment.