summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-01 10:23:07 -0500
committerJeff Carr <[email protected]>2024-11-01 10:23:07 -0500
commitd8c3744f20cd2da3b259390c68fa7e651d63b617 (patch)
tree601a73c2c2d4922a4ab7fbca37777d538450891d
parent1a72fdceef64e6cba22db71e3383e85a112862dc (diff)
virtigod compiles again
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--config.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/config.go b/config.go
index c042b80..d583695 100644
--- a/config.go
+++ b/config.go
@@ -23,21 +23,24 @@ func (c *NewCluster) ConfigSave() error {
}
// make a new droplets struct
- var d *Droplets
- d = new(Droplets)
- // copy all the records over to the new struct
- for _, drop := range c.d.Droplets {
- d.Droplets = append(d.Droplets, drop)
+ var dcopy *Droplets
+ dcopy = new(Droplets)
+ loop := c.DropletsAll() // get the list of droplets
+ for loop.Scan() {
+ d := loop.Droplet()
+ var newd Droplet
+ newd = *d
+ dcopy.Droplets = append(dcopy.Droplets, &newd)
}
// delete all the Current data so it's not put in the config file
- for _, drop := range d.Droplets {
+ for _, drop := range dcopy.Droplets {
drop.Current = nil
}
- if err := ConfigWriteJSON(d, "droplets.json"); err != nil {
+ if err := ConfigWriteJSON(dcopy, "droplets.json"); err != nil {
fmt.Println("droplets.json write failed")
return err
}
- if err := ConfigWriteTEXT(d, "droplets.text"); err != nil {
+ if err := ConfigWriteTEXT(dcopy, "droplets.text"); err != nil {
fmt.Println("droplets.json write failed")
return err
}