Skip to content

Commit

Permalink
fix(lambda-go): path with space breaks go build (#28554)
Browse files Browse the repository at this point in the history
Output path with space breaks go build

Solution: quoting `go build` output path

Closes #28555

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
longtv2222 authored Jan 3, 2024
1 parent 669e6ff commit a8a639e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-go-alpha/lib/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Bundling implements cdk.BundlingOptions {
const goBuildCommand: string = [
'go', 'build',
hasVendor ? '-mod=vendor': '',
'-o', `${pathJoin(outputDir, 'bootstrap')}`,
'-o', `"${pathJoin(outputDir, 'bootstrap')}"`,
`${this.props.goBuildFlags ? this.props.goBuildFlags.join(' ') : ''}`,
`${this.relativeEntryPath.replace(/\\/g, '/')}`,
].filter(c => !!c).join(' ');
Expand Down
12 changes: 6 additions & 6 deletions packages/@aws-cdk/aws-lambda-go-alpha/test/bundling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test('bundling', () => {
command: [
'bash', '-c',
[
'go build -o /asset-output/bootstrap ./cmd/api',
'go build -o "/asset-output/bootstrap" ./cmd/api',
].join(' && '),
],
}),
Expand Down Expand Up @@ -81,7 +81,7 @@ test('bundling with file as entry', () => {
command: [
'bash', '-c',
[
'go build -o /asset-output/bootstrap ./main.go',
'go build -o "/asset-output/bootstrap" ./main.go',
].join(' && '),
],
}),
Expand All @@ -102,7 +102,7 @@ test('bundling with file in subdirectory as entry', () => {
command: [
'bash', '-c',
[
'go build -o /asset-output/bootstrap ./cmd/api/main.go',
'go build -o "/asset-output/bootstrap" ./cmd/api/main.go',
].join(' && '),
],
}),
Expand All @@ -123,7 +123,7 @@ test('bundling with file other than main.go in subdirectory as entry', () => {
command: [
'bash', '-c',
[
'go build -o /asset-output/bootstrap ./cmd/api/api.go',
'go build -o "/asset-output/bootstrap" ./cmd/api/api.go',
].join(' && '),
],
}),
Expand Down Expand Up @@ -265,7 +265,7 @@ test('Go build flags can be passed', () => {
command: [
'bash', '-c',
[
'go build -o /asset-output/bootstrap -ldflags "-s -w" ./cmd/api',
'go build -o "/asset-output/bootstrap" -ldflags "-s -w" ./cmd/api',
].join(' && '),
],
}),
Expand Down Expand Up @@ -297,7 +297,7 @@ test('AssetHashType can be specified', () => {
command: [
'bash', '-c',
[
'go build -o /asset-output/bootstrap ./cmd/api',
'go build -o "/asset-output/bootstrap" ./cmd/api',
].join(' && '),
],
}),
Expand Down

0 comments on commit a8a639e

Please sign in to comment.