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

Move away from pointers for badge field? #38

Closed
nathany opened this issue Apr 21, 2015 · 7 comments
Closed

Move away from pointers for badge field? #38

nathany opened this issue Apr 21, 2015 · 7 comments
Labels

Comments

@nathany
Copy link
Contributor

nathany commented Apr 21, 2015

The only problem with using a series of pointers in structs is they can end in race conditions if any goroutines mutate the underlying pointer.

For that reason, I took the same approach here for omitempty badges: joekarl/go-libapns#8

It's not "pretty" but it's thread-safe. @themartorana

@nathany nathany changed the title Move away from pointers for badge usage? Move away from pointers for badge field? Apr 21, 2015
@nathany nathany added the API label Apr 21, 2015
@nathany
Copy link
Contributor Author

nathany commented Apr 28, 2015

This would be similar to the NullInt64 type in the sql package. 👍

@taylortrimble
Copy link
Contributor

👍

@nathany nathany mentioned this issue Apr 30, 2015
11 tasks
@nathany
Copy link
Contributor Author

nathany commented May 22, 2015

Before the PR from @themartorana, go-libapns was just using -1 to reset the badge rather than 0 (which is omitted, meaning no change).

anachronistic/apns uses an interface for different types of Alerts. That could be another option for the badge.

@themartorana
Copy link
Contributor

The biggest issue I had with -1 is that the struct is initialized with 0, a valid (and badge-clearing) value. So unless you hide the struct but give it a public initializer method, its default state is to clear the badge.

@themartorana
Copy link
Contributor

Ping on this - looks like we're still using a pointer. I can quickly submit a NullInt64-esque solution like joekarl/go-libapns#8 (my preferred method). Thoughts?

@taylortrimble
Copy link
Contributor

Go for it!

On Thu, Sep 3, 2015 at 12:32 PM, David Martorana notifications@github.com
wrote:

Ping on this - looks like we're still using a pointer. I can quickly submit a NullInt64-esque solution like joekarl/go-libapns#8 (my preferred method). Thoughts?

Reply to this email directly or view it on GitHub:
#38 (comment)

@nathany
Copy link
Contributor Author

nathany commented Dec 9, 2015

closed with #60

@nathany nathany closed this as completed Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants