Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 38cb3b8

Browse files
authored
fix misleading timestamp value from tests and lint issues (#4699)
Removes timestamp with single digit hour code to avoid confusion. Also fixes lint issues. References: * golang/go#57912 (comment) * GOSDK-2932
1 parent 8035a30 commit 38cb3b8

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

aws/credentials/ec2rolecreds/ec2_role_provider_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ const credsRespTmpl = `{
2121
"SecretAccessKey" : "secret",
2222
"Token" : "token",
2323
"Expiration" : "%s",
24-
"LastUpdated" : "2009-11-23T0:00:00Z"
24+
"LastUpdated" : "2009-11-23T00:00:00Z"
2525
}`
2626

2727
const credsFailRespTmpl = `{
2828
"Code": "ErrorCode",
2929
"Message": "ErrorMsg",
30-
"LastUpdated": "2009-11-23T0:00:00Z"
30+
"LastUpdated": "2009-11-23T00:00:00Z"
3131
}`
3232

3333
func initTestServer(expireOn string, failAssume bool) *httptest.Server {

aws/session/credentials_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ const ecsResponse = `{
410410
"SecretAccessKey" : "ecs-secret-key",
411411
"Token" : "token",
412412
"Expiration" : "2100-01-01T00:00:00Z",
413-
"LastUpdated" : "2009-11-23T0:00:00Z"
413+
"LastUpdated" : "2009-11-23T00:00:00Z"
414414
}`
415415

416416
const ec2MetadataResponse = `{
@@ -420,7 +420,7 @@ const ec2MetadataResponse = `{
420420
"SecretAccessKey" : "%s",
421421
"Token" : "token",
422422
"Expiration" : "2100-01-01T00:00:00Z",
423-
"LastUpdated" : "2009-11-23T0:00:00Z"
423+
"LastUpdated" : "2009-11-23T00:00:00Z"
424424
}`
425425

426426
const assumeRoleRespMsg = `

private/protocol/jsonrpc/unmarshal_error.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ const (
2222
// UnmarshalTypedError provides unmarshaling errors API response errors
2323
// for both typed and untyped errors.
2424
type UnmarshalTypedError struct {
25-
exceptions map[string]func(protocol.ResponseMetadata) error
25+
exceptions map[string]func(protocol.ResponseMetadata) error
2626
queryExceptions map[string]func(protocol.ResponseMetadata, string) error
2727
}
2828

2929
// NewUnmarshalTypedError returns an UnmarshalTypedError initialized for the
3030
// set of exception names to the error unmarshalers
3131
func NewUnmarshalTypedError(exceptions map[string]func(protocol.ResponseMetadata) error) *UnmarshalTypedError {
3232
return &UnmarshalTypedError{
33-
exceptions: exceptions,
33+
exceptions: exceptions,
3434
queryExceptions: map[string]func(protocol.ResponseMetadata, string) error{},
3535
}
3636
}
3737

38+
// NewUnmarshalTypedErrorWithOptions works similar to NewUnmarshalTypedError applying options to the UnmarshalTypedError
39+
// before returning it
3840
func NewUnmarshalTypedErrorWithOptions(exceptions map[string]func(protocol.ResponseMetadata) error, optFns ...func(*UnmarshalTypedError)) *UnmarshalTypedError {
3941
unmarshaledError := NewUnmarshalTypedError(exceptions)
4042
for _, fn := range optFns {
@@ -43,6 +45,11 @@ func NewUnmarshalTypedErrorWithOptions(exceptions map[string]func(protocol.Respo
4345
return unmarshaledError
4446
}
4547

48+
// WithQueryCompatibility is a helper function to construct a functional option for use with NewUnmarshalTypedErrorWithOptions.
49+
// The queryExceptions given act as an override for unmarshalling errors when query compatible error codes are found.
50+
// See also [awsQueryCompatible trait]
51+
//
52+
// [awsQueryCompatible trait]: https://smithy.io/2.0/aws/protocols/aws-query-protocol.html#aws-protocols-awsquerycompatible-trait
4653
func WithQueryCompatibility(queryExceptions map[string]func(protocol.ResponseMetadata, string) error) func(*UnmarshalTypedError) {
4754
return func(typedError *UnmarshalTypedError) {
4855
typedError.queryExceptions = queryExceptions

service/s3/statusok_error_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var lastModifiedTime = time.Date(2009, 11, 23, 0, 0, 0, 0, time.UTC)
3030
func TestCopyObjectNoError(t *testing.T) {
3131
const successMsg = `
3232
<?xml version="1.0" encoding="UTF-8"?>
33-
<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LastModified>2009-11-23T0:00:00Z</LastModified><ETag>&quot;1da64c7f13d1e8dbeaea40b905fd586c&quot;</ETag></CopyObjectResult>`
33+
<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LastModified>2009-11-23T00:00:00Z</LastModified><ETag>&quot;1da64c7f13d1e8dbeaea40b905fd586c&quot;</ETag></CopyObjectResult>`
3434

3535
var responseBodyClosed bool
3636
res, err := newCopyTestSvc(successMsg, &responseBodyClosed).CopyObject(&s3.CopyObjectInput{
@@ -80,7 +80,7 @@ func TestCopyObjectError(t *testing.T) {
8080
func TestUploadPartCopySuccess(t *testing.T) {
8181
const successMsg = `
8282
<?xml version="1.0" encoding="UTF-8"?>
83-
<UploadPartCopyResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LastModified>2009-11-23T0:00:00Z</LastModified><ETag>&quot;1da64c7f13d1e8dbeaea40b905fd586c&quot;</ETag></UploadPartCopyResult>`
83+
<UploadPartCopyResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LastModified>2009-11-23T00:00:00Z</LastModified><ETag>&quot;1da64c7f13d1e8dbeaea40b905fd586c&quot;</ETag></UploadPartCopyResult>`
8484

8585
var responseBodyClosed bool
8686
res, err := newCopyTestSvc(successMsg, &responseBodyClosed).UploadPartCopy(&s3.UploadPartCopyInput{

0 commit comments

Comments
 (0)