Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit cd1e0dc

Browse files
committed
cleanup
1 parent 8aac898 commit cd1e0dc

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

records/generator.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,11 @@ func (rg *RecordGenerator) loadWrap(ip, port string) (state.State, error) {
293293
}
294294
if rip != ip {
295295
logging.VeryVerbose.Println("Warning: master changed to " + ip)
296-
sj, err = rg.loadFromMaster(rip, port)
297-
return sj, err
296+
return rg.loadFromMaster(rip, port)
298297
}
299298
return sj, nil
300299
}
301-
msg := "Fetched state.json does not contain leader information"
302-
err = errors.New(msg)
300+
err = errors.New("Fetched state.json does not contain leader information")
303301
return sj, err
304302
}
305303

@@ -668,11 +666,11 @@ func leaderIP(leader string) (string, error) {
668666
return "", errors.New("Invalid leader address: " + leader)
669667
}
670668
hostPort := nameAddressPair[1]
671-
hostPortPair := strings.Split(hostPort, ":")
672-
if len(hostPortPair) != 2 {
673-
return "", errors.New("Invalid leader address: " + leader)
669+
host, _, err := net.SplitHostPort(hostPort)
670+
if err != nil {
671+
return "", err
674672
}
675-
return hostPortPair[0], nil
673+
return host, nil
676674
}
677675

678676
// return the slave number from a Mesos slave id

0 commit comments

Comments
 (0)