Skip to content

Commit 7fc7987

Browse files
feat(jsii-pacmak): allow disabling go build conditionally (#4196)
In CDKTF this step causes our examples to take up to 24GB of Ram and ~5 minutes to have the bindings generated. We split our code into a lot of modules, so if a user just ran `go run ...` and only the parts needed would be compiled they can save a lot of time and resources.
1 parent 906c24d commit 7fc7987

File tree

1 file changed

+7
-1
lines changed
  • packages/jsii-pacmak/lib/targets

1 file changed

+7
-1
lines changed

packages/jsii-pacmak/lib/targets/go.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ export class Golang extends Target {
5454
);
5555
return Promise.reject(e);
5656
}
57-
await go('build', ['-modfile', localGoMod.path, './...'], { cwd: pkgDir });
57+
58+
if (process.env.JSII_BUILD_GO) {
59+
// This step is taken to ensure that the generated code is compilable
60+
await go('build', ['-modfile', localGoMod.path, './...'], {
61+
cwd: pkgDir,
62+
});
63+
}
5864

5965
// delete local.go.mod and local.go.sum from the output directory so it doesn't get published
6066
const localGoSum = `${path.basename(localGoMod.path, '.mod')}.sum`;

0 commit comments

Comments
 (0)