-
Notifications
You must be signed in to change notification settings - Fork 82
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
Replace go.uber.org/atomic with sync/atomic #910
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending nits
@@ -675,7 +675,7 @@ func (r *Relayer) finishRelayItem(items *relayItems, id uint32) { | |||
} | |||
|
|||
func (r *Relayer) decrementPending() { | |||
r.pending.Dec() | |||
r.pending.Add(^uint32(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r.pending.Add(^uint32(0)) | |
r.pending.Add(-1) |
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately pending is unsigned, & there's no atomic subtract method, so this is the documented way: https://pkg.go.dev/sync/atomic#AddUint32
Added comment linking to docs
@@ -69,13 +69,14 @@ func TestTracingSpanAttributes(t *testing.T) { | |||
customAppHeaderKey = "futurama" | |||
customAppHeaderExpectedValue = "simpsons" | |||
) | |||
var customAppHeaderValue atomic.String | |||
var customAppHeaderValue atomic.Pointer[string] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pity they don't just support strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or at least a generic Value[T]
. Since these strings are only used in tests I opted not to create a utility struct wrapping atomic.Value
thanks for the contribution! Out of curiosity, are you using this library anywhere? |
It's a transitive dependency through https://temporal.io, which https://peerdb.io (data movement product) is built on top of |
@rabbbit who's the decision maker for merging? |
sorry for the lack of movement on this. the service mesh team at Uber is currently the de facto maintainers of this repo. can you shed light on how you're using tchannel-go? |
rely on it via temporal |
go 1.19 introduced atomic types
https://tip.golang.org/doc/go1.19#atomic_types
Indirect dependency remains through multierr,
but multierr recently dropped its go.uber.org/atomic dependency: uber-go/multierr#72