-
Notifications
You must be signed in to change notification settings - Fork 872
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
Created example for creating an AWS Lambda in Go #553
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build:: | ||
GOOS=linux GOARCH=amd64 go build -o ./handler/handler ./handler/handler.go | ||
zip -j ./handler/handler.zip ./handler/handler | ||
go build -o go-lambda main.go | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this last line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the example I was referring to, the first step was to build go, but to be honest, I've never tried not building it. EDIT: Just tried it on a different example, and seems like the changes to main.go don't persist unless I build it first. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My understanding is that if you have the binary there, then it will be used, but if you don't, then we will effectively @EvanBoyle Is that right? And if so, is it documented yet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just tested, and you're right that pulumi builds for us. I'll make this change with #554. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
package handler | ||
package main | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/aws/aws-lambda-go/lambda" | ||
) | ||
|
||
func Handler() (string, error) { | ||
return "hello", nil | ||
func handler(str string) (string, error) { | ||
return strings.ToUpper(str), nil | ||
} | ||
|
||
func main() { | ||
lambda.Start(Handler) | ||
lambda.Start(handler) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be inevitable - but having a Makefile here means this may not work well on Windows. There are some notes on doing this in a cross platform compatible way in https://github.com/aws/aws-lambda-go/blob/master/README.md#for-developers-on-windows.