File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ linters:
66
66
rules :
67
67
main :
68
68
deny :
69
- # - pkg: "sync/atomic"
70
- # desc: "Use go.uber.org/atomic instead of sync/atomic"
69
+ - pkg : " sync/atomic"
70
+ desc : " Use go.uber.org/atomic instead of sync/atomic"
71
71
- pkg : " github.com/go-kit/kit/log"
72
72
desc : " Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
73
73
- pkg : " io/ioutil"
Original file line number Diff line number Diff line change @@ -31,11 +31,11 @@ import (
31
31
"strconv"
32
32
"strings"
33
33
"sync"
34
- "sync/atomic"
35
34
"testing"
36
35
"time"
37
36
38
37
"github.com/stretchr/testify/require"
38
+ "go.uber.org/atomic"
39
39
"gopkg.in/yaml.v2"
40
40
)
41
41
@@ -1309,7 +1309,8 @@ func TestTLSRoundTripperRaces(t *testing.T) {
1309
1309
1310
1310
var wg sync.WaitGroup
1311
1311
ch := make (chan struct {})
1312
- var total , ok int64
1312
+ total := atomic .NewInt64 (0 )
1313
+ ok := atomic .NewInt64 (0 )
1313
1314
// Spawn 10 Go routines polling the server concurrently.
1314
1315
for i := 0 ; i < 10 ; i ++ {
1315
1316
wg .Add (1 )
@@ -1320,11 +1321,11 @@ func TestTLSRoundTripperRaces(t *testing.T) {
1320
1321
case <- ch :
1321
1322
return
1322
1323
default :
1323
- atomic . AddInt64 ( & total , 1 )
1324
+ total . Add ( 1 )
1324
1325
r , err := c .Get (testServer .URL )
1325
1326
if err == nil {
1326
1327
r .Body .Close ()
1327
- atomic . AddInt64 ( & ok , 1 )
1328
+ ok . Add ( 1 )
1328
1329
}
1329
1330
}
1330
1331
}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ require (
13
13
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
14
14
github.com/prometheus/client_model v0.6.2
15
15
github.com/stretchr/testify v1.10.0
16
+ go.uber.org/atomic v1.11.0
16
17
golang.org/x/net v0.42.0
17
18
golang.org/x/oauth2 v0.30.0
18
19
google.golang.org/protobuf v1.36.6
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
45
45
github.com/stretchr/testify v1.10.0 /go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY =
46
46
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc =
47
47
github.com/xhit/go-str2duration/v2 v2.1.0 /go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU =
48
+ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE =
49
+ go.uber.org/atomic v1.11.0 /go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 =
48
50
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs =
49
51
golang.org/x/net v0.42.0 /go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8 =
50
52
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI =
You can’t perform that action at this time.
0 commit comments