Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have string marshaling methods be value receivers rather than pointer… #145

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mediocregopher
Copy link

… receivers

I frequently use Big as a value, mostly because it's convenient to do so in structs and maps, as the zero value is 0 so it makes business logic read better, rather than having to constantly do if v == nil checks everywhere. It also helps reduce allocations. The only problem I've run into is that both the formatted string outputs and JSON marshaled outputs are super wonky when I do so, because the String, Format, and MarshalText methods are on the pointer receiver. Changing those methods to be on the value receiver fixes the problem, and afaik has no adverse side-effects. So this PR does that. Let me know what you think!

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.

1 participant