From df27f361a8c469b398c39a1e240ef4e028692453 Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 6 Mar 2024 16:06:43 -0500 Subject: [PATCH 1/5] dep: drop go-cmp in config/ --- config/config_test.go | 15 +++++++++++---- config/env_config_test.go | 3 +-- config/go.mod | 1 - config/go.sum | 1 - config/resolve_bearer_token_test.go | 5 ++--- config/resolve_test.go | 5 ++--- config/shared_config_test.go | 7 +++---- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/config/config_test.go b/config/config_test.go index 98200fc61ed..84aff3d7795 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -4,11 +4,11 @@ import ( "context" "fmt" "os" + "reflect" "testing" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/credentials" - "github.com/google/go-cmp/cmp" ) func TestConfigs_SharedConfigOptions(t *testing.T) { @@ -47,7 +47,7 @@ func TestConfigs_SharedConfigOptions(t *testing.T) { if e, a := "profile-name", profile; e != a { t.Errorf("expect %v profile, got %v", e, a) } - if diff := cmp.Diff([]string{"creds-file"}, files); len(diff) != 0 { + if diff := cmpDiff([]string{"creds-file"}, files); len(diff) != 0 { t.Errorf("expect resolved shared config match, got diff: \n %s", diff) } @@ -85,7 +85,7 @@ func TestConfigs_AppendFromLoaders(t *testing.T) { t.Errorf("expect %v configs, got %v", e, a) } - if diff := cmp.Diff(options, cfgs[0]); len(diff) != 0 { + if diff := cmpDiff(options, cfgs[0]); len(diff) != 0 { t.Errorf("expect config match, got diff: \n %s", diff) } } @@ -133,7 +133,7 @@ func TestConfigs_ResolveAWSConfig(t *testing.T) { expectedSources = append(expectedSources, s) } - if diff := cmp.Diff(expectedSources, cfg.ConfigSources); len(diff) != 0 { + if diff := cmpDiff(expectedSources, cfg.ConfigSources); len(diff) != 0 { t.Errorf("expect config sources match, got diff: \n %s", diff) } } @@ -210,3 +210,10 @@ func generateProfiles(n int) (string, error) { return f.Name(), nil } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} diff --git a/config/env_config_test.go b/config/env_config_test.go index bf874552b4b..3b4b81f93e3 100644 --- a/config/env_config_test.go +++ b/config/env_config_test.go @@ -10,7 +10,6 @@ import ( "github.com/aws/aws-sdk-go-v2/feature/ec2/imds" "github.com/aws/aws-sdk-go-v2/internal/awstesting" "github.com/aws/smithy-go/ptr" - "github.com/google/go-cmp/cmp" ) var _ sharedConfigProfileProvider = (*EnvConfig)(nil) @@ -512,7 +511,7 @@ func TestNewEnvConfig(t *testing.T) { t.Fatalf("WantErr=%v, got err=%v", c.WantErr, err) } - if diff := cmp.Diff(c.Config, cfg); len(diff) > 0 { + if diff := cmpDiff(c.Config, cfg); len(diff) > 0 { t.Errorf("expect config to match.\n%s", diff) } diff --git a/config/go.mod b/config/go.mod index 6103591b268..11ef81f5fef 100644 --- a/config/go.mod +++ b/config/go.mod @@ -11,7 +11,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 github.com/aws/aws-sdk-go-v2/service/sts v1.28.3 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) require ( diff --git a/config/go.sum b/config/go.sum index 35ac695fb99..d5d61042cef 100644 --- a/config/go.sum +++ b/config/go.sum @@ -1,4 +1,3 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/config/resolve_bearer_token_test.go b/config/resolve_bearer_token_test.go index 0d2d0a7fb45..3f83e0a4d5b 100644 --- a/config/resolve_bearer_token_test.go +++ b/config/resolve_bearer_token_test.go @@ -10,7 +10,6 @@ import ( "github.com/aws/aws-sdk-go-v2/credentials/ssocreds" "github.com/aws/aws-sdk-go-v2/internal/sdk" smithybearer "github.com/aws/smithy-go/auth/bearer" - "github.com/google/go-cmp/cmp" ) func TestResolveBearerAuthToken(t *testing.T) { @@ -117,7 +116,7 @@ func TestResolveBearerAuthToken(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.expectToken, token); diff != "" { + if diff := cmpDiff(c.expectToken, token); diff != "" { t.Errorf("expect token match\n%s", diff) } }) @@ -168,7 +167,7 @@ func TestWrapWithBearerAuthTokenProvider(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.expectToken, token); diff != "" { + if diff := cmpDiff(c.expectToken, token); diff != "" { t.Errorf("expect token match\n%s", diff) } }) diff --git a/config/resolve_test.go b/config/resolve_test.go index 1b33004379c..5f8d18ad314 100644 --- a/config/resolve_test.go +++ b/config/resolve_test.go @@ -18,7 +18,6 @@ import ( "github.com/aws/aws-sdk-go-v2/internal/awstesting" "github.com/aws/aws-sdk-go-v2/internal/awstesting/unit" "github.com/aws/smithy-go/logging" - "github.com/google/go-cmp/cmp" ) func TestResolveCustomCABundle(t *testing.T) { @@ -474,11 +473,11 @@ func TestResolveDefaultsMode(t *testing.T) { t.Errorf("expect no error, got %v", err) } - if diff := cmp.Diff(tt.ExpectedDefaultsMode, cfg.DefaultsMode); len(diff) > 0 { + if diff := cmpDiff(tt.ExpectedDefaultsMode, cfg.DefaultsMode); len(diff) > 0 { t.Errorf(diff) } - if diff := cmp.Diff(tt.ExpectedRuntimeEnvironment, cfg.RuntimeEnvironment); len(diff) > 0 { + if diff := cmpDiff(tt.ExpectedRuntimeEnvironment, cfg.RuntimeEnvironment); len(diff) > 0 { t.Errorf(diff) } }) diff --git a/config/shared_config_test.go b/config/shared_config_test.go index 4bf531b0f85..92ba1ea4a20 100644 --- a/config/shared_config_test.go +++ b/config/shared_config_test.go @@ -16,7 +16,6 @@ import ( "github.com/aws/aws-sdk-go-v2/internal/ini" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/ptr" - "github.com/google/go-cmp/cmp" ) var _ regionProvider = (*SharedConfig)(nil) @@ -754,7 +753,7 @@ func TestNewSharedConfig(t *testing.T) { if c.Err != nil { t.Errorf("expect error: %v, got none", c.Err) } - if diff := cmp.Diff(c.Expected, cfg); len(diff) > 0 { + if diff := cmpDiff(c.Expected, cfg); len(diff) > 0 { t.Error(diff) } }) @@ -895,7 +894,7 @@ func TestLoadSharedConfigFromSection(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.Expected, cfg); diff != "" { + if diff := cmpDiff(c.Expected, cfg); diff != "" { t.Errorf("expect shared config match\n%s", diff) } }) @@ -1499,7 +1498,7 @@ func TestSharedConfigLoading(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.Expect, cfg); diff != "" { + if diff := cmpDiff(c.Expect, cfg); diff != "" { t.Errorf("expect shared config match\n%s", diff) } }) From 4ace7f8b0472d821221c19718548823b46b88d64 Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 6 Mar 2024 16:11:17 -0500 Subject: [PATCH 2/5] dep: drop go-cmp in credentials/ --- credentials/ec2rolecreds/provider_test.go | 13 +++++++++--- credentials/go.mod | 1 - credentials/go.sum | 1 - credentials/ssocreds/sso_cached_token_test.go | 9 ++------ .../ssocreds/sso_credentials_provider_test.go | 9 ++++---- .../ssocreds/sso_token_provider_test.go | 21 +++++++++++-------- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/credentials/ec2rolecreds/provider_test.go b/credentials/ec2rolecreds/provider_test.go index 362b0b75365..e04ef1beac6 100644 --- a/credentials/ec2rolecreds/provider_test.go +++ b/credentials/ec2rolecreds/provider_test.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "io/ioutil" + "reflect" "strings" "testing" "time" @@ -18,7 +19,6 @@ import ( "github.com/aws/smithy-go" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" - "github.com/google/go-cmp/cmp" ) const credsRespTmpl = `{ @@ -298,7 +298,7 @@ func TestProvider_HandleFailToRetrieve(t *testing.T) { // Truncate time so it can be easily compared. creds.Expires = creds.Expires.Truncate(time.Second) - if diff := cmp.Diff(c.expectCreds, creds); diff != "" { + if diff := cmpDiff(c.expectCreds, creds); diff != "" { t.Errorf("expect creds match\n%s", diff) } }) @@ -359,9 +359,16 @@ func TestProvider_AdjustExpiresBy(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.expectCreds, creds); diff != "" { + if diff := cmpDiff(c.expectCreds, creds); diff != "" { t.Errorf("expect creds match\n%s", diff) } }) } } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} diff --git a/credentials/go.mod b/credentials/go.mod index 1ba5b9c7238..86778fcaa89 100644 --- a/credentials/go.mod +++ b/credentials/go.mod @@ -9,7 +9,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 github.com/aws/aws-sdk-go-v2/service/sts v1.28.3 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) require ( diff --git a/credentials/go.sum b/credentials/go.sum index 35ac695fb99..d5d61042cef 100644 --- a/credentials/go.sum +++ b/credentials/go.sum @@ -1,4 +1,3 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/credentials/ssocreds/sso_cached_token_test.go b/credentials/ssocreds/sso_cached_token_test.go index f02c9f8b88c..7fd745b39bd 100644 --- a/credentials/ssocreds/sso_cached_token_test.go +++ b/credentials/ssocreds/sso_cached_token_test.go @@ -9,13 +9,8 @@ import ( "time" "github.com/aws/aws-sdk-go-v2/aws" - "github.com/google/go-cmp/cmp" ) -var tokenCmpOptions = cmp.Options{ - cmp.AllowUnexported(token{}, tokenKnownFields{}, rfc3339{}), -} - func TestStandardSSOCacheTokenFilepath(t *testing.T) { origHomeDur := osUserHomeDur defer func() { @@ -125,7 +120,7 @@ func TestLoadCachedToken(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.expectToken, actualToken, tokenCmpOptions...); diff != "" { + if diff := cmpDiff(c.expectToken, actualToken); diff != "" { t.Errorf("expect tokens match\n%s", diff) } }) @@ -181,7 +176,7 @@ func TestStoreCachedToken(t *testing.T) { t.Fatalf("failed to load stored token, %v", err) } - if diff := cmp.Diff(c.token, actual, tokenCmpOptions...); diff != "" { + if diff := cmpDiff(c.token, actual); diff != "" { t.Errorf("expect tokens match\n%s", diff) } }) diff --git a/credentials/ssocreds/sso_credentials_provider_test.go b/credentials/ssocreds/sso_credentials_provider_test.go index c9006ea63c4..1110aeebf55 100644 --- a/credentials/ssocreds/sso_credentials_provider_test.go +++ b/credentials/ssocreds/sso_credentials_provider_test.go @@ -12,7 +12,6 @@ import ( "github.com/aws/aws-sdk-go-v2/internal/sdk" "github.com/aws/aws-sdk-go-v2/service/sso" "github.com/aws/aws-sdk-go-v2/service/sso/types" - "github.com/google/go-cmp/cmp" ) type mockClient struct { @@ -32,19 +31,19 @@ func (m mockClient) GetRoleCredentials(ctx context.Context, params *sso.GetRoleC m.t.Helper() if len(m.ExpectedAccountID) > 0 { - if diff := cmp.Diff(m.ExpectedAccountID, aws.ToString(params.AccountId)); len(diff) > 0 { + if diff := cmpDiff(m.ExpectedAccountID, aws.ToString(params.AccountId)); len(diff) > 0 { m.t.Error(diff) } } if len(m.ExpectedAccessToken) > 0 { - if diff := cmp.Diff(m.ExpectedAccessToken, aws.ToString(params.AccessToken)); len(diff) > 0 { + if diff := cmpDiff(m.ExpectedAccessToken, aws.ToString(params.AccessToken)); len(diff) > 0 { m.t.Error(diff) } } if len(m.ExpectedRoleName) > 0 { - if diff := cmp.Diff(m.ExpectedRoleName, aws.ToString(params.RoleName)); len(diff) > 0 { + if diff := cmpDiff(m.ExpectedRoleName, aws.ToString(params.RoleName)); len(diff) > 0 { m.t.Error(diff) } } @@ -187,7 +186,7 @@ func TestProvider(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(tt.ExpectedCredentials, credentials); len(diff) > 0 { + if diff := cmpDiff(tt.ExpectedCredentials, credentials); len(diff) > 0 { t.Errorf(diff) } }) diff --git a/credentials/ssocreds/sso_token_provider_test.go b/credentials/ssocreds/sso_token_provider_test.go index cfce6d5994c..8f525b27a24 100644 --- a/credentials/ssocreds/sso_token_provider_test.go +++ b/credentials/ssocreds/sso_token_provider_test.go @@ -9,6 +9,7 @@ import ( "io/ioutil" "os" "path/filepath" + "reflect" "strings" "testing" "time" @@ -17,8 +18,6 @@ import ( "github.com/aws/aws-sdk-go-v2/internal/sdk" "github.com/aws/aws-sdk-go-v2/service/ssooidc" smithybearer "github.com/aws/smithy-go/auth/bearer" - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" ) func TestSSOTokenProvider(t *testing.T) { @@ -110,7 +109,7 @@ func TestSSOTokenProvider(t *testing.T) { }, } - if diff := cmp.Diff(expect, actual, tokenCmpOptions...); diff != "" { + if diff := cmpDiff(expect, actual); diff != "" { return fmt.Errorf("expect token file match\n%s", diff) } return nil @@ -160,7 +159,7 @@ func TestSSOTokenProvider(t *testing.T) { }, } - if diff := cmp.Diff(expect, actual, tokenCmpOptions...); diff != "" { + if diff := cmpDiff(expect, actual); diff != "" { return fmt.Errorf("expect token file match\n%s", diff) } return nil @@ -196,7 +195,7 @@ func TestSSOTokenProvider(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.expectToken, token, tokenCmpOptions...); diff != "" { + if diff := cmpDiff(c.expectToken, token); diff != "" { t.Errorf("expect token match\n%s", diff) } @@ -220,13 +219,17 @@ func (c *mockCreateTokenAPIClient) CreateToken( *ssooidc.CreateTokenOutput, error, ) { if c.expectInput != nil { - opts := cmp.Options{ - cmpopts.IgnoreUnexported(ssooidc.CreateTokenInput{}), - } - if diff := cmp.Diff(c.expectInput, input, opts...); diff != "" { + if diff := cmpDiff(c.expectInput, input); diff != "" { return nil, fmt.Errorf("expect input match\n%s", diff) } } return c.output, c.err } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} From a65708a8517e74f4ede0c89afe8ff5909523ccda Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 6 Mar 2024 16:16:49 -0500 Subject: [PATCH 3/5] dep: drop go-cmp in service/internal/ --- service/internal/checksum/algorithms_test.go | 10 ++++------ .../checksum/aws_chunked_encoding_test.go | 12 +++++------ service/internal/checksum/go.mod | 1 - service/internal/checksum/go.sum | 1 - .../internal/checksum/middleware_add_test.go | 20 +++++++++++++------ .../middleware_compute_input_checksum_test.go | 7 +++---- .../middleware_validate_output_test.go | 5 ++--- service/internal/integrationtest/go.mod | 1 - service/internal/integrationtest/go.sum | 1 - .../integrationtest/s3/checksum_test.go | 16 +++++++-------- .../integrationtest/s3/presign_test.go | 13 +++++++++--- service/internal/presigned-url/go.mod | 1 - service/internal/presigned-url/go.sum | 2 -- .../internal/presigned-url/middleware_test.go | 12 +++++++++-- 14 files changed, 56 insertions(+), 46 deletions(-) diff --git a/service/internal/checksum/algorithms_test.go b/service/internal/checksum/algorithms_test.go index 3f8b27018a7..7c821f1e2a5 100644 --- a/service/internal/checksum/algorithms_test.go +++ b/service/internal/checksum/algorithms_test.go @@ -15,8 +15,6 @@ import ( "strings" "testing" "testing/iotest" - - "github.com/google/go-cmp/cmp" ) func TestComputeChecksumReader(t *testing.T) { @@ -114,7 +112,7 @@ func TestComputeChecksumReader(t *testing.T) { return } - if diff := cmp.Diff(string(c.ExpectRead), string(b)); diff != "" { + if diff := cmpDiff(string(c.ExpectRead), string(b)); diff != "" { t.Errorf("expect read match, got\n%v", diff) } @@ -129,7 +127,7 @@ func TestComputeChecksumReader(t *testing.T) { if err != nil && !strings.Contains(err.Error(), c.ExpectComputeErr) { t.Fatalf("expect error to contain %v, got %v", c.ExpectComputeErr, err) } - if diff := cmp.Diff(c.ExpectChecksum, v); diff != "" { + if diff := cmpDiff(c.ExpectChecksum, v); diff != "" { t.Errorf("expect checksum match, got\n%v", diff) } if c.ExpectComputeErr != "" { @@ -229,7 +227,7 @@ func TestValidateChecksumReader(t *testing.T) { t.Fatalf("expected error %v to contain %v", err.Error(), c.expectChecksumErr) } - if diff := cmp.Diff(c.expectedBody, actualResponse); len(diff) != 0 { + if diff := cmpDiff(c.expectedBody, actualResponse); len(diff) != 0 { t.Fatalf("found diff comparing response body %v", diff) } @@ -407,7 +405,7 @@ func TestFilterSupportedAlgorithms(t *testing.T) { for name, c := range cases { t.Run(name, func(t *testing.T) { algorithms := FilterSupportedAlgorithms(c.values) - if diff := cmp.Diff(c.expectAlgorithms, algorithms); diff != "" { + if diff := cmpDiff(c.expectAlgorithms, algorithms); diff != "" { t.Errorf("expect algorithms match\n%s", diff) } }) diff --git a/service/internal/checksum/aws_chunked_encoding_test.go b/service/internal/checksum/aws_chunked_encoding_test.go index 8e9ce3c8a9d..4f208b4c099 100644 --- a/service/internal/checksum/aws_chunked_encoding_test.go +++ b/service/internal/checksum/aws_chunked_encoding_test.go @@ -11,8 +11,6 @@ import ( "strings" "testing" "testing/iotest" - - "github.com/google/go-cmp/cmp" ) func TestAWSChunkedEncoding(t *testing.T) { @@ -147,7 +145,7 @@ func TestAWSChunkedEncoding(t *testing.T) { if e, a := c.expectEncodedLength, c.reader.EncodedLength(); e != a { t.Errorf("expect %v encoded length, got %v", e, a) } - if diff := cmp.Diff(c.expectHTTPHeaders, c.reader.HTTPHeaders()); diff != "" { + if diff := cmpDiff(c.expectHTTPHeaders, c.reader.HTTPHeaders()); diff != "" { t.Errorf("expect HTTP headers match\n%v", diff) } @@ -165,7 +163,7 @@ func TestAWSChunkedEncoding(t *testing.T) { return } - if diff := cmp.Diff(string(c.expectPayload), string(actualPayload)); diff != "" { + if diff := cmpDiff(string(c.expectPayload), string(actualPayload)); diff != "" { t.Errorf("expect payload match\n%v", diff) } }) @@ -242,7 +240,7 @@ func TestUnsignedAWSChunkReader(t *testing.T) { return } - if diff := cmp.Diff(string(c.expectPayload), string(actualPayload)); diff != "" { + if diff := cmpDiff(string(c.expectPayload), string(actualPayload)); diff != "" { t.Errorf("expect payload match\n%v", diff) } }) @@ -383,7 +381,7 @@ func TestBufferedAWSChunkReader(t *testing.T) { return } - if diff := cmp.Diff(string(c.expectPayload), string(actualPayload)); diff != "" { + if diff := cmpDiff(string(c.expectPayload), string(actualPayload)); diff != "" { t.Errorf("expect payload match\n%v", diff) } }) @@ -462,7 +460,7 @@ func TestAwsChunkedTrailerReader(t *testing.T) { return } - if diff := cmp.Diff(string(c.expectPayload), string(actualPayload)); diff != "" { + if diff := cmpDiff(string(c.expectPayload), string(actualPayload)); diff != "" { t.Errorf("expect payload match\n%v", diff) } }) diff --git a/service/internal/checksum/go.mod b/service/internal/checksum/go.mod index 2d4cc519e25..2cb650a9178 100644 --- a/service/internal/checksum/go.mod +++ b/service/internal/checksum/go.mod @@ -6,7 +6,6 @@ require ( github.com/aws/aws-sdk-go-v2 v1.25.2 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.4 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ diff --git a/service/internal/checksum/go.sum b/service/internal/checksum/go.sum index 35ac695fb99..d5d61042cef 100644 --- a/service/internal/checksum/go.sum +++ b/service/internal/checksum/go.sum @@ -1,4 +1,3 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/service/internal/checksum/middleware_add_test.go b/service/internal/checksum/middleware_add_test.go index 2e4a64f115b..da6efe94a26 100644 --- a/service/internal/checksum/middleware_add_test.go +++ b/service/internal/checksum/middleware_add_test.go @@ -5,11 +5,12 @@ package checksum import ( "context" + "fmt" + "reflect" "testing" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" - "github.com/google/go-cmp/cmp" ) func TestAddInputMiddleware(t *testing.T) { @@ -136,7 +137,7 @@ func TestAddInputMiddleware(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.expectMiddleware, stack.List()); diff != "" { + if diff := cmpDiff(c.expectMiddleware, stack.List()); diff != "" { t.Fatalf("expect stack list match:\n%s", diff) } @@ -217,7 +218,7 @@ func TestRemoveInputMiddleware(t *testing.T) { "Deserialize stack step", } - if diff := cmp.Diff(expectStack, stack.List()); diff != "" { + if diff := cmpDiff(expectStack, stack.List()); diff != "" { t.Fatalf("expect stack list match:\n%s", diff) } } @@ -307,7 +308,7 @@ func TestAddOutputMiddleware(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if diff := cmp.Diff(c.expectMiddleware, stack.List()); diff != "" { + if diff := cmpDiff(c.expectMiddleware, stack.List()); diff != "" { t.Fatalf("expect stack list match:\n%s", diff) } @@ -336,7 +337,7 @@ func TestAddOutputMiddleware(t *testing.T) { } if c.expectDeserialize != nil && ok { validateOutput := deserializeMiddleware.(*validateOutputPayloadChecksum) - if diff := cmp.Diff(c.expectDeserialize.Algorithms, validateOutput.Algorithms); diff != "" { + if diff := cmpDiff(c.expectDeserialize.Algorithms, validateOutput.Algorithms); diff != "" { t.Errorf("expect algorithms match:\n%s", diff) } if e, a := c.expectDeserialize.IgnoreMultipartValidation, validateOutput.IgnoreMultipartValidation; e != a { @@ -372,7 +373,7 @@ func TestRemoveOutputMiddleware(t *testing.T) { "Deserialize stack step", } - if diff := cmp.Diff(expectStack, stack.List()); diff != "" { + if diff := cmpDiff(expectStack, stack.List()); diff != "" { t.Fatalf("expect stack list match:\n%s", diff) } } @@ -404,3 +405,10 @@ func nopFinalizeMiddleware(id string) middleware.FinalizeMiddleware { return next.HandleFinalize(ctx, input) }) } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} diff --git a/service/internal/checksum/middleware_compute_input_checksum_test.go b/service/internal/checksum/middleware_compute_input_checksum_test.go index c3362bf07e0..c8e97de22de 100644 --- a/service/internal/checksum/middleware_compute_input_checksum_test.go +++ b/service/internal/checksum/middleware_compute_input_checksum_test.go @@ -20,7 +20,6 @@ import ( "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" - "github.com/google/go-cmp/cmp" ) // TODO test cases: @@ -863,7 +862,7 @@ func TestComputeInputPayloadChecksum(t *testing.T) { ) { request := input.(*smithyhttp.Request) - if diff := cmp.Diff(c.expectHeader, request.Header); diff != "" { + if diff := cmpDiff(c.expectHeader, request.Header); diff != "" { t.Errorf("expect header to match:\n%s", diff) } if e, a := c.expectContentLength, request.ContentLength; e != a { @@ -883,7 +882,7 @@ func TestComputeInputPayloadChecksum(t *testing.T) { t.Fatalf("expected read error, got none") } - if diff := cmp.Diff(string(c.expectPayload), string(actualPayload)); diff != "" { + if diff := cmpDiff(string(c.expectPayload), string(actualPayload)); diff != "" { t.Errorf("expect payload match:\n%s", diff) } @@ -925,7 +924,7 @@ func TestComputeInputPayloadChecksum(t *testing.T) { t.Fatalf("expect checksum metadata %t, got %t, %v", e, a, computedMetadata) } if c.expectChecksumMetadata != nil { - if diff := cmp.Diff(c.expectChecksumMetadata, computedMetadata); diff != "" { + if diff := cmpDiff(c.expectChecksumMetadata, computedMetadata); diff != "" { t.Errorf("expect checksum metadata match\n%s", diff) } } diff --git a/service/internal/checksum/middleware_validate_output_test.go b/service/internal/checksum/middleware_validate_output_test.go index e6cf7054e85..0bf923e51e7 100644 --- a/service/internal/checksum/middleware_validate_output_test.go +++ b/service/internal/checksum/middleware_validate_output_test.go @@ -16,7 +16,6 @@ import ( "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" - "github.com/google/go-cmp/cmp" ) func TestValidateOutputPayloadChecksum(t *testing.T) { @@ -243,7 +242,7 @@ func TestValidateOutputPayloadChecksum(t *testing.T) { t.Errorf("expected %q logged in:\n%s", e, a) } - if diff := cmp.Diff(string(c.expectPayload), string(actualPayload)); diff != "" { + if diff := cmpDiff(string(c.expectPayload), string(actualPayload)); diff != "" { t.Errorf("expect payload match:\n%s", diff) } @@ -255,7 +254,7 @@ func TestValidateOutputPayloadChecksum(t *testing.T) { if ok != c.expectHaveAlgorithmsUsed { t.Errorf("expect metadata to contain algorithms used, %t", c.expectHaveAlgorithmsUsed) } - if diff := cmp.Diff(c.expectAlgorithmsUsed, values); diff != "" { + if diff := cmpDiff(c.expectAlgorithmsUsed, values); diff != "" { t.Errorf("expect algorithms used to match\n%s", diff) } }) diff --git a/service/internal/integrationtest/go.mod b/service/internal/integrationtest/go.mod index ae6f335f091..217055bcea4 100644 --- a/service/internal/integrationtest/go.mod +++ b/service/internal/integrationtest/go.mod @@ -87,7 +87,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/wafv2 v1.47.0 github.com/aws/aws-sdk-go-v2/service/workspaces v1.38.1 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) require ( diff --git a/service/internal/integrationtest/go.sum b/service/internal/integrationtest/go.sum index 373314e89bc..2230ad62888 100644 --- a/service/internal/integrationtest/go.sum +++ b/service/internal/integrationtest/go.sum @@ -3,7 +3,6 @@ github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/service/internal/integrationtest/s3/checksum_test.go b/service/internal/integrationtest/s3/checksum_test.go index 8ffd08d1544..02d6994f41c 100644 --- a/service/internal/integrationtest/s3/checksum_test.go +++ b/service/internal/integrationtest/s3/checksum_test.go @@ -7,16 +7,16 @@ import ( "bytes" "context" "fmt" + "io/ioutil" + "net/http" + "strings" + "testing" + "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/aws/aws-sdk-go-v2/service/s3/types" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/logging" - "github.com/google/go-cmp/cmp" - "io/ioutil" - "net/http" - "strings" - "testing" ) type retryClient struct { @@ -398,7 +398,7 @@ func TestInteg_ObjectChecksums(t *testing.T) { t.Fatalf("expect computed checksum metadata %t, got %t, %v", e, a, computedChecksums) } if c.expectComputedChecksums != nil { - if diff := cmp.Diff(*c.expectComputedChecksums, computedChecksums); diff != "" { + if diff := cmpDiff(*c.expectComputedChecksums, computedChecksums); diff != "" { t.Errorf("expect computed checksum metadata match\n%s", diff) } } @@ -426,7 +426,7 @@ func TestInteg_ObjectChecksums(t *testing.T) { return } - if diff := cmp.Diff(string(c.expectPayload), string(actualPayload)); diff != "" { + if diff := cmpDiff(string(c.expectPayload), string(actualPayload)); diff != "" { t.Errorf("expect payload match:\n%s", diff) } @@ -446,7 +446,7 @@ func TestInteg_ObjectChecksums(t *testing.T) { t.Fatalf("expect algorithms used metadata %t, got %t, %v", e, a, algorithmsUsed) } if c.expectAlgorithmsUsed != nil { - if diff := cmp.Diff(*c.expectAlgorithmsUsed, algorithmsUsed); diff != "" { + if diff := cmpDiff(*c.expectAlgorithmsUsed, algorithmsUsed); diff != "" { t.Errorf("expect algorithms used to match\n%s", diff) } } diff --git a/service/internal/integrationtest/s3/presign_test.go b/service/internal/integrationtest/s3/presign_test.go index 707a804f641..a2fb1e776ee 100644 --- a/service/internal/integrationtest/s3/presign_test.go +++ b/service/internal/integrationtest/s3/presign_test.go @@ -10,6 +10,7 @@ import ( "io" "io/ioutil" "net/http" + "reflect" "strconv" "testing" "time" @@ -19,7 +20,6 @@ import ( "github.com/aws/aws-sdk-go-v2/service/internal/integrationtest" "github.com/aws/aws-sdk-go-v2/service/s3" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" - "github.com/google/go-cmp/cmp" ) func TestInteg_PresignURL(t *testing.T) { @@ -95,7 +95,7 @@ func TestInteg_PresignURL(t *testing.T) { t.Fatalf("expected %v header to be present in presigned url, got %v", k, presignRequest.SignedHeader) } - if diff := cmp.Diff(v, value); len(diff) != 0 { + if diff := cmpDiff(v, value); len(diff) != 0 { t.Fatalf("expected %v header value to be %v got %v", k, v, value) } } @@ -212,7 +212,7 @@ func TestInteg_MultipartPresignURL(t *testing.T) { t.Fatalf("expected %v header to be present in presigned url, got %v", k, presignRequest.SignedHeader) } - if diff := cmp.Diff(v, value); len(diff) != 0 { + if diff := cmpDiff(v, value); len(diff) != 0 { t.Fatalf("expected %v header value to be %v got %v", k, v, value) } } @@ -296,3 +296,10 @@ func sendHTTPRequest(presignRequest *v4.PresignedHTTPRequest, body io.Reader) (* resp, err := http.DefaultClient.Do(req) return resp, err } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} diff --git a/service/internal/presigned-url/go.mod b/service/internal/presigned-url/go.mod index d9f1144b858..19b05408b27 100644 --- a/service/internal/presigned-url/go.mod +++ b/service/internal/presigned-url/go.mod @@ -5,7 +5,6 @@ go 1.20 require ( github.com/aws/aws-sdk-go-v2 v1.25.2 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) replace github.com/aws/aws-sdk-go-v2 => ../../../ diff --git a/service/internal/presigned-url/go.sum b/service/internal/presigned-url/go.sum index 35ac695fb99..a0cddd7b526 100644 --- a/service/internal/presigned-url/go.sum +++ b/service/internal/presigned-url/go.sum @@ -1,4 +1,2 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/service/internal/presigned-url/middleware_test.go b/service/internal/presigned-url/middleware_test.go index 56ba1d9205b..a41c68f456c 100644 --- a/service/internal/presigned-url/middleware_test.go +++ b/service/internal/presigned-url/middleware_test.go @@ -2,7 +2,9 @@ package presignedurl import ( "context" + "fmt" "net/http" + "reflect" "strings" "testing" @@ -11,7 +13,6 @@ import ( "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" - "github.com/google/go-cmp/cmp" ) func TestPresignMiddleware(t *testing.T) { @@ -70,7 +71,7 @@ func TestPresignMiddleware(t *testing.T) { out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input := in.Parameters.(*mockURLPresignInput) - if diff := cmp.Diff(c.ExpectInput, input); len(diff) != 0 { + if diff := cmpDiff(c.ExpectInput, input); len(diff) != 0 { t.Errorf("expect input to be updated\n%s", diff) } @@ -149,3 +150,10 @@ func (*mockURLPresigner) PresignURL(ctx context.Context, srcRegion string, param SignedHeader: http.Header{}, }, nil } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} From 2d4fcc226289aaab084298d1dcf9ee352f208201 Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 6 Mar 2024 16:25:59 -0500 Subject: [PATCH 4/5] dep: remove go-cmp everywhere else --- modman.toml | 1 - .../internal/testing/eventstream_test.go | 31 ++++++++++--------- service/kinesis/internal/testing/go.mod | 1 - service/kinesis/internal/testing/go.sum | 2 -- service/s3/go.mod | 1 - service/s3/go.sum | 2 -- .../internal/customizations/presign_test.go | 19 ++++++++---- .../write_get_object_response_test.go | 27 ++++++++-------- .../internal/testing/eventstream_test.go | 27 ++++++++-------- .../internal/testing/go.mod | 1 - .../internal/testing/go.sum | 2 -- 11 files changed, 57 insertions(+), 57 deletions(-) diff --git a/modman.toml b/modman.toml index 6f931bef257..9f0568b39c4 100644 --- a/modman.toml +++ b/modman.toml @@ -2,7 +2,6 @@ [dependencies] "github.com/aws/aws-sdk-go" = "v1.44.28" "github.com/aws/smithy-go" = "v1.20.1" - "github.com/google/go-cmp" = "v0.5.8" "github.com/jmespath/go-jmespath" = "v0.4.0" "golang.org/x/net" = "v0.19.0" diff --git a/service/kinesis/internal/testing/eventstream_test.go b/service/kinesis/internal/testing/eventstream_test.go index 662c1c4e270..8f6d4b01213 100644 --- a/service/kinesis/internal/testing/eventstream_test.go +++ b/service/kinesis/internal/testing/eventstream_test.go @@ -4,6 +4,10 @@ import ( "bytes" "context" "errors" + "fmt" + "reflect" + "testing" + "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream" "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi" @@ -11,11 +15,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/kinesis" "github.com/aws/aws-sdk-go-v2/service/kinesis/types" "github.com/aws/smithy-go" - "github.com/aws/smithy-go/document" "github.com/aws/smithy-go/middleware" - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "testing" ) func removeValidationMiddleware(stack *middleware.Stack) error { @@ -79,7 +79,7 @@ func TestSubscribeToShard_Read(t *testing.T) { if event == nil { t.Errorf("%d, expect event, got nil", i) } - if diff := cmp.Diff(expectEvents[i], event, cmpopts.IgnoreTypes(document.NoSerde{})); len(diff) > 0 { + if diff := cmpDiff(expectEvents[i], event); len(diff) > 0 { t.Errorf("%d, %v", i, diff) } } @@ -229,7 +229,7 @@ func TestSubscribeToShard_ReadUnknownEvent(t *testing.T) { if event == nil { t.Errorf("%d, expect event, got nil", i) } - if diff := cmp.Diff(expectEvents[i], event, cmpopts.IgnoreTypes(document.NoSerde{})); len(diff) > 0 { + if diff := cmpDiff(expectEvents[i], event); len(diff) > 0 { t.Errorf("%d, %v", i, diff) } } @@ -295,10 +295,9 @@ func TestSubscribeToShard_ReadException(t *testing.T) { t.Errorf("expect err type %T", expectedErr) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &types.InternalFailureException{Message: aws.String("this is an exception message")}, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } @@ -360,13 +359,12 @@ func TestSubscribeToShard_ReadUnmodeledException(t *testing.T) { t.Errorf("expect err type %T", expectedErr) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &smithy.GenericAPIError{ Code: "UnmodeledException", Message: "this is an unmodeled exception message", }, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } @@ -432,13 +430,12 @@ func TestSubscribeToShard_ReadErrorEvent(t *testing.T) { t.Errorf("expect err type %T", expectedErr) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &smithy.GenericAPIError{ Code: "AnErrorCode", Message: "An error message", }, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } @@ -474,14 +471,20 @@ func TestSubscribeToShard_ResponseError(t *testing.T) { t.Errorf("expect err type %T, got %v", expectedErr, err) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &smithy.GenericAPIError{ Code: "UnknownError", Message: "this is an exception message", }, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} diff --git a/service/kinesis/internal/testing/go.mod b/service/kinesis/internal/testing/go.mod index e99c01599d0..b088b313ad1 100644 --- a/service/kinesis/internal/testing/go.mod +++ b/service/kinesis/internal/testing/go.mod @@ -8,7 +8,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/eventstreamtesting v1.3.6 github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.1 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) require ( diff --git a/service/kinesis/internal/testing/go.sum b/service/kinesis/internal/testing/go.sum index 1a43b7a6788..86b15c71971 100644 --- a/service/kinesis/internal/testing/go.sum +++ b/service/kinesis/internal/testing/go.sum @@ -2,8 +2,6 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/service/s3/go.mod b/service/s3/go.mod index 384945ff07c..bd1f3b62007 100644 --- a/service/s3/go.mod +++ b/service/s3/go.mod @@ -13,7 +13,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.4 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.2 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) replace github.com/aws/aws-sdk-go-v2 => ../../ diff --git a/service/s3/go.sum b/service/s3/go.sum index 35ac695fb99..a0cddd7b526 100644 --- a/service/s3/go.sum +++ b/service/s3/go.sum @@ -1,4 +1,2 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/service/s3/internal/customizations/presign_test.go b/service/s3/internal/customizations/presign_test.go index fb689cba3ba..5321ec99ff9 100644 --- a/service/s3/internal/customizations/presign_test.go +++ b/service/s3/internal/customizations/presign_test.go @@ -3,12 +3,12 @@ package customizations_test import ( "bytes" "context" + "fmt" "net/http" + "reflect" "strings" "testing" - "github.com/google/go-cmp/cmp" - "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/awstesting/unit" "github.com/aws/aws-sdk-go-v2/service/s3" @@ -273,8 +273,8 @@ func TestPutObject_PresignURL(t *testing.T) { } } - if e, a := c.expectSignedHeader, req.SignedHeader; len(cmp.Diff(e, a)) != 0 { - t.Fatalf("expected signed header to be %s, got %s, \n diff : %s", e, a, cmp.Diff(e, a)) + if e, a := c.expectSignedHeader, req.SignedHeader; len(cmpDiff(e, a)) != 0 { + t.Fatalf("expected signed header to be %s, got %s, \n diff : %s", e, a, cmpDiff(e, a)) } if e, a := c.expectMethod, req.Method; !strings.EqualFold(e, a) { @@ -459,8 +459,8 @@ func TestUploadPart_PresignURL(t *testing.T) { } } - if e, a := c.expectSignedHeader, req.SignedHeader; len(cmp.Diff(e, a)) != 0 { - t.Fatalf("expected signed header to be %s, got %s, \n diff : %s", e, a, cmp.Diff(e, a)) + if e, a := c.expectSignedHeader, req.SignedHeader; len(cmpDiff(e, a)) != 0 { + t.Fatalf("expected signed header to be %s, got %s, \n diff : %s", e, a, cmpDiff(e, a)) } if e, a := c.expectMethod, req.Method; !strings.EqualFold(e, a) { @@ -470,3 +470,10 @@ func TestUploadPart_PresignURL(t *testing.T) { }) } } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} diff --git a/service/s3/internal/customizations/write_get_object_response_test.go b/service/s3/internal/customizations/write_get_object_response_test.go index fb5de85d4dc..0a7749ac97d 100644 --- a/service/s3/internal/customizations/write_get_object_response_test.go +++ b/service/s3/internal/customizations/write_get_object_response_test.go @@ -12,7 +12,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/go-cmp/cmp" ) type readSeeker struct { @@ -65,11 +64,11 @@ func TestWriteGetObjectResponse(t *testing.T) { t.Errorf("expect no transfer-encoding") } - if diff := cmp.Diff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { t.Error(diff) } - if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } @@ -77,7 +76,7 @@ func TestWriteGetObjectResponse(t *testing.T) { if err != nil { t.Errorf("expect no error, got %v", err) } - if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { + if diff := cmpDiff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) @@ -98,11 +97,11 @@ func TestWriteGetObjectResponse(t *testing.T) { t.Errorf("expect no transfer-encoding") } - if diff := cmp.Diff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { t.Error(diff) } - if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } @@ -110,7 +109,7 @@ func TestWriteGetObjectResponse(t *testing.T) { if err != nil { t.Errorf("expect no error, got %v", err) } - if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { + if diff := cmpDiff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) @@ -131,11 +130,11 @@ func TestWriteGetObjectResponse(t *testing.T) { t.Errorf("expect no transfer-encoding") } - if diff := cmp.Diff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { t.Error(diff) } - if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } @@ -143,7 +142,7 @@ func TestWriteGetObjectResponse(t *testing.T) { if err != nil { t.Errorf("expect no error, got %v", err) } - if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { + if diff := cmpDiff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) @@ -161,15 +160,15 @@ func TestWriteGetObjectResponse(t *testing.T) { return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { expectedInput := []byte("test input") - if diff := cmp.Diff(request.TransferEncoding, []string{"chunked"}); len(diff) > 0 { + if diff := cmpDiff(request.TransferEncoding, []string{"chunked"}); len(diff) > 0 { t.Error(diff) } - if diff := cmp.Diff(request.Header.Get(contentLength), ""); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentLength), ""); len(diff) > 0 { t.Error(diff) } - if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { + if diff := cmpDiff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } @@ -177,7 +176,7 @@ func TestWriteGetObjectResponse(t *testing.T) { if err != nil { t.Errorf("expect no error, got %v", err) } - if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { + if diff := cmpDiff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) diff --git a/service/transcribestreaming/internal/testing/eventstream_test.go b/service/transcribestreaming/internal/testing/eventstream_test.go index 55dad9551a7..aa38355401b 100644 --- a/service/transcribestreaming/internal/testing/eventstream_test.go +++ b/service/transcribestreaming/internal/testing/eventstream_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "errors" + "fmt" "reflect" "strings" "sync" @@ -17,10 +18,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/transcribestreaming" "github.com/aws/aws-sdk-go-v2/service/transcribestreaming/types" "github.com/aws/smithy-go" - "github.com/aws/smithy-go/document" "github.com/aws/smithy-go/middleware" - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" ) func removeValidationMiddleware(stack *middleware.Stack) error { @@ -77,7 +75,7 @@ func TestStartStreamTranscription_Read(t *testing.T) { if event == nil { t.Errorf("%d, expect event, got nil", i) } - if diff := cmp.Diff(expectEvents[i], event, cmpopts.IgnoreTypes(document.NoSerde{})); len(diff) > 0 { + if diff := cmpDiff(expectEvents[i], event); len(diff) > 0 { t.Errorf("%d, %v", i, diff) } } @@ -211,7 +209,7 @@ func TestStartStreamTranscription_ReadUnknownEvent(t *testing.T) { if event == nil { t.Errorf("%d, expect event, got nil", i) } - if diff := cmp.Diff(expectEvents[i], event, cmpopts.IgnoreTypes(document.NoSerde{})); len(diff) > 0 { + if diff := cmpDiff(expectEvents[i], event); len(diff) > 0 { t.Errorf("%d, %v", i, diff) } } @@ -268,10 +266,9 @@ func TestStartStreamTranscription_ReadException(t *testing.T) { t.Errorf("expect err type %T", expectedErr) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &types.BadRequestException{Message: aws.String("this is an exception message")}, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } @@ -324,13 +321,12 @@ func TestStartStreamTranscription_ReadUnmodeledException(t *testing.T) { t.Errorf("expect err type %T", expectedErr) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &smithy.GenericAPIError{ Code: "UnmodeledException", Message: "this is an unmodeled exception message", }, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } @@ -387,13 +383,12 @@ func TestStartStreamTranscription_ReadErrorEvent(t *testing.T) { t.Errorf("expect err type %T", expectedErr) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &smithy.GenericAPIError{ Code: "AnErrorCode", Message: "An error message", }, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } @@ -647,14 +642,20 @@ func TestStartStreamTranscription_ResponseError(t *testing.T) { t.Errorf("expect err type %T, got %v", expectedErr, err) } - if diff := cmp.Diff( + if diff := cmpDiff( expectedErr, &smithy.GenericAPIError{ Code: "UnknownError", Message: "this is an exception message", }, - cmpopts.IgnoreTypes(document.NoSerde{}), ); len(diff) > 0 { t.Errorf(diff) } } + +func cmpDiff(e, a interface{}) string { + if !reflect.DeepEqual(e, a) { + return fmt.Sprintf("%v != %v", e, a) + } + return "" +} diff --git a/service/transcribestreaming/internal/testing/go.mod b/service/transcribestreaming/internal/testing/go.mod index e842b50d421..2da850a8770 100644 --- a/service/transcribestreaming/internal/testing/go.mod +++ b/service/transcribestreaming/internal/testing/go.mod @@ -8,7 +8,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/eventstreamtesting v1.3.6 github.com/aws/aws-sdk-go-v2/service/transcribestreaming v1.17.1 github.com/aws/smithy-go v1.20.1 - github.com/google/go-cmp v0.5.8 ) require ( diff --git a/service/transcribestreaming/internal/testing/go.sum b/service/transcribestreaming/internal/testing/go.sum index d7c940ea9e3..5a8520aaca4 100644 --- a/service/transcribestreaming/internal/testing/go.sum +++ b/service/transcribestreaming/internal/testing/go.sum @@ -1,7 +1,5 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= From 3e65df901a7a5c1c783ed6f3881dd3be21f89f6e Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 6 Mar 2024 16:27:07 -0500 Subject: [PATCH 5/5] mod tidy --- service/docdb/go.sum | 1 - service/ec2/go.sum | 1 - service/internal/benchmark/go.sum | 1 - service/internal/checksum/go.sum | 1 - service/neptune/go.sum | 1 - service/polly/go.sum | 1 - service/rds/go.sum | 1 - service/sts/go.sum | 1 - 8 files changed, 8 deletions(-) diff --git a/service/docdb/go.sum b/service/docdb/go.sum index 2230ad62888..63f954b78d9 100644 --- a/service/docdb/go.sum +++ b/service/docdb/go.sum @@ -2,7 +2,6 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/service/ec2/go.sum b/service/ec2/go.sum index 2230ad62888..63f954b78d9 100644 --- a/service/ec2/go.sum +++ b/service/ec2/go.sum @@ -2,7 +2,6 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/service/internal/benchmark/go.sum b/service/internal/benchmark/go.sum index 83de71c605c..009c8193894 100644 --- a/service/internal/benchmark/go.sum +++ b/service/internal/benchmark/go.sum @@ -4,7 +4,6 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/service/internal/checksum/go.sum b/service/internal/checksum/go.sum index d5d61042cef..a0cddd7b526 100644 --- a/service/internal/checksum/go.sum +++ b/service/internal/checksum/go.sum @@ -1,3 +1,2 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= diff --git a/service/neptune/go.sum b/service/neptune/go.sum index 2230ad62888..63f954b78d9 100644 --- a/service/neptune/go.sum +++ b/service/neptune/go.sum @@ -2,7 +2,6 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/service/polly/go.sum b/service/polly/go.sum index d5d61042cef..a0cddd7b526 100644 --- a/service/polly/go.sum +++ b/service/polly/go.sum @@ -1,3 +1,2 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= diff --git a/service/rds/go.sum b/service/rds/go.sum index 2230ad62888..63f954b78d9 100644 --- a/service/rds/go.sum +++ b/service/rds/go.sum @@ -2,7 +2,6 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/service/sts/go.sum b/service/sts/go.sum index d5d61042cef..a0cddd7b526 100644 --- a/service/sts/go.sum +++ b/service/sts/go.sum @@ -1,3 +1,2 @@ github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=