summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-31 13:12:11 -0500
committerJeff Carr <[email protected]>2024-10-31 13:12:11 -0500
commite8834578fbecc48b133e6550829de4766bc309a8 (patch)
tree87c812f1e056debab780b2c8b83d46a62b3eda2f
parent10793e365d594e98bbc8e04251cfbc6b6b3ddbea (diff)
example runs
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--example/main.go2
-rw-r--r--helpers.go9
-rw-r--r--scanIterator.go2
3 files changed, 11 insertions, 2 deletions
diff --git a/example/main.go b/example/main.go
index 8327628..4554af3 100644
--- a/example/main.go
+++ b/example/main.go
@@ -22,7 +22,7 @@ func main() {
}
var c *pb.NewCluster
- c = new(pb.NewCluster)
+ c = pb.InitCluster()
// log.Println(aCluster.String())
// show the droplets to STDOUT
diff --git a/helpers.go b/helpers.go
index 72d4008..0ecbb64 100644
--- a/helpers.go
+++ b/helpers.go
@@ -9,6 +9,15 @@ import (
"google.golang.org/protobuf/proto"
)
+func InitCluster() *NewCluster {
+ var c *NewCluster
+ c = new(NewCluster)
+ c.d = new(Droplets)
+ c.h = new(Hypervisors)
+ c.e = new(Events)
+ return c
+}
+
// human readable JSON
func (d *Droplets) FormatJSON() string {
return protojson.Format(d)
diff --git a/scanIterator.go b/scanIterator.go
index 3bbaeef..7d3af13 100644
--- a/scanIterator.go
+++ b/scanIterator.go
@@ -71,7 +71,7 @@ func (c *NewCluster) SelectDropletAll() []*Droplet {
var dropletPointers []*Droplet
if c.d == nil {
log.Info("SelectDropletsAll() c.d == nil")
- os.Exit(-1)
+ // os.Exit(-1)
}
for _, d := range c.d.Droplets {
if d == nil {