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

fix: upgrade hcloud-go to v2 #1062

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

fix: upgrade hcloud-go to v2 #1062

wants to merge 13 commits into from

Conversation

jooola
Copy link
Member

@jooola jooola commented Dec 23, 2024

Attempt to migrate the hcloud-go library to v2, to be able to finally drop the v1 version.

We previously discussed of not going this route, but the effort of porting new features in both hcloud-go versions is bigger than upgrade the library in the terrafrom plugin.

If this change ends up being impossible to test and too dangerous, we will just continue the route we initially choose: migrating for to the plugin framework then the hcloud-go library.

Fix #877

@jooola jooola requested a review from a team as a code owner December 23, 2024 15:52
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

Attention: Patch coverage is 89.06883% with 27 lines in your changes missing coverage. Please review.

Project coverage is 66.41%. Comparing base (c844932) to head (6b1a1de).

Files with missing lines Patch % Lines
internal/util/sdk.go 47.05% 8 Missing and 1 partial ⚠️
internal/util/id.go 63.63% 7 Missing and 1 partial ⚠️
hcloud/plugin_provider.go 0.00% 2 Missing ⚠️
internal/loadbalancer/resource_target.go 81.81% 2 Missing ⚠️
internal/primaryip/resource.go 84.61% 2 Missing ⚠️
hcloud/provider.go 50.00% 1 Missing ⚠️
internal/firewall/resource.go 83.33% 1 Missing ⚠️
internal/floatingip/resource.go 85.71% 1 Missing ⚠️
internal/network/resource_subnet.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1062      +/-   ##
==========================================
- Coverage   66.53%   66.41%   -0.13%     
==========================================
  Files          67       69       +2     
  Lines        9947     9920      -27     
==========================================
- Hits         6618     6588      -30     
- Misses       2614     2618       +4     
+ Partials      715      714       -1     
Flag Coverage Δ
e2e 66.41% <89.06%> (-0.13%) ⬇️
unit 30.87% <10.93%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jooola jooola force-pushed the upgrade-hcloud-go-v2 branch 2 times, most recently from 20a339d to 73b3094 Compare January 9, 2025 20:35
@jooola jooola changed the base branch from main to chore-update-golanci-lint-config January 9, 2025 23:40
Base automatically changed from chore-update-golanci-lint-config to main January 10, 2025 09:10
@jooola jooola force-pushed the upgrade-hcloud-go-v2 branch 2 times, most recently from 820d07c to 1699bef Compare January 10, 2025 15:04
@jooola jooola force-pushed the upgrade-hcloud-go-v2 branch from 0551552 to 3f36288 Compare January 20, 2025 14:44
Copy link
Member

@apricote apricote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through it I am hopeful for the future of hcloud-go!

I am a bit worried about the naked int() castings to downcast for terraform on 32 bit platforms. Go just does it, resulting in bad data. What do you think about adding a reverse function that converts from int64 to int on 64-bit platforms, and errors on 32-bit platforms?

internal/util/resourceutil/id.go Show resolved Hide resolved
internal/util/id.go Outdated Show resolved Hide resolved
internal/util/id.go Outdated Show resolved Hide resolved
@jooola jooola force-pushed the upgrade-hcloud-go-v2 branch from 53c7d44 to 6b1a1de Compare January 21, 2025 16:46
@jooola
Copy link
Member Author

jooola commented Jan 21, 2025

I am a bit worried about the naked int() castings to downcast for terraform on 32 bit platforms. Go just does it, resulting in bad data. What do you think about adding a reverse function that converts from int64 to int on 64-bit platforms, and errors on 32-bit platforms?

Yup, that's a sensible idea. I addressed your review comments and implement this for the relevant casts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Update to hcloud-go v2
2 participants