Skip to content

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

Merged
julienrbrt merged 1 commit intoevstack:mainfrom
chuanshanjida:main
Apr 21, 2026
Merged

refactor: modernize sync/atomic usage with typed atomic apis#3269
julienrbrt merged 1 commit intoevstack:mainfrom
chuanshanjida:main

Conversation

@chuanshanjida
Copy link
Copy Markdown
Contributor

@chuanshanjida chuanshanjida commented Apr 20, 2026

Overview

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.

Summary by CodeRabbit

  • Tests
    • Updated atomic operation patterns in test suite for improved code consistency.

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

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8cb79bf5-9929-495a-8702-abe0ea05d2c1

📥 Commits

Reviewing files that changed from the base of the PR and between 2eb15bd and 82d5c8f.

📒 Files selected for processing (2)
  • pkg/signer/aws/signer_test.go
  • pkg/signer/gcp/signer_test.go

📝 Walkthrough

Walkthrough

These changes refactor atomic operation patterns in test files, replacing pointer-based int32 atomic operations with the atomic.Int32 value type. Call counters in retry behavior and integrity tests now use .Add() and .Load() methods instead of package-level atomic.AddInt32() and atomic.LoadInt32() functions.

Changes

Cohort / File(s) Summary
Atomic operations refactoring
pkg/signer/aws/signer_test.go, pkg/signer/gcp/signer_test.go
Migrated retry/integrity test call counters from int32 with atomic.AddInt32()/atomic.LoadInt32() to atomic.Int32 with .Add() and .Load() methods. Test logic and expectations unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hopping through the atoms with glee,
From pointers old to values so free,
Add and Load dance in harmony,
Our locks are cleaner, safer to see!
Atomically yours, with twitching glee! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: refactoring atomic operations to use modern typed atomic APIs instead of legacy function-based calls.
Description check ✅ Passed The description provides a clear overview of the changes, rationale, and benefits, though it lacks explicit issue linkage or a tl;dr section as suggested in the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@julienrbrt julienrbrt enabled auto-merge April 21, 2026 06:15
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.49%. Comparing base (2eb15bd) to head (82d5c8f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3269   +/-   ##
=======================================
  Coverage   62.48%   62.49%           
=======================================
  Files         122      122           
  Lines       13012    13012           
=======================================
+ Hits         8131     8132    +1     
+ Misses       3995     3994    -1     
  Partials      886      886           
Flag Coverage Δ
combined 62.49% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@julienrbrt julienrbrt added this pull request to the merge queue Apr 21, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 21, 2026
@julienrbrt julienrbrt added this pull request to the merge queue Apr 21, 2026
Merged via the queue into evstack:main with commit 83edf6d Apr 21, 2026
24 of 28 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