1.1 KiB
1.1 KiB
Use go.uber.org/atomic
Atomic operations with the sync/atomic package operate on the raw types
(int32, int64, etc.) so it is easy to forget to use the atomic operation to
read or modify the variables.
go.uber.org/atomic adds type safety to these operations by hiding the
underlying type. Additionally, it includes a convenient atomic.Bool type.
| Bad | Good |
|---|---|
|
|