gpg icon indicating copy to clipboard operation
gpg copied to clipboard

Use pointer receiver for Key

Open Freeaqingme opened this issue 6 years ago • 2 comments

While debugging an issue I added the pointer receivers. I'm not sure if that's what made the difference, but it seems a good improvement nonetheless.

Freeaqingme avatar Dec 28 '18 23:12 Freeaqingme

Hey Dolf,

Apologies for the late reply.

Are you saying this solves a problem you were having, or are just preferring the aesthetics of having the methods on Key be pointer receivers? If it's the latter, I'm not against it per se, but none of those methods change the state of the Key so making them value receivers made more sense to me.

prep avatar Feb 17 '19 10:02 prep

Are you saying this solves a problem you were having

That I'm not sure about anymore :)

Advantages of using pointer receivers is that otherwise the struct would be copied for every method invocation. There was a nice blogpost that I'm thinking of but can't find it right now.

Freeaqingme avatar Feb 17 '19 15:02 Freeaqingme