Skip to content

TPT-4423: Drop resty as a dependency#938

Open
ezilber-akamai wants to merge 9 commits intolinode:proj/linodego_v2from
ezilber-akamai:TPT-4423-drop-resty
Open

TPT-4423: Drop resty as a dependency#938
ezilber-akamai wants to merge 9 commits intolinode:proj/linodego_v2from
ezilber-akamai:TPT-4423-drop-resty

Conversation

@ezilber-akamai
Copy link
Copy Markdown
Contributor

📝 Description

Ported the old resty removal code from outdated linodego_v2 branch to the new up-to-date one.

✔️ How to Test

make test-unit
make test-int

@ezilber-akamai ezilber-akamai added the breaking-change for breaking changes in the changelog. label Apr 21, 2026
Comment thread client.go Fixed
Comment thread client.go Fixed
@ezilber-akamai ezilber-akamai force-pushed the TPT-4423-drop-resty branch 7 times, most recently from cab2905 to 1cd0216 Compare April 21, 2026 19:17
Comment thread client.go Fixed
@ezilber-akamai ezilber-akamai marked this pull request as ready for review April 22, 2026 15:13
@ezilber-akamai ezilber-akamai requested review from a team as code owners April 22, 2026 15:13
@ezilber-akamai ezilber-akamai requested review from Copilot, mawilk90 and yec-akamai and removed request for a team April 22, 2026 15:13
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

Removes the resty dependency by migrating the LinodeGo client stack (request execution, retries, pagination, logging, and related tests) to net/http, and updates fixtures/tests accordingly.

Changes:

  • Replaces Resty-based request/retry/pagination/logging helpers with net/http equivalents.
  • Updates unit/integration tests and fixtures to match new request shapes (e.g., explicit page=1).
  • Drops resty from root/k8s/test modules and removes now-obsolete retries_http* code.

Reviewed changes

Copilot reviewed 28 out of 31 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
client.go Reworks core client to use net/http, adds retry plumbing, request/response logging via embedded templates.
client_http.go Removes old httpClient wrapper type.
client_monitor.go Migrates Monitor client from Resty to net/http + new request helper.
errors.go Replaces Resty error handling with http.Response-based parsing/formatting.
errors_test.go Updates error tests for new http.Response error path.
retries.go Ports retry conditionals and Retry-After handling to net/http.
retries_test.go Updates retry tests to build http.Response objects directly.
retries_http.go Removes unused/obsolete HTTP retry implementation.
retries_http_test.go Removes tests for the deleted retries_http.go.
pagination.go Changes list options application to an *http.Request mutator.
request_helpers.go Migrates generic request helpers and pagination execution to client.doRequest.
request_helpers_test.go Adjusts request helper tests to new request behavior.
logger.go Introduces internal Logger interface and removes “RESTY” prefixes.
request_log_template.tmpl Adds request log template used by embedded logging.
response_log_template.tmpl Adds response log template used by embedded logging.
images.go Replaces Resty upload-to-URL logic with raw net/http PUT.
test/unit/images_test.go Adds default-transport httpmock activation for upload-to-URL PUT mock.
monitor_api_services.go Migrates monitor metrics request to net/http request params.
monitor_alert_definitions.go Migrates alert definition create flow to net/http + per-request headers.
test/integration/maintenance_test.go Switches integration test to ListMaintenancePolicies API call.
test/integration/fixtures/TestMaintenancePolicies_List.yaml Updates recorded interaction (adds ?page=1, header/body deltas).
test/integration/cache_test.go Updates request inspection to use http.Request.URL.Query().
internal/testutil/mock.go Keeps test logger output consistent without “RESTY” prefixes.
client_test.go Updates client tests for new fields and doRequest signature/behavior.
config_test.go Updates config tests to check hostURL/header instead of Resty fields.
go.mod / go.sum Drops github.com/go-resty/resty/v2 (and related sum entries).
k8s/go.mod / k8s/go.sum Drops github.com/go-resty/resty/v2 from k8s module.
test/go.mod / test/go.sum Drops github.com/go-resty/resty/v2 from test module.

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

Comment thread errors.go Outdated
Comment thread errors.go Outdated
Comment thread client_test.go Outdated
Comment thread test/integration/cache_test.go Outdated
Comment thread errors_test.go
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 removes the resty dependency from linodego by porting request execution, retries, error handling, and debug logging to net/http, and updates unit/integration tests and fixtures accordingly.

Changes:

  • Replaced Resty-based request/retry/logging pipeline with a net/http implementation (including templated debug request/response logging).
  • Updated pagination/request helpers and monitor-client code paths to use the new HTTP request layer.
  • Removed resty from module dependencies and updated tests/fixtures to match new request behavior (e.g., page=1 query param).

Reviewed changes

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

Show a summary per file
File Description
client.go Core client rewrite to net/http, including retries and debug logging templates (go:embed).
client_http.go Removes the old httpClient wrapper type.
client_monitor.go Monitor client ported from Resty to net/http, including custom root CA handling and request execution.
retries.go Retry conditionals/Retry-After logic ported to operate on *http.Response.
retries_http.go Removes the separate HTTP retry implementation.
errors.go Error coupling now operates on *http.Response instead of Resty response types.
images.go Upload-to-URL now uses net/http (including content-length handling) instead of Resty.
pagination.go List option application moved to an *http.Request mutator.
request_helpers.go Request helper methods ported to call Client.doRequest.
logger.go Introduces a custom logger interface/impl and adds log-injection sanitization.
request_log_template.tmpl New embedded request log template for debug logging.
response_log_template.tmpl New embedded response log template for debug logging.
internal/testutil/mock.go Adjusts test logger formatting to match new logger prefixes.
request_helpers_test.go Formatting-only updates for httpmock responder registration.
retries_test.go Tests updated to use *http.Response and exported retry helpers; removes Resty usage.
retries_http_test.go Removes old HTTP retry tests.
errors_test.go Updates tests to build *http.Response-based error cases and use new coupling paths.
client_test.go Updates tests for new fields (hostURL/header/debug) and doRequest calling patterns.
config_test.go Updates tests to assert hostURL/header instead of Resty client fields.
monitor_api_services.go Uses MonitorClient doRequest with net/http.
monitor_alert_definitions.go Uses Client.doRequest and per-request headers for idempotency key.
test/unit/images_test.go Adds httpmock activation for default transport to cover upload PUT to external URL.
test/integration/cache_test.go Updates request inspection to use request.URL.Query() / request.URL.String().
test/integration/maintenance_test.go Migrates from direct request/JSON parsing to ListMaintenancePolicies.
test/integration/fixtures/TestMaintenancePolicies_List.yaml Fixture updated for new pagination query behavior and recorded headers.
go.mod / go.sum Removes github.com/go-resty/resty/v2 (and related sums).
k8s/go.mod / k8s/go.sum Removes github.com/go-resty/resty/v2 (and related sums) in k8s module.
test/go.mod / test/go.sum Removes github.com/go-resty/resty/v2 (and related sums) in test module.

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

Comment thread logger.go Outdated
Comment thread client.go Outdated
Comment thread client.go
Comment on lines +1015 to +1016
// masking authorization header
r.Headers.Set("Authorization", "Bearer *******************************")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change for breaking changes in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants