Skip to content
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 60 commits into from
Aug 21, 2020

Commits on Apr 15, 2020

  1. feat(golang): introduce Golang code generation

    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...
    RomainMuller committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    75988da View commit details
    Browse the repository at this point in the history

Commits on May 14, 2020

  1. Configuration menu
    Copy the full SHA
    ffbaf86 View commit details
    Browse the repository at this point in the history

Commits on May 26, 2020

  1. Configuration menu
    Copy the full SHA
    48337ae View commit details
    Browse the repository at this point in the history

Commits on May 29, 2020

  1. Configuration menu
    Copy the full SHA
    3785aae View commit details
    Browse the repository at this point in the history
  2. feat: (wip) generate package and submodules

    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.
    SoManyHs committed May 29, 2020
    Configuration menu
    Copy the full SHA
    7c0a7aa View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2020

  1. Configuration menu
    Copy the full SHA
    b904706 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2020

  1. Configuration menu
    Copy the full SHA
    4e8977c View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2020

  1. Configuration menu
    Copy the full SHA
    20f1e88 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2020

  1. Configuration menu
    Copy the full SHA
    6066285 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2020

  1. Configuration menu
    Copy the full SHA
    e311dcd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f26997 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    51e7e3f View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2020

  1. Configuration menu
    Copy the full SHA
    a5f7a05 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    121383e View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2020

  1. test: run yarn test:update

    SoManyHs committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    586d037 View commit details
    Browse the repository at this point in the history
  2. fix: use camelcase on exported types

    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 committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    ad04878 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2020

  1. chore: fix linting and build issues

    so that yarn build actually succeeds
    SoManyHs committed Jul 28, 2020
    Configuration menu
    Copy the full SHA
    ef1a36b View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2020

  1. chore: ran yarn test:update

    SoManyHs committed Jul 29, 2020
    Configuration menu
    Copy the full SHA
    4aff177 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2020

  1. Configuration menu
    Copy the full SHA
    99b0aea View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2020

  1. Configuration menu
    Copy the full SHA
    344be72 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2020

  1. Configuration menu
    Copy the full SHA
    cf6927d View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2020

  1. Configuration menu
    Copy the full SHA
    9f1583b View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2020

  1. Configuration menu
    Copy the full SHA
    b3b3e3c View commit details
    Browse the repository at this point in the history
  2. chore: update test snapshot

    ran yarn test:update
    SoManyHs committed Aug 11, 2020
    Configuration menu
    Copy the full SHA
    beff382 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2020

  1. Configuration menu
    Copy the full SHA
    6e26d1c View commit details
    Browse the repository at this point in the history
  2. chore: fix typo

    SoManyHs committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    2ce497b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    abb52ec View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0b18bca View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2020

  1. Configuration menu
    Copy the full SHA
    2f56d2f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2c3e733 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    20ab90c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7d48a04 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ac5c9fd View commit details
    Browse the repository at this point in the history
  6. update pacmak snapshot

    MrArnoldPalmer committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    d5f0e91 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2020

  1. Configuration menu
    Copy the full SHA
    61dc2f2 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2020

  1. Configuration menu
    Copy the full SHA
    cfe4308 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    98d1838 View commit details
    Browse the repository at this point in the history
  3. chore: remove unused test expectations

    Expected output now lives in under the __snapshots__ dir
    SoManyHs committed Aug 17, 2020
    Configuration menu
    Copy the full SHA
    6a8ff76 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6453b80 View commit details
    Browse the repository at this point in the history
  5. fix: go package compile errors

    Fixes compiler errors on generated code with the following:
    
    1. Return placeholder types from JSII class method calls
    2. Prevent recursive structs by detecting types nested as properties
    within themselves and use a pointer instead
    3. Map TS `any` types to an empty struct `GoAny` to be provided by the
    JSII runtime library
    4. Fix `map` and slice type signatures in struct properties
    5. Fix submodule struct and `package` names
    6. Fix broken PascalCasing of return types in class methods when
    returning a named JSII type
    
    Also misc cleanup/enhancements:
    1. Call a dummy NoOp method inside JSII class method calls provided by
    runtime
    2. Add import statement for runtime library to modules
    3. Consolidate import statements
    MrArnoldPalmer committed Aug 17, 2020
    Configuration menu
    Copy the full SHA
    7cbb109 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2020

  1. chore: generate datatype interfaces

    TODO: isDataType() in jsii-reflect seems wrong -- would be nice to
    leverage this method in module.ts.
    SoManyHs committed Aug 18, 2020
    Configuration menu
    Copy the full SHA
    416f0b6 View commit details
    Browse the repository at this point in the history
  2. chore: pr feedback

    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.
    MrArnoldPalmer committed Aug 18, 2020
    Configuration menu
    Copy the full SHA
    0db0dbb View commit details
    Browse the repository at this point in the history
  3. chore: minimize interface changes

    Minimizes changes to interface type for refactoring to class layout
    based on struct/interface differences.
    MrArnoldPalmer committed Aug 18, 2020
    Configuration menu
    Copy the full SHA
    251d7b1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    19a12b9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4997976 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    572f151 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2020

  1. chore: update snapshot

    SoManyHs committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    2004385 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cc350c1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2234cb1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4784aa8 View commit details
    Browse the repository at this point in the history
  5. update snapshot

    MrArnoldPalmer committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    1b6baaf View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    34ca6ef View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3577d61 View commit details
    Browse the repository at this point in the history
  8. docs: add note about experimental go configuration

    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.
    MrArnoldPalmer committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    cc38941 View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2020

  1. Configuration menu
    Copy the full SHA
    fe5c165 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    dc3d70f View commit details
    Browse the repository at this point in the history
  3. chore: rename Module, Submodule (#1921)

    Renames module related classes to be more idiomatic to go package output.
    SoManyHs authored Aug 20, 2020
    Configuration menu
    Copy the full SHA
    917fac9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0e21021 View commit details
    Browse the repository at this point in the history
  5. chore: rename Package, again

    BasePackage => Package
    Package => RootPackage
    
    Note: RootPackage could be thought of as "module", but we are reserving
    that word due to "go mod"
    SoManyHs committed Aug 20, 2020
    Configuration menu
    Copy the full SHA
    4238e2a View commit details
    Browse the repository at this point in the history
  6. fix(go): remove runtime embed

    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.
    MrArnoldPalmer committed Aug 20, 2020
    Configuration menu
    Copy the full SHA
    541d714 View commit details
    Browse the repository at this point in the history