diff --git a/sync2/atomic.go b/sync2/atomic.go index 1eb7dff..424a974 100644 --- a/sync2/atomic.go +++ b/sync2/atomic.go @@ -142,5 +142,5 @@ func (b *AtomicBool) Set(v bool) { } func (b *AtomicBool) Get() bool { - return atomic.LoadInt32((*int32)(i)) == 1 + return atomic.LoadInt32((*int32)(b)) == 1 } diff --git a/sync2/atomic_test.go b/sync2/atomic_test.go index 8d03180..040397f 100644 --- a/sync2/atomic_test.go +++ b/sync2/atomic_test.go @@ -29,7 +29,9 @@ func TestAtomicString(t *testing.T) { if s.Get() != "c" { t.Errorf("want c, got %s", s.Get()) } +} +func TestAtomicBool(t *testing.T) { var b AtomicBool if b.Get() != false { t.Fatal("must false")