Skip to content

Commit 8975dde

Browse files
authored
Revert "Use go.uber.org/atomic instead of sync/atomic (#825)" (#838)
This reverts commit 6d40fe1. Signed-off-by: Arve Knudsen <[email protected]>
1 parent 08d7f66 commit 8975dde

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

.golangci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ linters:
6666
rules:
6767
main:
6868
deny:
69-
- pkg: "sync/atomic"
70-
desc: "Use go.uber.org/atomic instead of sync/atomic"
7169
- pkg: "github.com/go-kit/kit/log"
7270
desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
7371
- pkg: "io/ioutil"

config/http_config_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ import (
3131
"strconv"
3232
"strings"
3333
"sync"
34+
"sync/atomic"
3435
"testing"
3536
"time"
3637

3738
"github.com/stretchr/testify/require"
38-
"go.uber.org/atomic"
3939
"go.yaml.in/yaml/v2"
4040
)
4141

@@ -1309,8 +1309,7 @@ func TestTLSRoundTripperRaces(t *testing.T) {
13091309

13101310
var wg sync.WaitGroup
13111311
ch := make(chan struct{})
1312-
total := atomic.NewInt64(0)
1313-
ok := atomic.NewInt64(0)
1312+
var total, ok int64
13141313
// Spawn 10 Go routines polling the server concurrently.
13151314
for i := 0; i < 10; i++ {
13161315
wg.Add(1)
@@ -1321,11 +1320,11 @@ func TestTLSRoundTripperRaces(t *testing.T) {
13211320
case <-ch:
13221321
return
13231322
default:
1324-
total.Add(1)
1323+
atomic.AddInt64(&total, 1)
13251324
r, err := c.Get(testServer.URL)
13261325
if err == nil {
13271326
r.Body.Close()
1328-
ok.Add(1)
1327+
atomic.AddInt64(&ok, 1)
13291328
}
13301329
}
13311330
}

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ require (
1212
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
1313
github.com/prometheus/client_model v0.6.2
1414
github.com/stretchr/testify v1.11.1
15-
go.uber.org/atomic v1.11.0
1615
go.yaml.in/yaml/v2 v2.4.2
1716
golang.org/x/net v0.43.0
1817
golang.org/x/oauth2 v0.30.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
4343
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
4444
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
4545
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
46-
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
47-
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
4846
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
4947
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
5048
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=

0 commit comments

Comments
 (0)