dcrdex icon indicating copy to clipboard operation
dcrdex copied to clipboard

refactor: modernize sync/atomic usage with typed atomic apis

Open chuanshanjida opened this issue 7 months ago • 3 comments

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 https://github.com/golang/go/issues/50860)

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

chuanshanjida avatar Apr 12 '26 08:04 chuanshanjida

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

chuanshanjida avatar Apr 20 '26 14:04 chuanshanjida

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

I made the same observation, but I saw that it has already been submitted. Good fixes.

box4wangjing avatar May 11 '26 17:05 box4wangjing

@JoeGruffins @buck54321 friendly ping~

chuanshanjida avatar Jun 24 '26 13:06 chuanshanjida