diff --git a/python/rpdk/go/codegen.py b/python/rpdk/go/codegen.py index 82cfb54c..5779b4a4 100644 --- a/python/rpdk/go/codegen.py +++ b/python/rpdk/go/codegen.py @@ -47,7 +47,9 @@ def __init__(self): def _prompt_for_go_path(self, project): path_validator = validate_path("") - import_path = path_validator(project.settings.get("import_path")) + import_path = path_validator( + project.settings.get("import_path", project.settings.get("importpath")) + ) if not import_path: prompt = "Enter the GO Import path" @@ -88,7 +90,11 @@ def init(self, project): path = project.root / "go.mod" LOG.debug("Writing go.mod: %s", path) template = self.env.get_template("go.mod.tple") - contents = template.render(path=Path(project.settings["import_path"])) + contents = template.render( + path=Path( + project.settings.get("import_path", project.settings.get("importpath")) + ) + ) project.safewrite(path, contents) # CloudFormation/SAM template for handler lambda @@ -169,7 +175,9 @@ def generate(self, project): path = root / "main.go" LOG.debug("Writing project: %s", path) template = self.env.get_template("main.go.tple") - importpath = Path(project.settings["import_path"]) + importpath = Path( + project.settings.get("import_path", project.settings.get("importpath")) + ) contents = template.render(path=(importpath / "cmd" / "resource").as_posix()) project.overwrite(path, contents) format_paths.append(path)