Skip to content

TPT-4467: Change []*T to []T in all structs#972

Merged
zliang-akamai merged 1 commit into
linode:proj/linodego_v2from
zliang-akamai:zhiwei/slice-of-struct-pointer-to-slice-of-struct-value
May 20, 2026
Merged

TPT-4467: Change []*T to []T in all structs#972
zliang-akamai merged 1 commit into
linode:proj/linodego_v2from
zliang-akamai:zhiwei/slice-of-struct-pointer-to-slice-of-struct-value

Conversation

@zliang-akamai
Copy link
Copy Markdown
Member

📝 Description

Simplify things by changing all []*T to []T

✔️ How to Test

make test-int

Copilot AI review requested due to automatic review settings May 20, 2026 18:26
@zliang-akamai zliang-akamai requested review from a team as code owners May 20, 2026 18:26
@zliang-akamai zliang-akamai requested review from lgarber-akamai and mawilk90 and removed request for a team May 20, 2026 18:26
@zliang-akamai zliang-akamai changed the title Change []*T to []T in all structs TPT-4467: Change []*T to []T in all structs May 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to simplify the Linodego public API models by replacing slice-of-pointers fields ([]*T) with slice-of-values ([]T) across several structs and updating tests/fixtures accordingly.

Changes:

  • Updated multiple SDK structs to use []T instead of []*T (e.g., Instance.IPv4, instance backup snapshot collections, instance IP collections, NodeBalancer create config list).
  • Updated unit/integration tests to account for value slices (dereferencing returned pointers before appending/assigning).
  • Refreshed a number of integration VCR fixtures.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
nodebalancer.go Changes NodeBalancer create options configs from []*... to []... and adjusts JSON tags.
instances.go Changes Instance.IPv4 from []*net.IP to []net.IP.
instance_snapshots.go Changes backup snapshot collections from pointer slices to value slices (including Disks).
instance_ips.go Changes several IP address collections from pointer slices to value slices.
test/unit/nodebalancers_test.go Updates unit test to pass config create options as values rather than pointers.
test/integration/waitfor_test.go Updates integration test to store created disks as values rather than pointers.
test/integration/vlans_test.go Updates integration test to store created instances as values rather than pointers.
test/integration/fixtures/TestVLANs_GetIPAMAddress.yaml Updates fixture recording for VLAN IPAM test flow (currently includes a failing instance-create interaction).
test/integration/fixtures/TestPayment_GetMissing.yaml Updates headers/metadata in the recorded 404 payment fixture.
test/integration/fixtures/TestPayment_GetFound.yaml Updates recorded payments list response (currently recorded as empty).
test/integration/fixtures/TestOAuthClients_Reset.yaml Updates OAuth client reset-secret fixture recordings (IDs/timestamps/headers).
test/integration/fixtures/TestOAuthClients_List.yaml Updates OAuth client list fixture recordings (IDs/timestamps/headers/body).
test/integration/fixtures/TestOAuthClient_GetMissing.yaml Updates missing OAuth client fixture headers/metadata.
test/integration/fixtures/TestOAuthClient_GetFound.yaml Updates found OAuth client fixture recordings (IDs/timestamps/headers).
test/integration/fixtures/TestAccountNotifications_List.yaml Updates account notifications list fixture headers/metadata.
test/integration/fixtures/TestAccountMaintenances_List.yaml Updates account maintenances list fixture headers/metadata.
test/integration/fixtures/TestAccountLogins_List.yaml Updates account logins list fixture recordings (body expanded/updated).
test/integration/fixtures/TestAccountEvents_List.yaml Updates account events list fixture recordings (body expanded/updated).
test/integration/fixtures/TestAccountBetaPrograms.yaml Updates beta programs fixture (now recorded as empty list).
test/integration/fixtures/TestAccountAvailability_List.yaml Updates account availability list fixture recordings (body expanded/updated).
test/integration/fixtures/TestAccountAvailability_Get.yaml Updates account availability get fixture headers/metadata.
test/integration/fixtures/TestAccountAgreements_List.yaml Updates account agreements fixture response payload/headers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread nodebalancer.go Outdated
Comment thread test/integration/fixtures/TestVLANs_GetIPAMAddress.yaml Outdated
Comment thread test/integration/fixtures/TestPayment_GetFound.yaml
@zliang-akamai zliang-akamai force-pushed the zhiwei/slice-of-struct-pointer-to-slice-of-struct-value branch from a8a2a16 to 269db80 Compare May 20, 2026 18:41
@zliang-akamai zliang-akamai force-pushed the zhiwei/slice-of-struct-pointer-to-slice-of-struct-value branch from 269db80 to 23be1f0 Compare May 20, 2026 18:46
Copy link
Copy Markdown
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Seems to work well in my testing, nice work!

@zliang-akamai zliang-akamai merged commit 9faa4d3 into linode:proj/linodego_v2 May 20, 2026
8 of 10 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/slice-of-struct-pointer-to-slice-of-struct-value branch May 20, 2026 21:17
zliang-akamai added a commit that referenced this pull request May 27, 2026
* TPT-4423: Drop resty as a dependency (#938)

* Ported resty removal changes to new branch from up-to-date main and made additional changes to monitor client

* Fixed lint

* Updated log formatting to more closely resemble Resty's

* Fixed lint

* redact request header log

* Fixes

* Fixed CoPilot suggestions

* Sanitize log output

* Addressed CoPilot comments

---------

Co-authored-by: Zhiwei Liang <zliang@akamai.com>

* TPT-4421: Remove deprecated fields and methods (#946)

* Removed deprecated fields and methods and updated tests

* Fix lint

* Addressed copilot suggestion

* Fixed lint

* Removed V2 suffix from various fields and methods

* Addressed CoPilot suggestions

* Added separate struct for Instance IP Address update options

* Address PR suggestions

* TPT-4414: Refactor JSON tags to use "omitzero" for optional fields across multiple files (#947)

* Refactor JSON struct tags to use "omitzero" for optional fields

* Remove url tags in pagination structs

* TPT-4414: Change slice pointer types with `omitzero` to be slice (#954)

* Refactor: Change pointer slices to slices for various fields with omitzero

* Refresh fixtures

* Update TestLKECluster_Update to remove pinned lke versions in test

* TPT-4434: Added custom type for Region Capabilities and updated tests (#953)

* Added custom type for Region Capabilities and updated tests

* Fix formatting

* Added disctinction between Object Storage Bucket Access POST/PUT endpoints (#951)

* TPT-3454: Refactor wait functions to use context for timeouts and polling (#964)

* Refactor wait functions to use context for timeouts and polling

* fix context cancelled in cleanup

* nolint generic return type

* Fix grammar

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Make preTask a private function; cleanup unnecessary previousEvents allocation

* Fix error msg format

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* TPT-4422: Added options structs for POST/PUT endpoints that were missing them (#968)

* Added options structs for POST/PUT endpoints that were missing them

* Address PR comments

* Address PR comments

* TPT-3483: Update NewClient method to return an error rather than just logging errors (#967)

* refactor: update NewClient and related functions to handle errors properly

* refactor: update SetRootCertificate to return errors and enhance logging

* update NewClient instantiation to handle errors

* Export PaginatedResponse type in request_helpers (#970)

* TPT-3388: Separated GET and POST/PUT options structs where needed (#969)

* Separated GET and POST/PUT options structs where needed

* Separated additional structs that were reused for options and response

* More struct fixes

* Fix lint

* Rename FirewallRule structs

* integration test fixes

* Addressed PR comments

* FirewallRuleSetRule options; test updates; fixture refreshed

* Address more PR comments

---------

Co-authored-by: Zhiwei Liang <zliang@akamai.com>

* TPT-4464: Update FirewallDeviceEntity Label field to be a pointer (#971)

* Update FirewallDeviceEntity Label field to be a pointer and adjust tests accordingly

* Fix unit tests

* fmt

* Fix another unit test

* Change `[]*T` to `[]T` in all structs (#972)

* Remove LKE cluster dashboard function, tests, and related fixture (#975)

* Simplify client.go (#976)

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>

* Apply suggestion from @zliang-akamai

* Update region capability in TestImageSharing_Suite to use Linodes

---------

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Co-authored-by: Erik Zilber <ezilber@akamai.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Zhiwei Liang <zhiwei.liang@zliang.me>
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.

4 participants