mirror of
https://github.com/luthermonson/go-proxmox.git
synced 2026-04-26 17:35:48 +03:00
[GH-ISSUE #59] Use of StringOrUint/64 #10
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#10
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 @earentir on GitHub (May 6, 2023).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/59
Wouldn't it be easier to always convert to the Uint64 type ?
@luthermonson commented on GitHub (May 8, 2023):
welp you would think so... but the API was returning 1234 and "1234" and interchanged them a lot so I opted for this method so you know what you were getting and normalized the proxmox api in the client. I'm open for other suggestions....
@earentir commented on GitHub (May 8, 2023):
I have seen the API making funny replies but I assume on most fields it would always be an int type, maybe just force the output per case ? if an int is expected then check before and cast as int etc.
@luthermonson commented on GitHub (May 8, 2023):
that's what this does. this makes it so you dont have to make a custom unmarshaller for each type with a Uint64 that might accidently send a string but instead one unmarshaller for a StringOrUint64 takes care of your problem. When I wrote it at the time I couldn't think of anything better and thinking again about it... i can't think of anything better :/