-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple handlers in the same binary #182
Comments
A possible solution:
|
@benkehoe - This is a great suggestion and one I'd also like to see supported. |
Cool suggestion! This approach may also benefit cold-start times for users sharing a single jumbo .zip across many functions. I'll pass it along to the product team. |
This will help reduce boilerplate code: mains --> build. |
Can you already accomplish this goal through specifying the environment variable within the Can you specify a command line argument to the lambda? Then you might be able to use a CLI tool to generate subcommands within a single build. |
You're right that it might be possible to implement this as a library that would provide its own single handler function, which would then look up the actual handler name from an env var and delegate to it. I still think that should be seen as a temporary measure and native support should be the goal. |
Any updates on this ? |
For other languages on Lambda, a single deployment artifact (JAR or zip file) can have multiple handlers functions in them. Multiple Lambda functions can use the same deployment artifact, with different behavior based on the handler selected in the Lambda function configuration. For Go, this isn't possible.
lambda.Start(handler interface{})
takes a single function. This means a separate binary has to be built for every function, and since Go builds are statically linked, there's no speedup when functions share code. This has caused users create custom build systems like Fender has to parallelize their builds.This would be in concert with the Lambda service supporting handler function specification for Go functions in the API.
The text was updated successfully, but these errors were encountered: