From ad0306e9e79df26146ee8c74531574385f461f81 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sun, 2 Jul 2023 14:31:51 +0100 Subject: Use StoreInt32 instead of SwapInt32 --- flag.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flag.go b/flag.go index f9291e3..7255802 100644 --- a/flag.go +++ b/flag.go @@ -130,8 +130,8 @@ func FlagFeatureVar(fs *flag.FlagSet, f *Feature, name, usage string) { fs.Var(flagFeature{f}, name, usage) } -func (f *Feature) Disable() { atomic.SwapInt32(&f.enabled, 0) } -func (f *Feature) Enable() { atomic.SwapInt32(&f.enabled, 1) } +func (f *Feature) Disable() { atomic.StoreInt32(&f.enabled, 0) } +func (f *Feature) Enable() { atomic.StoreInt32(&f.enabled, 1) } func (f *Feature) Enabled() bool { return atomic.LoadInt32(&f.enabled) == 1 } func (f *Feature) String() string { -- cgit v1.2.3-70-g09d2