#HVMP-stripego-question
1 messages · Page 1 of 1 (latest)
No worries. Basically I'm suggesting that the line here https://github.com/stripe/stripe-go/blob/30ff791110756be379b979acc4ccba6eb4d50604/error.go#L250-L253
should be
func (e Error) Error() string {
not
func (e *Error) Error() string {
https://cs.opensource.google/go/go/+/go1.19:src/builtin/builtin.go;l=280
ok so I tried to refresh myself on the little golang I know (veeery little)
correct me if I'm wrong here - isn't Error a pointer receiver so that the receiver can be modified by methods and not just a copy is operated on by the methods? And internally in other methods, stripe-go does create a copy off the pointer to do stuff differently if it needs to return a copy. So that was (to my lay-person understanding) on why that decision was (presumably) made
but overall, I don't have the right reasoning on why! I recommend opening an Issue on the stripe-go github repo with your question and the Stripe folks who maintain that library can give you a better answer
Yeah, I can't know the reasoning, but to me this looks like it wants to be a go interface custom error, and to do so the signature must be func (e MyError) Error() string{} with the receiver not being a pointer.
do open an issue on stripe-go's Github repo, they should be able to help answer better or take your recommendation into consideration!