Skip to content

Commit

Permalink
fix(go): Submodule File Paths
Browse files Browse the repository at this point in the history
Fixes go code generation for submodules. File paths were only nesting
for immediate children and not deeply nested ones.
  • Loading branch information
MrArnoldPalmer committed Oct 20, 2020
1 parent 21c6fb5 commit 9530936
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 31 deletions.
11 changes: 6 additions & 5 deletions packages/jsii-pacmak/lib/targets/go/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export abstract class Package {
const moduleName = pack.root.moduleName;
const prefix = moduleName !== '' ? `${moduleName}/` : '';
const rootPackageName = pack.root.packageName;
const suffix = pack.filePath !== '' ? `/${pack.filePath}` : '';
const suffix = pack.filePath !== '' ? `/${pack.filePath}` : ``;
return `${prefix}${rootPackageName}${suffix}`;
}),
);
Expand Down Expand Up @@ -258,11 +258,12 @@ export class RootPackage extends Package {
* InternalPackage refers to any go package within a given JSII module.
*/
export class InternalPackage extends Package {
public readonly pkg: Package;
public readonly parent: Package;

public constructor(root: Package, pkg: Package, assembly: JsiiSubmodule) {
public constructor(root: Package, parent: Package, assembly: JsiiSubmodule) {
const packageName = goPackageName(assembly.name);
const filePath = pkg === root ? packageName : pkg.filePath;
const filePath =
parent === root ? packageName : `${parent.filePath}/${packageName}`;

super(
assembly.types,
Expand All @@ -273,6 +274,6 @@ export class InternalPackage extends Package {
root,
);

this.pkg = pkg;
this.parent = parent;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9530936

Please sign in to comment.