nebula
nebula copied to clipboard
switch to new sync/atomic helpers in go1.19
These new helpers make the code a lot cleaner and assert that all references of the field are doing atomically. I confirmed that the
simple helpers like atomic.Int64 don't add any extra overhead as they
get in-lined by the compiler. atomic.Pointer adds an extra method call
as it no longer gets in-lined, but we aren't using these on the hot path
so it is probably okay.
Note that the new go1.19 fmt tool complains about some comments that I also fixed as part of this PR.
No rush to merge this, we may want to wait until go1.19.1 to see if there are any show stopper bugs.