Closed uccmen closed 4 years ago
As golang is a compiled language, hot reloading is not (yet?) supported:
If you use an interpreted language, local changes are made available within the same Docker container. This approach means you can reinvoke your Lambda function with no need for redeployment. source
That being said - ๐for this feature!
thanks @mijdavis2, I implemented a workaround (in the meantime) for hot reload to work when developing Go lambdas locally - https://github.com/uccmen/serverless-go
:+1:
๐
aws-sam-cli
mounts the CodeUri
directory and run the handler with the name Handler
in Docker. As such, you could (with a separate tool) watch the Go code for changes and build it. Because the CodeUri
is mounted, the recompiled version would be "visible" to the Docker container and you can run the new version without restarting the aws-sam-cli
.
@bernardobelchior Exactly.
I use https://github.com/cespare/reflex to watch and build
When running local start-api
could you build the invoked function defined in CodeUri
before mounting to Docker . Running sam build
every time is slow when you have large number of functions defined.
@uccmen We do support hot-reloading of each language. The term hot-reloading to us means we will always mount the CodeUri on the next invoke. This allows you to stand up one api locally, and change/build your code outside that process to be reflected on the next invoke.
Closing this as we currently support it, but if we have a misunderstanding please reopen or create a new issue.
Is it just me or hot-reloading doesn't work for lambdas written in golang?
cmd
hello/main.go
template.yml