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

Add Pointer[T] #116

Merged
merged 2 commits into from Aug 9, 2022
Merged

Add Pointer[T] #116

merged 2 commits into from Aug 9, 2022

Conversation

abhinav
Copy link
Contributor

@abhinav abhinav commented Aug 9, 2022

Adds a Pointer[T] type that provide the same functionality as
Go 1.19's sync/atomic.Pointer[T] in both, Go 1.18 and 1.19.

In Go 1.19, this uses the standard library's implementation,
and in 1.18 our own custom implementation based on UnsafePointer.
For Go 1.17, even though it's now unsupported, this is a no-op.

Refs GO-1572
Resolves #115

@abhinav abhinav changed the base branch from master to abg/no-ioutil Aug 9, 2022
@codecov
Copy link

codecov bot commented Aug 9, 2022

Codecov Report

Merging #116 (ab44100) into master (d144bb6) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #116   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        22    +2     
  Lines          215       231   +16     
=========================================
+ Hits           215       231   +16     
Impacted Files Coverage Δ
pointer_go118.go 100.00% <100.00%> (ø)
pointer_go119.go 100.00% <100.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

pointer_test.go Show resolved Hide resolved
Base automatically changed from abg/no-ioutil to master Aug 9, 2022
abhinav added 2 commits Aug 9, 2022
This is necessary to use generics.
Adds a Pointer[T] type that provide the same functionality as
Go 1.19's `sync/atomic.Pointer[T]` in both, Go 1.18 and 1.19.

In Go 1.19, this uses the standard library's implementation,
and in 1.18 our own custom implementation based on UnsafePointer.

Refs GO-1572
Resolves #115
sywhang
sywhang approved these changes Aug 9, 2022
@abhinav abhinav merged commit 2ab21d8 into master Aug 9, 2022
8 checks passed
@abhinav abhinav deleted the abg/ptr branch Aug 9, 2022
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.

Compatible with atomic.Pointer with golang 1.19
2 participants