{"id":23306,"library":"aws-cdk-aws-lambda-go-alpha","title":"AWS CDK AWS Lambda Go Alpha","description":"Alpha CDK construct library for deploying AWS Lambda functions written in Go. Provides the GoCode class to bundle Go code with build, dependencies, and bundling options. Part of the AWS CDK, version 2.252.0a0, alpha quality with frequent releases tied to CDK core.","status":"active","version":"2.252.0a0","language":"python","source_language":"en","source_url":"https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk-aws-lambda-go-alpha","tags":["aws","cdk","lambda","go","alpha"],"install":[{"cmd":"pip install aws-cdk-aws-lambda-go-alpha==2.252.0a0","lang":"bash","label":"Pip install with exact version"}],"dependencies":[{"reason":"Core CDK library required. Must match major version.","package":"aws-cdk-lib","optional":false},{"reason":"Constructions for Python Lambda, not Go.","package":"aws-cdk-aws-lambda-go-alpha","optional":true}],"imports":[{"note":"GoCode is in the alpha module, not in aws_lambda.","wrong":"from aws_cdk.aws_lambda import GoCode","symbol":"GoCode","correct":"from aws_cdk.aws_lambda_go_alpha import GoCode"}],"quickstart":{"code":"import aws_cdk as cdk\nfrom aws_cdk.aws_lambda import Function, Runtime, Code\nfrom aws_cdk.aws_lambda_go_alpha import GoCode\n\nclass MyStack(cdk.Stack):\n    def __init__(self, scope, id, **kwargs):\n        super().__init__(scope, id, **kwargs)\n        # Bundles Go code from the specified directory\n        go_code = GoCode.from_asset(\n            path=\"./my-go-lambda\",\n            cmd=[\"go\", \"build\", \"-o\", \"/asset/main\"],\n        )\n        Function(\n            self, \"GoFunction\",\n            runtime=Runtime.PROVIDED_AL2,  # Use custom runtime for Go\n            handler=\"main\",\n            code=go_code,\n        )\n\napp = cdk.App()\nMyStack(app, \"GoLambdaStack\")\napp.synth()","lang":"python","description":"Minimal CDK stack defining a Go Lambda function using GoCode with asset bundling."},"warnings":[{"fix":"Pin to a specific alpha version and test upgrades carefully.","message":"The alpha module 'aws-cdk-aws-lambda-go-alpha' is in alpha status. The API may change in breaking ways in future releases.","severity":"deprecated","affected_versions":"all"},{"fix":"Ensure the path points to a directory with go.mod and source files.","message":"GoCode.from_asset expects a directory containing a Go module (go.mod). If you use a single file, bundling may fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Set runtime=Runtime.PROVIDED_AL2 when using GoCode.","message":"The runtime for Go Lambda must be either Runtime.PROVIDED_AL2 or Runtime.PROVIDED (not a runtime like Python/Node). Using wrong runtime causes invocation errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Update imports to `from aws_cdk.aws_lambda_go_alpha import GoCode`.","message":"Versions before 2.25.0 used a different import path (`aws_cdk.aws_lambda_go`). The module was moved to alpha prefix.","severity":"breaking","affected_versions":"<2.25.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install: pip install aws-cdk-aws-lambda-go-alpha[=version]. Import: from aws_cdk.aws_lambda_go_alpha import GoCode.","cause":"Missing installation of the alpha package or import path incorrect.","error":"ModuleNotFoundError: No module named 'aws_cdk.aws_lambda_go_alpha'"},{"fix":"Ensure path is a directory with a valid Go module (go.mod present). Use cmd to specify build command.","cause":"The asset path does not contain a go.mod file or points to a single file instead of a directory.","error":"Error: Failed to bundle Go code: no go.mod file found"},{"fix":"Set runtime=Runtime.PROVIDED_AL2 and handler='main' (matches compiled binary name).","cause":"Handler name mismatch or runtime not set to PROVIDED_AL2.","error":"Runtime.InvalidEntrypoint: 'handler' is not a valid entry point"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}