-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(golang): introduce Golang code generation #1551
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A new `Golang` code generation handler was added. It is a very early work-in-progress. Further development should happen mostly within `lib/targets/golang`, adding new classes and completing the `emit` handler to handle the element types. Disclaimer: some of the currently generated code may not be valid Go...
Note: Naming packages by the go convention (see: https://blog.golang.org/package-names) results in very long, hard to read package names, so we may want to consider breaking from convention and adding underscores, e.g.
RomainMuller
commented
Jun 12, 2020
…ang/code-generation
Structs and interfaces should not all be lowercased. Also adds newline after writing to-level package name and removes extra whitespace after method definitions. TODO: - Handle `any` type (does not exist in go) - Handle type unions - Capitalize any exported methods - Handle method arguments
SoManyHs
force-pushed
the
golang/code-generation
branch
from
July 1, 2020 05:03
871a768
to
ad04878
Compare
so that yarn build actually succeeds
Add some doc comments and cleanup. Changes the `Module` interface to an abstract base class that is extended by `Package` and `Submodule` to avoid repeating module build and emit logic. Change dynamic getters for module submodules and types to be built and set in constructor to avoid unecessary recomputation.
Minimizes changes to interface type for refactoring to class layout based on struct/interface differences.
…ang/code-generation-ast
Adds a section about configuring GoLang code generation in `docs/configuration.md`. Notes that go code generation is experimental and is not suitable for production use. Update snapshots.
Renames module related classes to be more idiomatic to go package output.
…ang/code-generation
BasePackage => Package Package => RootPackage Note: RootPackage could be thought of as "module", but we are reserving that word due to "go mod"
Removes the embedded runtime logic until an appropriate alternative is identified. The current strategy was causing the output byte array inside the snapshots to differ from user to user based on build environment. Fixes casing in `goModuleName` util to be all lower case.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
MrArnoldPalmer
added
the
pr/do-not-merge
This PR should not be merged at this time.
label
Aug 21, 2020
SoManyHs
approved these changes
Aug 21, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lezdothis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
contribution/core
This is a PR that came from AWS.
pr/do-not-merge
This PR should not be merged at this time.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new
GoLang
code generation handler. The handler defines Go specificgenerators for JSII submodules, interfaces, structs, and enums. The directory
structure of the generated code mirrors public submodules and namespaces defined
in the JSII module, ie, there is one file per namespace. The generated type
model is in progress and subject to change.
Adds documentation to
docs/configuration.md
about configuring the Go target.Go code generation can be enabled by adding the
go
key to thejsii
sectionof your package.json.
The Go target is not currently supported for production use. This is the first
iteration of code generation and does not define a target runtime library.
Relates to #83
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.