Skip to content

Commit

Permalink
Remove unused moduleVersion setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Yuan committed Nov 8, 2023
1 parent 391876c commit dffa6d0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
1 change: 0 additions & 1 deletion codegen/smithy-go-codegen-test/smithy-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<String> 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public static PluginContext buildMockPluginContext(
manifest,
serviceShapeId,
"example",
"0.0.1",
false);
}

Expand All @@ -80,7 +79,6 @@ public static PluginContext buildPluginContext(
FileManifest manifest,
String serviceShapeId,
String moduleName,
String moduleVersion,
Boolean generateGoMod
) {
return PluginContext.builder()
Expand All @@ -89,7 +87,6 @@ public static PluginContext buildPluginContext(
.settings(getSettingsNode(
serviceShapeId,
moduleName,
moduleVersion,
generateGoMod,
"Example"))
.build();
Expand All @@ -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))
Expand Down

0 comments on commit dffa6d0

Please sign in to comment.