summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2023-07-02 14:31:51 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2023-07-02 14:31:51 +0100
commitad0306e9e79df26146ee8c74531574385f461f81 (patch)
tree03b3ab6cf9414d14fda0c2faacb341b1a7655134
parentf75f92495a5107086b3a6b33aa2554b349aab2f4 (diff)
Use StoreInt32 instead of SwapInt32v0.6.1
-rw-r--r--flag.go4
1 files 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 {