diff options
Diffstat (limited to 'go/topology/configuration.go')
| -rw-r--r-- | go/topology/configuration.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/go/topology/configuration.go b/go/topology/configuration.go index 058600a7c..ffcebb59c 100644 --- a/go/topology/configuration.go +++ b/go/topology/configuration.go @@ -47,19 +47,19 @@ func (c *Configuration) String() string { } func (c *Configuration) Locate(ip string, dcName string, rackName string) (dc string, rack string) { - if dcName == "" { - if c != nil && c.ip2location != nil { - if loc, ok := c.ip2location[ip]; ok { - return loc.dcName, loc.rackName - } - } - } else { - if rackName == "" { - return dcName, "DefaultRack" - } else { - return dcName, rackName + if c != nil && c.ip2location != nil { + if loc, ok := c.ip2location[ip]; ok { + return loc.dcName, loc.rackName } } - return "DefaultDataCenter", "DefaultRack" + if dcName == "" { + dcName = "DefaultDataCenter" + } + + if rackName == "" { + rackName = "DefaultRack" + } + + return dcName, rackName } |
