Skip to content

Refactor errors to use pointer receivers#602

Merged
rdimitrov merged 1 commit intotheupdateframework:masterfrom
codysoyland:error-pointers
Feb 5, 2024
Merged

Refactor errors to use pointer receivers#602
rdimitrov merged 1 commit intotheupdateframework:masterfrom
codysoyland:error-pointers

Conversation

@codysoyland
Copy link
Copy Markdown
Contributor

This PR changes all errors to use pointer receivers, as is common Go idiom.

This doesn't change any behavior. It started as my attempt to fix something I thought was a bug, but I think I misunderstood. I won't feel bad if you decide to close/reject as this doesn't change any behavior and introduces a lot of LoC changes.

Pointer receivers have some benefits for use in error handling -- notably you can compare errors to nil (if err == nil vs if err == MyError{}). The choice is somewhat arbitrary, but using pointers is far more conventional.

Signed-off-by: Cody Soyland <codysoyland@github.com>
@rdimitrov
Copy link
Copy Markdown
Contributor

@codysoyland - That's nice! 💯 Thank you for addressing this! 👍

@rdimitrov rdimitrov merged commit 3a2b819 into theupdateframework:master Feb 5, 2024
@codysoyland codysoyland deleted the error-pointers branch February 6, 2024 14:30
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.

2 participants