Skip to content

Replace go.uber.org/atomic with sync/atomic#910

Open
serprex wants to merge 4 commits intouber:devfrom
serprex:dev
Open

Replace go.uber.org/atomic with sync/atomic#910
serprex wants to merge 4 commits intouber:devfrom
serprex:dev

Conversation

@serprex
Copy link

@serprex serprex commented Jan 10, 2024

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

@CLAassistant
Copy link

CLAassistant commented Jan 10, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

@rabbbit rabbbit left a comment

Choose a reason for hiding this comment

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

Pending nits


func (r *Relayer) decrementPending() {
r.pending.Dec()
r.pending.Add(^uint32(0))
Copy link

Choose a reason for hiding this comment

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

Suggested change
r.pending.Add(^uint32(0))
r.pending.Add(-1)

right?

Copy link
Author

@serprex serprex Jan 11, 2024

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

customAppHeaderExpectedValue = "simpsons"
)
var customAppHeaderValue atomic.String
var customAppHeaderValue atomic.Pointer[string]
Copy link

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.

Copy link
Author

@serprex serprex Jan 11, 2024

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

@serprex serprex requested a review from rabbbit January 11, 2024 15:36
@rabbbit
Copy link

rabbbit commented Jan 12, 2024

thanks for the contribution!

Out of curiosity, are you using this library anywhere?

@serprex
Copy link
Author

serprex commented Jan 12, 2024

It's a transitive dependency through https://temporal.io, which https://peerdb.io (data movement product) is built on top of
Created temporalio/temporal#5278 & temporalio/sdk-go#1344 alongside this to hopefully get one line removed from our go.mod eventually

@serprex
Copy link
Author

serprex commented Mar 27, 2024

@rabbbit who's the decision maker for merging?

@cinchurge
Copy link
Collaborator

@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?

@serprex
Copy link
Author

serprex commented Jun 27, 2024

@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

@serprex
Copy link
Author

serprex commented Jan 13, 2025

@cinchurge is there anything I can do to help merge this?

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.

4 participants