Skip to content

Commit 885de40

Browse files
authored
Fix improper use of Printf-style functions (#2934)
1 parent 858298a commit 885de40

File tree

8 files changed

+39
-24
lines changed

8 files changed

+39
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"id": "96979b8a-b9d0-4d28-990d-fe28ae1aca84",
3+
"type": "bugfix",
4+
"collapse": true,
5+
"description": "Fix improper use of printf-style functions.",
6+
"modules": [
7+
".",
8+
"config",
9+
"credentials",
10+
"feature/s3/manager",
11+
"internal/endpoints/v2",
12+
"service/kinesis/internal/testing",
13+
"service/transcribestreaming/internal/testing"
14+
]
15+
}

config/resolve_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,11 @@ func TestResolveDefaultsMode(t *testing.T) {
514514
}
515515

516516
if diff := cmpDiff(tt.ExpectedDefaultsMode, cfg.DefaultsMode); len(diff) > 0 {
517-
t.Errorf(diff)
517+
t.Error(diff)
518518
}
519519

520520
if diff := cmpDiff(tt.ExpectedRuntimeEnvironment, cfg.RuntimeEnvironment); len(diff) > 0 {
521-
t.Errorf(diff)
521+
t.Error(diff)
522522
}
523523
})
524524
}

credentials/ssocreds/sso_credentials_provider_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func TestProvider(t *testing.T) {
189189
}
190190

191191
if diff := cmpDiff(tt.ExpectedCredentials, credentials); len(diff) > 0 {
192-
t.Errorf(diff)
192+
t.Error(diff)
193193
}
194194
})
195195
}

feature/s3/manager/upload.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package manager
33
import (
44
"bytes"
55
"context"
6+
"errors"
67
"fmt"
78
"io"
89
"net/http"
910
"sort"
1011
"sync"
1112

1213
"github.com/aws/aws-sdk-go-v2/aws"
13-
1414
"github.com/aws/aws-sdk-go-v2/aws/middleware"
1515
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
1616
internalcontext "github.com/aws/aws-sdk-go-v2/internal/context"
@@ -686,7 +686,7 @@ func (u *multiuploader) shouldContinue(part int32, nextChunkLen int, err error)
686686
msg = fmt.Sprintf("exceeded total allowed S3 limit MaxUploadParts (%d). Adjust PartSize to fit in this limit",
687687
MaxUploadParts)
688688
}
689-
return false, fmt.Errorf(msg)
689+
return false, errors.New(msg)
690690
}
691691

692692
return true, err

internal/awstesting/assert.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) b
2828

2929
expectURL, err := url.Parse(expect)
3030
if err != nil {
31-
t.Errorf(errMsg("unable to parse expected URL", err, msgAndArgs))
31+
t.Error(errMsg("unable to parse expected URL", err, msgAndArgs))
3232
return false
3333
}
3434
actualURL, err := url.Parse(actual)
3535
if err != nil {
36-
t.Errorf(errMsg("unable to parse actual URL", err, msgAndArgs))
36+
t.Error(errMsg("unable to parse actual URL", err, msgAndArgs))
3737
return false
3838
}
3939

@@ -52,12 +52,12 @@ func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{})
5252

5353
expectQ, err := url.ParseQuery(expect)
5454
if err != nil {
55-
t.Errorf(errMsg("unable to parse expected Query", err, msgAndArgs))
55+
t.Error(errMsg("unable to parse expected Query", err, msgAndArgs))
5656
return false
5757
}
5858
actualQ, err := url.ParseQuery(actual)
5959
if err != nil {
60-
t.Errorf(errMsg("unable to parse actual Query", err, msgAndArgs))
60+
t.Error(errMsg("unable to parse actual Query", err, msgAndArgs))
6161
return false
6262
}
6363

@@ -106,13 +106,13 @@ func AssertJSON(t *testing.T, expect, actual string, msgAndArgs ...interface{})
106106

107107
expectVal := map[string]interface{}{}
108108
if err := json.Unmarshal([]byte(expect), &expectVal); err != nil {
109-
t.Errorf(errMsg("unable to parse expected JSON", err, msgAndArgs...))
109+
t.Error(errMsg("unable to parse expected JSON", err, msgAndArgs...))
110110
return false
111111
}
112112

113113
actualVal := map[string]interface{}{}
114114
if err := json.Unmarshal([]byte(actual), &actualVal); err != nil {
115-
t.Errorf(errMsg("unable to parse actual JSON", err, msgAndArgs...))
115+
t.Error(errMsg("unable to parse actual JSON", err, msgAndArgs...))
116116
return false
117117
}
118118

@@ -123,12 +123,12 @@ func AssertJSON(t *testing.T, expect, actual string, msgAndArgs ...interface{})
123123
func AssertXML(t *testing.T, expect, actual string, container interface{}, msgAndArgs ...interface{}) bool {
124124
expectVal := container
125125
if err := xml.Unmarshal([]byte(expect), &expectVal); err != nil {
126-
t.Errorf(errMsg("unable to parse expected XML", err, msgAndArgs...))
126+
t.Error(errMsg("unable to parse expected XML", err, msgAndArgs...))
127127
}
128128

129129
actualVal := container
130130
if err := xml.Unmarshal([]byte(actual), &actualVal); err != nil {
131-
t.Errorf(errMsg("unable to parse actual XML", err, msgAndArgs...))
131+
t.Error(errMsg("unable to parse actual XML", err, msgAndArgs...))
132132
}
133133
return equal(t, expectVal, actualVal, msgAndArgs...)
134134
}

internal/endpoints/v2/package_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ func TestLogDeprecated(t *testing.T) {
13031303
Logger: log.New(buffer, "", 0),
13041304
}, func(t *testing.T) {
13051305
if diff := cmpDiff("WARN endpoint identifier \"bar\", url \"https://foo.bar.bar.tld\" marked as deprecated\n", buffer.String()); len(diff) > 0 {
1306-
t.Errorf(diff)
1306+
t.Error(diff)
13071307
}
13081308
}
13091309
},
@@ -1326,7 +1326,7 @@ func TestLogDeprecated(t *testing.T) {
13261326
Logger: log.New(buffer, "", 0),
13271327
}, func(t *testing.T) {
13281328
if diff := cmpDiff("WARN endpoint identifier \"bar\", url \"https://foo-fips.bar.bar.tld\" marked as deprecated\n", buffer.String()); len(diff) > 0 {
1329-
t.Errorf(diff)
1329+
t.Error(diff)
13301330
}
13311331
}
13321332
},
@@ -1352,7 +1352,7 @@ func TestLogDeprecated(t *testing.T) {
13521352
}
13531353

13541354
if diff := cmpDiff(tt.Expected, endpoint); len(diff) > 0 {
1355-
t.Errorf(diff)
1355+
t.Error(diff)
13561356
}
13571357

13581358
if verifyLog != nil {

service/kinesis/internal/testing/eventstream_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func TestSubscribeToShard_ReadException(t *testing.T) {
299299
expectedErr,
300300
&types.InternalFailureException{Message: aws.String("this is an exception message")},
301301
); len(diff) > 0 {
302-
t.Errorf(diff)
302+
t.Error(diff)
303303
}
304304
}
305305

@@ -366,7 +366,7 @@ func TestSubscribeToShard_ReadUnmodeledException(t *testing.T) {
366366
Message: "this is an unmodeled exception message",
367367
},
368368
); len(diff) > 0 {
369-
t.Errorf(diff)
369+
t.Error(diff)
370370
}
371371
}
372372

@@ -437,7 +437,7 @@ func TestSubscribeToShard_ReadErrorEvent(t *testing.T) {
437437
Message: "An error message",
438438
},
439439
); len(diff) > 0 {
440-
t.Errorf(diff)
440+
t.Error(diff)
441441
}
442442
}
443443

@@ -478,7 +478,7 @@ func TestSubscribeToShard_ResponseError(t *testing.T) {
478478
Message: "this is an exception message",
479479
},
480480
); len(diff) > 0 {
481-
t.Errorf(diff)
481+
t.Error(diff)
482482
}
483483
}
484484

service/transcribestreaming/internal/testing/eventstream_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func TestStartStreamTranscription_ReadException(t *testing.T) {
270270
expectedErr,
271271
&types.BadRequestException{Message: aws.String("this is an exception message")},
272272
); len(diff) > 0 {
273-
t.Errorf(diff)
273+
t.Error(diff)
274274
}
275275
}
276276

@@ -328,7 +328,7 @@ func TestStartStreamTranscription_ReadUnmodeledException(t *testing.T) {
328328
Message: "this is an unmodeled exception message",
329329
},
330330
); len(diff) > 0 {
331-
t.Errorf(diff)
331+
t.Error(diff)
332332
}
333333
}
334334

@@ -390,7 +390,7 @@ func TestStartStreamTranscription_ReadErrorEvent(t *testing.T) {
390390
Message: "An error message",
391391
},
392392
); len(diff) > 0 {
393-
t.Errorf(diff)
393+
t.Error(diff)
394394
}
395395
}
396396

@@ -649,7 +649,7 @@ func TestStartStreamTranscription_ResponseError(t *testing.T) {
649649
Message: "this is an exception message",
650650
},
651651
); len(diff) > 0 {
652-
t.Errorf(diff)
652+
t.Error(diff)
653653
}
654654
}
655655

0 commit comments

Comments
 (0)