From 4b611299da210333afbb4c8d5c189f3591411721 Mon Sep 17 00:00:00 2001 From: Eivind Siqveland Larsen Date: Sun, 26 May 2024 11:33:27 +0200 Subject: [PATCH] fixed example build for go < 1.19 --- example/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/example/main.go b/example/main.go index 1519887..acaa025 100644 --- a/example/main.go +++ b/example/main.go @@ -70,16 +70,16 @@ func runMain() error { } n.SetUrgency(notify.UrgencyCritical) - counter := &atomic.Int32{} + counter := int32(0) // Listen for actions invoked! onAction := func(action *notify.ActionInvokedSignal) { - counter.Add(1) + atomic.AddInt32(&counter, 1) log.Printf("ActionInvoked: %v Key: %v", action.ID, action.ActionKey) wg.Done() } onClosed := func(closer *notify.NotificationClosedSignal) { - counter.Add(1) + atomic.AddInt32(&counter, 1) log.Printf("NotificationClosed: %v Reason: %v", closer.ID, closer.Reason) wg.Done() } @@ -128,7 +128,7 @@ func runMain() error { wg.Add(2) wg.Wait() - log.Printf("total signal count received: %d", counter.Load()) + log.Printf("total signal count received: %d", atomic.LoadInt32(&counter)) return nil }