Skip to content

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

Open
serprex wants to merge 4 commits into
uber:devfrom
serprex:dev
Open

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

Conversation

@serprex

@serprex serprex commented Jan 10, 2024

Copy link
Copy Markdown

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

CLAassistant commented Jan 10, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rabbbit rabbbit left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pending nits

Comment thread relay.go

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

Copy link
Copy Markdown

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?

@serprex serprex Jan 11, 2024

Copy link
Copy Markdown
Author

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

Comment thread connection.go Outdated
Comment thread relay_test.go Outdated
Comment thread tracing_test.go
customAppHeaderExpectedValue = "simpsons"
)
var customAppHeaderValue atomic.String
var customAppHeaderValue atomic.Pointer[string]

Copy link
Copy Markdown

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.

@serprex serprex Jan 11, 2024

Copy link
Copy Markdown
Author

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

rabbbit commented Jan 12, 2024

Copy link
Copy Markdown

thanks for the contribution!

Out of curiosity, are you using this library anywhere?

@serprex

serprex commented Jan 12, 2024

Copy link
Copy Markdown
Author

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

serprex commented Mar 27, 2024

Copy link
Copy Markdown
Author

@rabbbit who's the decision maker for merging?

@cinchurge

Copy link
Copy Markdown
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

serprex commented Jun 27, 2024

Copy link
Copy Markdown
Author

@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

serprex commented Jan 13, 2025

Copy link
Copy Markdown
Author

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

@justinhwang
justinhwang requested review from cinchurge and maryis August 4, 2026 05:06
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