From 9426f5ac84211f98db554c5447a491494b1bcf2a Mon Sep 17 00:00:00 2001 From: Tinyblargon <76069640+Tinyblargon@users.noreply.github.com> Date: Mon, 17 Jul 2023 14:42:13 +0000 Subject: [PATCH] fix: `Parent` should be of type `SnapshotName` --- proxmox/snapshot.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxmox/snapshot.go b/proxmox/snapshot.go index c570e0f4..35243947 100644 --- a/proxmox/snapshot.go +++ b/proxmox/snapshot.go @@ -95,7 +95,7 @@ type Snapshot struct { Description string `json:"description,omitempty"` VmState bool `json:"ram,omitempty"` Children []*Snapshot `json:"children,omitempty"` - Parent string `json:"parent,omitempty"` + Parent SnapshotName `json:"parent,omitempty"` } // Formats the taskResponse as a list of snapshots @@ -110,7 +110,7 @@ func (raw rawSnapshots) FormatSnapshotsList() (list []*Snapshot) { list[i].Name = SnapshotName(e.(map[string]interface{})["name"].(string)) } if _, isSet := e.(map[string]interface{})["parent"]; isSet { - list[i].Parent = e.(map[string]interface{})["parent"].(string) + list[i].Parent = SnapshotName(e.(map[string]interface{})["parent"].(string)) } if _, isSet := e.(map[string]interface{})["snaptime"]; isSet { list[i].SnapTime = uint(e.(map[string]interface{})["snaptime"].(float64)) @@ -127,7 +127,7 @@ func (raw rawSnapshots) FormatSnapshotsTree() (tree []*Snapshot) { list := raw.FormatSnapshotsList() for _, e := range list { for _, ee := range list { - if e.Parent == string(ee.Name) { + if e.Parent == ee.Name { ee.Children = append(ee.Children, e) break }