theupdateframework / go-tuf

Go implementation of The Update Framework (TUF)
https://theupdateframework.com
Apache License 2.0
625 stars 105 forks source link

Refactor errors to use pointer receivers #602

Closed codysoyland closed 8 months ago

codysoyland commented 8 months ago

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.

rdimitrov commented 8 months ago

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