Skip to content

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

Merged
leovct merged 1 commit into0xPolygon:mainfrom
chuanshanjida:main
Apr 29, 2026
Merged

refactor: modernize sync/atomic usage with typed atomic apis#903
leovct merged 1 commit into0xPolygon:mainfrom
chuanshanjida:main

Conversation

@chuanshanjida
Copy link
Copy Markdown
Contributor

Description

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.

Jira / Linear Tickets

Testing

  • Test A
  • Test B

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

Copy link
Copy Markdown
Member

@leovct leovct left a comment

Choose a reason for hiding this comment

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

lgtm thanks

@leovct leovct merged commit 4847986 into 0xPolygon:main Apr 29, 2026
12 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