Skip to content

Commit

Permalink
fix(go): shorten file names for sub-packages
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Feb 2, 2023
1 parent d0e4267 commit 5ff6c7b
Show file tree
Hide file tree
Showing 5 changed files with 20,661 additions and 26,865 deletions.
25 changes: 4 additions & 21 deletions packages/jsii-pacmak/lib/targets/go/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export abstract class Package {
if (this.types.length > 0) {
const { code } = context;

const initFile = join(this.directory, `${this.packageName}.go`);
const initFile = join(this.directory, `main.go`);
code.openFile(initFile);
code.line(`package ${this.packageName}`);
code.line();
Expand Down Expand Up @@ -238,10 +238,7 @@ export abstract class Package {

private emitTypes(context: EmitContext) {
for (const type of this.types) {
const filePath = join(
this.directory,
`${this.packageName}_${type.name}.go`,
);
const filePath = join(this.directory, `${type.name}.go`);
context.code.openFile(filePath);

this.emitHeader(context.code);
Expand All @@ -266,23 +263,9 @@ export abstract class Package {
return;
}

emit.call(
this,
join(
this.directory,
`${this.packageName}_${type.name}__runtime_type_checks.go`,
),
false,
);
emit.call(this, join(this.directory, `${type.name}__checks.go`), false);

emit.call(
this,
join(
this.directory,
`${this.packageName}_${type.name}__no_runtime_type_checking.go`,
),
true,
);
emit.call(this, join(this.directory, `${type.name}__no_checks.go`), true);

function emit(this: Package, filePath: string, forNoOp: boolean) {
code.openFile(filePath);
Expand Down
Loading

0 comments on commit 5ff6c7b

Please sign in to comment.