From dffa6d049cfe196406819f5fb583c0d41367c695 Mon Sep 17 00:00:00 2001 From: Steven Yuan Date: Wed, 8 Nov 2023 11:07:52 -0800 Subject: [PATCH] Remove unused `moduleVersion` setting --- .../smithy-go-codegen-test/smithy-build.json | 1 - .../amazon/smithy/go/codegen/GoSettings.java | 26 +------------------ .../amazon/smithy/go/codegen/TestUtils.java | 5 ---- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/codegen/smithy-go-codegen-test/smithy-build.json b/codegen/smithy-go-codegen-test/smithy-build.json index aa8536523..f44b2f2d5 100644 --- a/codegen/smithy-go-codegen-test/smithy-build.json +++ b/codegen/smithy-go-codegen-test/smithy-build.json @@ -4,7 +4,6 @@ "go-client-codegen": { "service": "example.weather#Weather", "module": "github.com/aws/smithy-go/internal/tests/service/weather", - "moduleVersion": "0.0.1", "generateGoMod": true, "goDirective": "1.21" } diff --git a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/GoSettings.java b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/GoSettings.java index 88dd2ad1d..9e5af6d12 100644 --- a/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/GoSettings.java +++ b/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/GoSettings.java @@ -17,7 +17,6 @@ import java.util.Arrays; import java.util.Objects; -import java.util.Optional; import java.util.Set; import software.amazon.smithy.codegen.core.CodegenException; import software.amazon.smithy.model.Model; @@ -35,13 +34,11 @@ public final class GoSettings { private static final String SERVICE = "service"; private static final String MODULE_NAME = "module"; - private static final String MODULE_VERSION = "moduleVersion"; private static final String GENERATE_GO_MOD = "generateGoMod"; private static final String GO_DIRECTIVE = "goDirective"; private ShapeId service; private String moduleName; - private String moduleVersion; private Boolean generateGoMod = false; private String goDirective = GoModuleInfo.DEFAULT_GO_DIRECTIVE; private ShapeId protocol; @@ -55,11 +52,10 @@ public final class GoSettings { public static GoSettings from(ObjectNode config) { GoSettings settings = new GoSettings(); config.warnIfAdditionalProperties( - Arrays.asList(SERVICE, MODULE_NAME, MODULE_VERSION, GENERATE_GO_MOD, GO_DIRECTIVE)); + Arrays.asList(SERVICE, MODULE_NAME, GENERATE_GO_MOD, GO_DIRECTIVE)); settings.setService(config.expectStringMember(SERVICE).expectShapeId()); settings.setModuleName(config.expectStringMember(MODULE_NAME).getValue()); - settings.setModuleVersion(config.getStringMemberOrDefault(MODULE_VERSION, null)); settings.setGenerateGoMod(config.getBooleanMemberOrDefault(GENERATE_GO_MOD, false)); settings.setGoDirective(config.getStringMemberOrDefault(GO_DIRECTIVE, GoModuleInfo.DEFAULT_GO_DIRECTIVE)); return settings; @@ -119,26 +115,6 @@ public void setModuleName(String moduleName) { this.moduleName = Objects.requireNonNull(moduleName); } - /** - * Gets the optional module version for the module that will be generated. - * - * @return Returns the module version. - */ - public Optional getModuleVersion() { - return Optional.ofNullable(moduleVersion); - } - - /** - * Sets the version of the module to generate. - * - * @param moduleVersion The version of the module to generate. - */ - public void setModuleVersion(String moduleVersion) { - if (moduleVersion != null) { - this.moduleVersion = moduleVersion; - } - } - /** * Gets the flag for generating go.mod file. * diff --git a/codegen/smithy-go-codegen/src/test/java/software/amazon/smithy/go/codegen/TestUtils.java b/codegen/smithy-go-codegen/src/test/java/software/amazon/smithy/go/codegen/TestUtils.java index dcf5b6ed8..442b6fed1 100644 --- a/codegen/smithy-go-codegen/src/test/java/software/amazon/smithy/go/codegen/TestUtils.java +++ b/codegen/smithy-go-codegen/src/test/java/software/amazon/smithy/go/codegen/TestUtils.java @@ -71,7 +71,6 @@ public static PluginContext buildMockPluginContext( manifest, serviceShapeId, "example", - "0.0.1", false); } @@ -80,7 +79,6 @@ public static PluginContext buildPluginContext( FileManifest manifest, String serviceShapeId, String moduleName, - String moduleVersion, Boolean generateGoMod ) { return PluginContext.builder() @@ -89,7 +87,6 @@ public static PluginContext buildPluginContext( .settings(getSettingsNode( serviceShapeId, moduleName, - moduleVersion, generateGoMod, "Example")) .build(); @@ -98,14 +95,12 @@ public static PluginContext buildPluginContext( public static ObjectNode getSettingsNode( String serviceShapeId, String moduleName, - String moduleVersion, Boolean generateGoMod, String sdkId ) { return Node.objectNodeBuilder() .withMember("service", Node.from(serviceShapeId)) .withMember("module", Node.from(moduleName)) - .withMember("moduleVersion", Node.from(moduleVersion)) .withMember("generateGoMod", Node.from(generateGoMod)) .withMember("homepage", Node.from("https://docs.amplify.aws/")) .withMember("sdkId", Node.from(sdkId))