neondatabase / autoscaling

Postgres vertical autoscaling in k8s
Apache License 2.0
144 stars 18 forks source link

Use github.com/samber/lo.ToPtr everywhere #946

Closed sharnoff closed 1 month ago

sharnoff commented 1 month ago

There's a lot of places where we have ad-hoc ways to construct pointers to things - either via temporary variables, referencing the first element in a slice, or by a local function to produce pointers.

We can replace those with lo.ToPtr (like what the control plane already uses) to help with readability and consistency.

To find the locations that needed changing, I used

rg '&\[\].*\}\[0\]'
rg 'return &\w+$'

Originally discussed here: https://github.com/neondatabase/autoscaling/pull/895#discussion_r1576977602