Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix improper use of Printf-style functions #2934

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,11 @@ func TestResolveDefaultsMode(t *testing.T) {
}

if diff := cmpDiff(tt.ExpectedDefaultsMode, cfg.DefaultsMode); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}

if diff := cmpDiff(tt.ExpectedRuntimeEnvironment, cfg.RuntimeEnvironment); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion credentials/ssocreds/sso_credentials_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func TestProvider(t *testing.T) {
}

if diff := cmpDiff(tt.ExpectedCredentials, credentials); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions feature/s3/manager/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package manager
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net/http"
"sort"
"sync"

"github.com/aws/aws-sdk-go-v2/aws"

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

return true, err
Expand Down
16 changes: 8 additions & 8 deletions internal/awstesting/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) b

expectURL, err := url.Parse(expect)
if err != nil {
t.Errorf(errMsg("unable to parse expected URL", err, msgAndArgs))
t.Error(errMsg("unable to parse expected URL", err, msgAndArgs))
return false
}
actualURL, err := url.Parse(actual)
if err != nil {
t.Errorf(errMsg("unable to parse actual URL", err, msgAndArgs))
t.Error(errMsg("unable to parse actual URL", err, msgAndArgs))
return false
}

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

expectQ, err := url.ParseQuery(expect)
if err != nil {
t.Errorf(errMsg("unable to parse expected Query", err, msgAndArgs))
t.Error(errMsg("unable to parse expected Query", err, msgAndArgs))
return false
}
actualQ, err := url.ParseQuery(actual)
if err != nil {
t.Errorf(errMsg("unable to parse actual Query", err, msgAndArgs))
t.Error(errMsg("unable to parse actual Query", err, msgAndArgs))
return false
}

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

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

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

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

actualVal := container
if err := xml.Unmarshal([]byte(actual), &actualVal); err != nil {
t.Errorf(errMsg("unable to parse actual XML", err, msgAndArgs...))
t.Error(errMsg("unable to parse actual XML", err, msgAndArgs...))
}
return equal(t, expectVal, actualVal, msgAndArgs...)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/endpoints/v2/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ func TestLogDeprecated(t *testing.T) {
Logger: log.New(buffer, "", 0),
}, func(t *testing.T) {
if diff := cmpDiff("WARN endpoint identifier \"bar\", url \"https://foo.bar.bar.tld\" marked as deprecated\n", buffer.String()); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}
},
Expand All @@ -1326,7 +1326,7 @@ func TestLogDeprecated(t *testing.T) {
Logger: log.New(buffer, "", 0),
}, func(t *testing.T) {
if diff := cmpDiff("WARN endpoint identifier \"bar\", url \"https://foo-fips.bar.bar.tld\" marked as deprecated\n", buffer.String()); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}
},
Expand All @@ -1352,7 +1352,7 @@ func TestLogDeprecated(t *testing.T) {
}

if diff := cmpDiff(tt.Expected, endpoint); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}

if verifyLog != nil {
Expand Down
8 changes: 4 additions & 4 deletions service/kinesis/internal/testing/eventstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func TestSubscribeToShard_ReadException(t *testing.T) {
expectedErr,
&types.InternalFailureException{Message: aws.String("this is an exception message")},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -366,7 +366,7 @@ func TestSubscribeToShard_ReadUnmodeledException(t *testing.T) {
Message: "this is an unmodeled exception message",
},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -437,7 +437,7 @@ func TestSubscribeToShard_ReadErrorEvent(t *testing.T) {
Message: "An error message",
},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -478,7 +478,7 @@ func TestSubscribeToShard_ResponseError(t *testing.T) {
Message: "this is an exception message",
},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func TestStartStreamTranscription_ReadException(t *testing.T) {
expectedErr,
&types.BadRequestException{Message: aws.String("this is an exception message")},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -328,7 +328,7 @@ func TestStartStreamTranscription_ReadUnmodeledException(t *testing.T) {
Message: "this is an unmodeled exception message",
},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -390,7 +390,7 @@ func TestStartStreamTranscription_ReadErrorEvent(t *testing.T) {
Message: "An error message",
},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down Expand Up @@ -649,7 +649,7 @@ func TestStartStreamTranscription_ResponseError(t *testing.T) {
Message: "this is an exception message",
},
); len(diff) > 0 {
t.Errorf(diff)
t.Error(diff)
}
}

Expand Down
Loading