@@ -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
@@ -181,7 +181,7 @@ func TestNewClientFromConfig(t *testing.T) {
181
181
InsecureSkipVerify : true ,
182
182
},
183
183
},
184
- handler : func (w http.ResponseWriter , r * http.Request ) {
184
+ handler : func (w http.ResponseWriter , _ * http.Request ) {
185
185
fmt .Fprint (w , ExpectedMessage )
186
186
},
187
187
},
@@ -195,7 +195,7 @@ func TestNewClientFromConfig(t *testing.T) {
195
195
InsecureSkipVerify : false ,
196
196
},
197
197
},
198
- handler : func (w http.ResponseWriter , r * http.Request ) {
198
+ handler : func (w http.ResponseWriter , _ * http.Request ) {
199
199
fmt .Fprint (w , ExpectedMessage )
200
200
},
201
201
},
@@ -933,7 +933,7 @@ type secretManager struct {
933
933
data map [string ]string
934
934
}
935
935
936
- func (m * secretManager ) Fetch (ctx context.Context , secretRef string ) (string , error ) {
936
+ func (m * secretManager ) Fetch (_ context.Context , secretRef string ) (string , error ) {
937
937
secretData , ok := m .data [secretRef ]
938
938
if ! ok {
939
939
return "" , fmt .Errorf ("unknown secret %s" , secretRef )
@@ -1044,7 +1044,7 @@ func TestTLSRoundTripper(t *testing.T) {
1044
1044
1045
1045
ca , cert , key := filepath .Join (tmpDir , "ca" ), filepath .Join (tmpDir , "cert" ), filepath .Join (tmpDir , "key" )
1046
1046
1047
- handler := func (w http.ResponseWriter , r * http.Request ) {
1047
+ handler := func (w http.ResponseWriter , _ * http.Request ) {
1048
1048
fmt .Fprint (w , ExpectedMessage )
1049
1049
}
1050
1050
testServer , err := newTestServer (handler )
@@ -1162,7 +1162,7 @@ func TestTLSRoundTripper(t *testing.T) {
1162
1162
}
1163
1163
1164
1164
func TestTLSRoundTripper_Inline (t * testing.T ) {
1165
- handler := func (w http.ResponseWriter , r * http.Request ) {
1165
+ handler := func (w http.ResponseWriter , _ * http.Request ) {
1166
1166
fmt .Fprint (w , ExpectedMessage )
1167
1167
}
1168
1168
testServer , err := newTestServer (handler )
@@ -1284,7 +1284,7 @@ func TestTLSRoundTripperRaces(t *testing.T) {
1284
1284
1285
1285
ca , cert , key := filepath .Join (tmpDir , "ca" ), filepath .Join (tmpDir , "cert" ), filepath .Join (tmpDir , "key" )
1286
1286
1287
- handler := func (w http.ResponseWriter , r * http.Request ) {
1287
+ handler := func (w http.ResponseWriter , _ * http.Request ) {
1288
1288
fmt .Fprint (w , ExpectedMessage )
1289
1289
}
1290
1290
testServer , err := newTestServer (handler )
@@ -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
}
@@ -1402,7 +1403,7 @@ type roundTrip struct {
1402
1403
theError error
1403
1404
}
1404
1405
1405
- func (rt * roundTrip ) RoundTrip (r * http.Request ) (* http.Response , error ) {
1406
+ func (rt * roundTrip ) RoundTrip (* http.Request ) (* http.Response , error ) {
1406
1407
return rt .theResponse , rt .theError
1407
1408
}
1408
1409
@@ -1875,7 +1876,7 @@ func TestModifyTLSCertificates(t *testing.T) {
1875
1876
defer os .RemoveAll (tmpDir )
1876
1877
ca , cert , key := filepath .Join (tmpDir , "ca" ), filepath .Join (tmpDir , "cert" ), filepath .Join (tmpDir , "key" )
1877
1878
1878
- handler := func (w http.ResponseWriter , r * http.Request ) {
1879
+ handler := func (w http.ResponseWriter , _ * http.Request ) {
1879
1880
fmt .Fprint (w , ExpectedMessage )
1880
1881
}
1881
1882
testServer , err := newTestServer (handler )
0 commit comments