Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1alpha2] Audit and improve integer types #402

Open
wikkyk opened this issue Feb 5, 2025 · 1 comment
Open

[v1alpha2] Audit and improve integer types #402

wikkyk opened this issue Feb 5, 2025 · 1 comment
Labels
api break Things that change the API enhancement New feature or request

Comments

@wikkyk
Copy link
Collaborator

wikkyk commented Feb 5, 2025

Describe the solution you'd like
We have a lot of fields which are unnecessarily signed, e.g. ProxmoxMachineSpec.MemoryMiB which break code like requestedMemory := uint64(machine.Spec.MemoryMiB) * 1024 * 1024 which golangci-lint now complains about (you cannot cast a signed int to an unsigned int safely).

Whilst we could just change the usages (only cast to signed ints), that does not help the issue because negative values are nonsensical here. We even have int32 fields annotated with Minimum=1.

Anything else you would like to add:
I don't want to change the casts to signed as such. We will forget about them and end up with silly casts: linters won't complain about casts from uint32 to int64.

@wikkyk wikkyk added api break Things that change the API enhancement New feature or request labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api break Things that change the API enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant