summaryrefslogtreecommitdiff
path: root/dump.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-29 22:55:28 -0500
committerJeff Carr <[email protected]>2024-10-29 22:55:28 -0500
commitc8a69bdb73fedb7bd7afd05318021e487b47bd17 (patch)
tree5b33f4453f095287e66384af55133da4cca45380 /dump.go
parent9d08114b9339e9be06c11040432790682e389de3 (diff)
code and debugging cleanups
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'dump.go')
-rw-r--r--dump.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/dump.go b/dump.go
index d481438..e8522d5 100644
--- a/dump.go
+++ b/dump.go
@@ -36,7 +36,9 @@ func dumpDroplets(w http.ResponseWriter, full bool) {
for _, n := range d.Networks {
macs = append(macs, n.Mac)
}
- arp := strings.Join(macs, " ")
+
+ // this line in golang could replace 80 lines of COBOL
+ header := fmt.Sprintf("%3d %20s %3s %8s", i, strings.Join(macs, " "), d.CurrentState, d.CurrentHypervisor)
var filenames string
for _, disk := range d.Disks {
@@ -44,15 +46,15 @@ func dumpDroplets(w http.ResponseWriter, full bool) {
}
if d.CurrentState == pb.DropletState_ON {
- fmt.Fprintln(w, i, "droplet:", arp, d.Hostname, d.StartState, d.CurrentState, d.CurrentHypervisor)
+ fmt.Fprintln(w, header, d.Hostname)
continue
}
if d.StartState == pb.DropletState_ON {
- fmt.Fprintln(w, i, "droplet:", arp, d.Hostname, d.StartState, d.CurrentState, "(should be on)")
+ fmt.Fprintln(w, header, d.Hostname, "(should be on)")
continue
}
if full {
- fmt.Fprintln(w, i, "droplet:", arp, d.Hostname, d.StartState, d.CurrentState, filenames)
+ fmt.Fprintln(w, header, d.Hostname, filenames)
}
}
}