Skip to content

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!

@mediocregopher mediocregopher force-pushed the marshal-value-receivers branch from a7d58e5 to d3d16ca Compare October 18, 2019 21:15
@mediocregopher mediocregopher force-pushed the marshal-value-receivers branch from d3d16ca to d7eccee Compare October 19, 2019 22:52
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