summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-22 16:42:14 -0500
committerJeff Carr <[email protected]>2024-10-22 16:42:14 -0500
commit3a224054680758aa1871706a98ccbcd94087b6e9 (patch)
tree122e3ec9c14f240409a820337795d0fbc6c10107
parentf2040886198b8f4a25ce1a9f65585097b299f9fa (diff)
compiles
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--droplet.proto7
-rw-r--r--helpers.go12
-rw-r--r--storageinfo.go4
3 files changed, 15 insertions, 8 deletions
diff --git a/droplet.proto b/droplet.proto
index 5af9db0..470d61c 100644
--- a/droplet.proto
+++ b/droplet.proto
@@ -31,7 +31,8 @@ message Droplet {
int64 size = 2;
}
- message StorageInfo {
- int64 capacity = 1; // Stores the storage capacity in bytes.
- }
+}
+
+message StorageInfo {
+ int64 capacity = 1; // Stores the storage capacity in bytes.
}
diff --git a/helpers.go b/helpers.go
index 4ffd13c..6660eb4 100644
--- a/helpers.go
+++ b/helpers.go
@@ -103,7 +103,17 @@ func (c *Cluster) AddDroplet(hostname string, cpus int, mem int) *Droplet {
d.Cpus = 1
}
d.Memory = SetGB(mem * 32)
- d.Testsi.Capacity = SetGB(mem * 32)
+ if d.Testsi == nil {
+ fmt.Println("Testsi is NIL")
+ fmt.Println("Testsi is NIL")
+ fmt.Println("Testsi is NIL")
+ fmt.Println("Testsi is NIL")
+ var newInfo StorageInfo
+ newInfo = StorageInfo{Capacity: 64}
+ d.Testsi = &newInfo
+ } else {
+ d.Testsi.Capacity = SetGB(mem * 32)
+ }
// d.Testsi = StorageInfo{Capacity: 64}
c.Droplets = append(c.Droplets, d)
return d
diff --git a/storageinfo.go b/storageinfo.go
index 9df42c2..993f5ef 100644
--- a/storageinfo.go
+++ b/storageinfo.go
@@ -6,10 +6,6 @@ import (
"strconv"
)
-type StorageInfo struct {
- Capacity int64
-}
-
// MarshalJSON custom marshals the StorageInfo struct to JSON
func (s StorageInfo) MarshalJSON() ([]byte, error) {
capacityStr := fmt.Sprintf("%d GB", s.Capacity)