Skip to content

refactor: modernize sync/atomic usage with typed atomic apis#3589

Open
chuanshanjida wants to merge 1 commit intodecred:masterfrom
chuanshanjida:master
Open

refactor: modernize sync/atomic usage with typed atomic apis#3589
chuanshanjida wants to merge 1 commit intodecred:masterfrom
chuanshanjida:master

Conversation

@chuanshanjida
Copy link
Copy Markdown

Modernize sync/atomic usage with typed atomic APIs

Replace legacy sync/atomic function-based API (AddInt32, LoadInt32, etc.)
with Go 1.19+ typed atomic types (atomic.Int32, atomic.Int64, etc.).

This change:

  • Improves code readability by removing explicit address-of operators
  • Enhances type safety at compile-time
  • Provides better API ergonomics with method-based access
  • Aligns with modern Go best practices (More info sync/atomic: add typed atomic values golang/go#50860)

The transformation is source-compatible and requires Go 1.19 or later.

Signed-off-by: chuanshanjida <chuanshanjida@outlook.com>
@chuanshanjida
Copy link
Copy Markdown
Author

@JoeGruffins @buck54321 Hi, Could you please review this PR at your convenience? Thank you very much.

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