From c8a69bdb73fedb7bd7afd05318021e487b47bd17 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 29 Oct 2024 22:55:28 -0500 Subject: code and debugging cleanups Signed-off-by: Jeff Carr --- dump.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dump.go') 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) } } } -- cgit v1.2.3