Since the go1.19 update, there are lots of duplicate functionality between this package and sync/atomic. This duplication is currently needed because go1.18 is still supported.
sync/atomic has the following types that are duplicated here:
Bool
Int32
Int64
Pointer[T]
Uint32
Uint64
Uintptr
All types in sync/atomic have the following methods:
CompareAndSwap
Load
Store
Swap
Integer-like types have the following, in addition to the above:
But there is still some functionality in here go.uber.org/atomic that is not there in sync/atomic.
All thing considered, after go1.18 becomes unsupported, we could do the following:
I just wanted to document all this stuff before I forget.
Since the
go1.19update, there are lots of duplicate functionality between this package andsync/atomic. This duplication is currently needed becausego1.18is still supported.sync/atomichas the following types that are duplicated here:BoolInt32Int64Pointer[T]Uint32Uint64UintptrAll types in
sync/atomichave the following methods:CompareAndSwapLoadStoreSwapInteger-like types have the following, in addition to the above:
AddBut there is still some functionality in here
go.uber.org/atomicthat is not there insync/atomic.All thing considered, after
go1.18becomes unsupported, we could do the following:gen-atomicintto embedsync/atomictypes. Only the following additional methodsneed to be kept.
-
CAS(Deprecated)-
Dec-
Inc-
Sub-
String-
MarshallJSON-
UnmarshallJSONBoolto embedsync/atomictype. Only the following additional methodsneed to be kept.
-
CAS(Deprecated)-
String-
Toggle-
MarshallJSON-
UnmarshallJSONPointer[T]to embedsync/atomictype.I just wanted to document all this stuff before I forget.