fix: change swap_size to pointer type and update related logic#418
fix: change swap_size to pointer type and update related logic#418zliang-akamai wants to merge 4 commits intodevfrom
Conversation
|
Isn't that a breaking change? |
There was a problem hiding this comment.
Pull request overview
Updates the Linode builder config so swap_size can be omitted from the Linode API request payload when not configured, aligning request behavior with optional configuration semantics.
Changes:
- Changed
Config.SwapSizefromintto*intto distinguish “unset” vs “set to 0”. - Updated instance creation to pass
SwapSizethrough as a pointer (allowing omission when nil). - Added unit tests and updated generated docs to reflect the new optional/pointer behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| builder/linode/step_create_linode.go | Passes swap size as a pointer so it can be omitted when unset. |
| builder/linode/config.go | Changes swap_size to *int and updates validation logic to handle nil safely. |
| builder/linode/builder_test.go | Adds tests for swap_size omitted vs explicitly set to 0. |
| .web-docs/components/builder/linode/README.md | Updates generated docs type display for swap_size. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `linode/debian13`, `linode/ubuntu24.04`, `linode/arch`, and `private/12345`. | ||
|
|
||
| - `swap_size` (int) - The disk size (MiB) allocated for swap space. | ||
| - `swap_size` (\*int) - The disk size (MiB) allocated for swap space. |
There was a problem hiding this comment.
The docs now show swap_size as (*int), which is a Go implementation detail and doesn’t reflect how users configure this field in Packer templates (they provide a number, not a pointer). Consider keeping the rendered type as int (and optionally adding a note that omitting swap_size will omit it from the API payload) so the documentation remains user-focused and consistent with the rest of the top-level config fields.
| - `swap_size` (\*int) - The disk size (MiB) allocated for swap space. | |
| - `swap_size` (int) - The disk size (MiB) allocated for swap space. If omitted, no swap size is sent in the API payload. |
📝 Description
When swap_size is not configured, we should not include it in the request payload. Update it to be a pointer type to achieve it.
✔️ How to Test