Skip to content

lambda-go-alpha: go build breaks with spaces in path #28555

@longtv2222

Description

@longtv2222

Describe the bug

Path with space breaks go build

Expected Behavior

go build completes sucessfully

Current Behavior

go build is failing

Stack trace:

> cdk synth

C:\Users\Long Viet Ta\git\work\cdk-test\lambda function
Bundling asset cdk-route-53-test-stack/GoFunction/Code/Stage...
go build -o C:\Users\Long Viet Ta\git\work\cdk-test\cdk.out\bundling-temp-b9e04c81c84f386d3b5ad1bd760e90d6db81a132ee3efa8c7bdbc23e0dce2635\bootstrap ./
package Viet is not in std (C:\Program Files\Go\src\Viet)
package Ta/git/work/cdk-test/cdk.out/bundling-temp-b9e04c81c84f386d3b5ad1bd760e90d6db81a132ee3efa8c7bdbc23e0dce2635/bootstrap is not in std (C:\Program Files\Go\src\Ta\git\work\cdk-test\cdk.out\bundling-temp-b9e04c81c84f386d3b5ad1bd760e90d6db81a132ee3efa8c7bdbc23e0dce2635\bootstrap)

Reproduction Steps

import * as cdk from "aws-cdk-lib";
import { GoFunction } from "@aws-cdk/aws-lambda-go-alpha";
import { Construct } from "constructs"
import * as path from "path";

export class CdkTestStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const entry = path.join(__dirname, "..", "lambda function")
    console.log(entry) // Outputting: C:\Users\My Name\git\work\cdk-test\lambda
    new GoFunction(this, "GoFunction", {
      entry
    });
  }
}

Possible Solution

Quoting go build output, currently, it looks like:

go build -o C:\Users\Long Viet Ta\git\work\cdk-test\cdk.out\bundling-temp-b9e04c81c84f386d3b5ad1bd760e90d6db81a132ee3efa8c7bdbc23e0dce2635\bootstrap ./

The fix add quotes to output, which looks like:

go build -o "C:\Users\Long Viet Ta\git\work\cdk-test\cdk.out\bundling-temp-b9e04c81c84f386d3b5ad1bd760e90d6db81a132ee3efa8c7bdbc23e0dce2635\bootstrap" ./

PR: #28554

Additional Information/Context

No response

CDK CLI Version

2.110.1

Framework Version

No response

Node.js Version

18.17.1

OS

Window

Language

TypeScript

Language Version

5.2.2

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions