Skip to content

Commit 8a23470

Browse files
committed
Moderize code and documentation
1 parent a40a870 commit 8a23470

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# atomic
22
Atomic operations as methods on types
33

4-
[![GoDoc](https://godoc.org/github.com/nightlyone/atomic?status.svg)](https://godoc.org/github.com/nightlyone/atomic)
4+
[![Go Reference](https://pkg.go.dev/badge/github.com/nightlyone/atomic.svg)](https://pkg.go.dev/github.com/nightlyone/atomic)
55
[![Build Status](https://secure.travis-ci.org/nightlyone/atomic.png)](https://travis-ci.org/nightlyone/atomic)
66

77
# example usage

bool.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Bool struct {
1212

1313
// NewBool returns a new atomic boolean set inititially to value.
1414
func NewBool(value bool) *Bool {
15-
if value == true {
15+
if value {
1616
return &Bool{i: 1}
1717
}
1818
return &Bool{}
@@ -37,9 +37,9 @@ func (b *Bool) CompareAndSwap(old, new bool) (swapped bool) {
3737
ref := &b.i
3838

3939
switch {
40-
case old == false && new == true:
40+
case !old && new:
4141
return atomic.CompareAndSwapUint64(ref, 0, 1)
42-
case old == true && new == false:
42+
case old && !new:
4343
return atomic.CompareAndSwapUint64(ref, 1, 0)
4444
default:
4545
// this case is nonsense, since a swap will never happen.

bool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/nightlyone/atomic"
77
)
88

9-
// Service is a flaky service
9+
// Service is a flaky service.
1010
type Service struct {
1111
health atomic.Bool
1212
}

0 commit comments

Comments
 (0)