From 8797ca2d505bf19c45232f766f9e4b6741847360 Mon Sep 17 00:00:00 2001 From: Guillaume Giamarchi Date: Fri, 12 Dec 2014 01:44:34 +0100 Subject: [PATCH] Rename HostState struct to HostListItem Signed-off-by: Guillaume Giamarchi --- commands.go | 8 ++++---- host.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/commands.go b/commands.go index 3a62e1fa10..d9a21d3e8e 100644 --- a/commands.go +++ b/commands.go @@ -116,7 +116,7 @@ func (cli *DockerCli) CmdLs(args ...string) error { wg := sync.WaitGroup{} - hostStateList := []HostState{} + hostListItem := []HostListItem{} for _, host := range hostList { host := host @@ -145,7 +145,7 @@ func (cli *DockerCli) CmdLs(args ...string) error { host.Name, err) } - hostStateList = append(hostStateList, HostState{ + hostListItem = append(hostListItem, HostListItem{ Name: host.Name, Active: isActive, DriverName: host.Driver.DriverName(), @@ -160,9 +160,9 @@ func (cli *DockerCli) CmdLs(args ...string) error { wg.Wait() - sort.Sort(HostStateByName(hostStateList)) + sort.Sort(HostListItemByName(hostListItem)) - for _, hostState := range hostStateList { + for _, hostState := range hostListItem { activeString := "" if hostState.Active { activeString = "*" diff --git a/host.go b/host.go index a5356c6aa6..03adb808fc 100644 --- a/host.go +++ b/host.go @@ -26,7 +26,7 @@ type Host struct { storePath string } -type HostState struct { +type HostListItem struct { Name string Active bool DriverName string @@ -34,17 +34,17 @@ type HostState struct { URL string } -type HostStateByName []HostState +type HostListItemByName []HostListItem -func (h HostStateByName) Len() int { +func (h HostListItemByName) Len() int { return len(h) } -func (h HostStateByName) Swap(i, j int) { +func (h HostListItemByName) Swap(i, j int) { h[i], h[j] = h[j], h[i] } -func (h HostStateByName) Less(i, j int) bool { +func (h HostListItemByName) Less(i, j int) bool { return strings.ToLower(h[i].Name) < strings.ToLower(h[j].Name) }