mirror of
https://github.com/luthermonson/go-proxmox.git
synced 2026-04-26 17:35:48 +03:00
[GH-ISSUE #241] Inconsitent data when marshalling and unmarshalling Storage to json #62
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/go-proxmox#62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aeber on GitHub (Feb 12, 2026).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/241
I think i stumbled uppon some strange behaviour when using the latest version of go-proxmox.
I was trying to run the test suite from https://github.com/ionos-cloud/cluster-api-provider-proxmox against the
mainbranch of go-proxmox and encountered some tests whereStorage.Namesomehow was set to"".Digging a bit deeper i found that the
Storagestruct has two fields that map to the same JSON key (case-insensitively):When this struct is marshalled and unmarshalled the aux structs
Namefield in L1081 matches bothstorageandStorage.And if the initial
Storagestruct looks likethe json marshaller will make this:
and the custom unmarshaller will then transform it back to a
Storagestruct. But then theNamefield is missing as apparently theStoragefield in the json overrides whatever is in thestoragefield (lower-case) in the json.I'm not quite sure how to continue from here. Of course all the tests in cluster-api-provider-proxmox could be rewritten to also contain a
Storagefield with the same value as theNamefield. But this duplication feels wrong.Thinking on this some more the
Storage.Storagefield actually looks quite redundant. Except for some tests all the code seems to useStorage.Name.So maybe this field can be removed? As this field is an exported field this would be a breaking change.
Another option could be to omit this field when marshalling by changing it to
or adding a
Storagefield to the custom unmarshallersauxstruct.The issue was introduced by https://github.com/luthermonson/go-proxmox/pull/237 where the custom unmarshaller was added.
@luthermonson commented on GitHub (Feb 13, 2026):
Ugh, ya that's not good. I'll try and look at this tomorrow but I think you're spot on with the root cause
@aeber commented on GitHub (Feb 17, 2026):
Thanks!
If you have time to spare, a new release would be much appreciated.
@luthermonson commented on GitHub (Feb 18, 2026):
yup! lemme do that now