virtigod compiles again
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
1a72fdceef
commit
d8c3744f20
19
config.go
19
config.go
|
@ -23,21 +23,24 @@ func (c *NewCluster) ConfigSave() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// make a new droplets struct
|
// make a new droplets struct
|
||||||
var d *Droplets
|
var dcopy *Droplets
|
||||||
d = new(Droplets)
|
dcopy = new(Droplets)
|
||||||
// copy all the records over to the new struct
|
loop := c.DropletsAll() // get the list of droplets
|
||||||
for _, drop := range c.d.Droplets {
|
for loop.Scan() {
|
||||||
d.Droplets = append(d.Droplets, drop)
|
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
|
// 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
|
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")
|
fmt.Println("droplets.json write failed")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := ConfigWriteTEXT(d, "droplets.text"); err != nil {
|
if err := ConfigWriteTEXT(dcopy, "droplets.text"); err != nil {
|
||||||
fmt.Println("droplets.json write failed")
|
fmt.Println("droplets.json write failed")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue