Skip to content
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

Go 1.19: use atomic.Pointer instead of atomic.Value #2056

Closed
marten-seemann opened this issue Feb 4, 2023 · 2 comments · Fixed by #2088
Closed

Go 1.19: use atomic.Pointer instead of atomic.Value #2056

marten-seemann opened this issue Feb 4, 2023 · 2 comments · Fixed by #2088
Labels
effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers good first issue Good issue for new contributors help wanted Seeking public contribution on this issue

Comments

@marten-seemann
Copy link
Contributor

There's a few places in our codebase where we're currently using an atomic.Value:

p2p/net/connmgr/decay.go
41:     lastTick atomic.Value

p2p/net/mock/mock_stream.go
34:     protocol atomic.Value

p2p/host/autonat/autonat.go
36:     status atomic.Value

p2p/net/swarm/swarm_stream.go
27:     protocol atomic.Value

p2p/net/swarm/swarm.go
149:    streamh atomic.Value

Go 1.19 added a atomic.Pointer, which makes use of generics, and allows us to do a type-safe atomic store and load operation. We should replace all uses of atomic.Value with atomic.Pointer.

This can be done as soon as Unified CI is updated and we've dropped support for Go 1.18.

@marten-seemann marten-seemann added help wanted Seeking public contribution on this issue good first issue Good issue for new contributors exp/beginner Can be confidently tackled by newcomers effort/hours Estimated to take one or several hours labels Feb 4, 2023
@marten-seemann
Copy link
Contributor Author

#2073 was just merged, so this is ready to go now. @sukunrt Do you want to give it a shot?

@sukunrt
Copy link
Member

sukunrt commented Feb 12, 2023

sure! I'll pick this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers good first issue Good issue for new contributors help wanted Seeking public contribution on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants