diff --git a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/SmithyGoDependency.java b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/SmithyGoDependency.java index d618dbc34..75cce524c 100644 --- a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/SmithyGoDependency.java +++ b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/SmithyGoDependency.java @@ -74,14 +74,10 @@ public final class SmithyGoDependency { public static final GoDependency SMITHY_ENDPOINTS = smithy("endpoints", "smithyendpoints"); public static final GoDependency SMITHY_ENDPOINT_RULESFN = smithy("endpoints/private/rulesfn"); - public static final GoDependency GO_CMP = goCmp("cmp"); - public static final GoDependency GO_CMP_OPTIONS = goCmp("cmp/cmpopts"); - public static final GoDependency GO_JMESPATH = goJmespath(null); public static final GoDependency MATH = stdlib("math"); private static final String SMITHY_SOURCE_PATH = "github.com/aws/smithy-go"; - private static final String GO_CMP_SOURCE_PATH = "github.com/google/go-cmp"; private static final String GO_JMESPATH_SOURCE_PATH = "github.com/jmespath/go-jmespath"; private SmithyGoDependency() { @@ -116,10 +112,6 @@ private static GoDependency smithy(String relativePath, String alias) { return relativePackage(SMITHY_SOURCE_PATH, relativePath, Versions.SMITHY_GO, alias); } - private static GoDependency goCmp(String relativePath) { - return relativePackage(GO_CMP_SOURCE_PATH, relativePath, Versions.GO_CMP, null); - } - private static GoDependency goJmespath(String relativePath) { return relativePackage(GO_JMESPATH_SOURCE_PATH, relativePath, Versions.GO_JMESPATH, null); } @@ -139,7 +131,6 @@ private static GoDependency relativePackage( private static final class Versions { private static final String GO_STDLIB = "1.15"; - private static final String GO_CMP = "v0.5.4"; private static final String SMITHY_GO = "v1.4.0"; private static final String GO_JMESPATH = "v0.4.0"; } diff --git a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointTestsGenerator.java b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointTestsGenerator.java index 751fc3297..2ed2fdca7 100644 --- a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointTestsGenerator.java +++ b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointTestsGenerator.java @@ -212,7 +212,6 @@ GoWriter.Writable generateExpectEndpoint(Optional expectEndpoi commonCodegenArgs, MapUtils.of( "urlParse", SymbolUtils.createValueSymbolBuilder("Parse", SmithyGoDependency.NET_URL).build(), - "cmpDiff", SymbolUtils.createPointableSymbolBuilder("Diff", SmithyGoDependency.GO_CMP).build(), "expectURL", endpoint.getUrl(), "headers", generateHeaders(endpoint.getHeaders()), "properties", generateProperties(endpoint.getProperties()), @@ -256,14 +255,10 @@ GoWriter.Writable generateHeaders(Map> headers) { GoWriter.Writable generateAssertFields() { return goTemplate(""" - if diff := $cmpDiff:T(expectEndpoint.Headers, result.Headers); diff != "" { - t.Errorf("expect headers to match\\n%s", diff) + if !$T(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\\n%v != %v", expectEndpoint.Headers, result.Headers) } - """, - MapUtils.of( - "cmpDiff", SymbolUtils.createPointableSymbolBuilder("Diff", SmithyGoDependency.GO_CMP).build(), - "cmpAllowUnexported", SymbolUtils.createPointableSymbolBuilder("AllowUnexported", - SmithyGoDependency.GO_CMP).build())); + """, SmithyGoDependency.REFLECT.valueSymbol("DeepEqual")); } GoWriter.Writable generateProperties(Map properties) { @@ -357,16 +352,12 @@ public GoWriter.Writable stringNode(StringNode stringNode) { GoWriter.Writable generateAssertProperties() { return goTemplate(""" - if diff := $cmpDiff:T(expectEndpoint.Properties, result.Properties, - $cmpAllowUnexported:T($propertiesType:T{}), - ); diff != "" { - t.Errorf("expect properties to match\\n%s", diff) + if !$reflectDeepEqual:T(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\\n%v != %v", expectEndpoint.Properties, result.Properties) } """, MapUtils.of( - "cmpDiff", SymbolUtils.createPointableSymbolBuilder("Diff", SmithyGoDependency.GO_CMP).build(), - "cmpAllowUnexported", SymbolUtils.createPointableSymbolBuilder("AllowUnexported", - SmithyGoDependency.GO_CMP).build(), + "reflectDeepEqual", SmithyGoDependency.REFLECT.valueSymbol("DeepEqual"), "propertiesType", SymbolUtils.createValueSymbolBuilder("Properties", SmithyGoDependency.SMITHY).build()));