linode / linodego

Go client for Linode REST v4 API
MIT License
138 stars 81 forks source link

[Feature]: Rethink ListOptions for a more intuitive and natural interaction #511

Open machine424 opened 3 months ago

machine424 commented 3 months ago

Description

Despite what one may think when encountering ListOptions, it's not that immutable input that would only be used to pass options. It's also used, for example, to track the pagination state: https://github.com/linode/linodego/blob/3bcb4a6ec66514a687a659ecf4cbb83e18d92069/pagination.go#L94-L99

The fact that it's passed by reference should warn users about its mutability, but I don't think it's sufficient. Perhaps renaming the struct or splitting it may help better.

Motivation: In Prometheus, before https://github.com/prometheus/prometheus/pull/14141, we were using the same ListOptions instance over and over (which led to inaccurate results of course), I’m concerned that we might fall into the same pattern of “misuse” in the future.

Example Code

No response

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

ykim-1 commented 1 month ago

@machine424 , We created a ticket in backlog for this issue. We will update you once there is some progress. Thank you for your contribution!

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days