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

Update Atomic Counters example to use atomic.Uint64 #490

Merged
merged 3 commits into from
Oct 2, 2023

Conversation

erazemk
Copy link
Contributor

@erazemk erazemk commented Sep 28, 2023

This commit updates the Atomic Counters example to follow atomic's recommendation of using atomic.Uint64 instead of uint64 (same for other types) and then calling methods on it, instead of calling atomic.AddUint64().

The recommendation can be seen here: https://pkg.go.dev/sync/atomic#AddUint64

It also updates the comments and empty lines a bit to look better on the website.

This commit updates the Atomic Counters example to follow atomic's
recommendation of using atomic.Uint64 instead of uint64 (same for other
types) and then calling methods on it, instead of calling
atomic.AddUint64().

It also updates the comments and empty lines a bit to look better on the
website.
Copy link
Collaborator

@eliben eliben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It's about time we updated these, 1.19 was release a while ago

examples/atomic-counters/atomic-counters.go Outdated Show resolved Hide resolved
examples/atomic-counters/atomic-counters.go Show resolved Hide resolved
@erazemk
Copy link
Contributor Author

erazemk commented Oct 1, 2023

Ah sorry, only changed the function name, but forgot to change the rest of it. I've updated both comments to be more reasonable.

Copy link
Collaborator

@eliben eliben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I may tweak some language later, but approving this PR for now

@eliben eliben merged commit d1ca2ce into mmcgrana:master Oct 2, 2023
2 checks passed
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.

2 participants