diff --git a/samples_1/go-lambda/Makefile b/samples_1/go-lambda/Makefile new file mode 100644 index 0000000..778486c --- /dev/null +++ b/samples_1/go-lambda/Makefile @@ -0,0 +1,6 @@ +.PHONY: build + +build: + @echo "Building..." + GOOS=linux go build -o bootstrap main.go + @echo "Build complete." diff --git a/samples_1/go-lambda/README.md b/samples_1/go-lambda/README.md index ef06b35..bf052c1 100644 --- a/samples_1/go-lambda/README.md +++ b/samples_1/go-lambda/README.md @@ -2,9 +2,8 @@ This is a very simple Hello World application written in Golang. ### Instructions -1. Build the binary to be compatible with Linux: `GOOS=linux go build main.go` -2. Zip up the binary: `zip main.zip ./main` -3. Invoke locally +1. Build the binary to be compatible with Linux: `make build` +2. Invoke locally ```bash $ echo '"world"' | sam local invoke @@ -15,4 +14,3 @@ $ echo '"world"' | sam local invoke "Hello world!" ``` - diff --git a/samples_1/go-lambda/bootstrap b/samples_1/go-lambda/bootstrap new file mode 100755 index 0000000..9d747d9 Binary files /dev/null and b/samples_1/go-lambda/bootstrap differ diff --git a/samples_1/go-lambda/go.mod b/samples_1/go-lambda/go.mod new file mode 100644 index 0000000..c22b3e8 --- /dev/null +++ b/samples_1/go-lambda/go.mod @@ -0,0 +1,5 @@ +module test + +go 1.22 + +require github.com/aws/aws-lambda-go v1.47.0 diff --git a/samples_1/go-lambda/go.sum b/samples_1/go-lambda/go.sum new file mode 100644 index 0000000..e803789 --- /dev/null +++ b/samples_1/go-lambda/go.sum @@ -0,0 +1,10 @@ +github.com/aws/aws-lambda-go v1.47.0 h1:0H8s0vumYx/YKs4sE7YM0ktwL2eWse+kfopsRI1sXVI= +github.com/aws/aws-lambda-go v1.47.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/samples_1/go-lambda/main b/samples_1/go-lambda/main new file mode 100755 index 0000000..9d747d9 Binary files /dev/null and b/samples_1/go-lambda/main differ diff --git a/samples_1/go-lambda/template.yaml b/samples_1/go-lambda/template.yaml index 74dbf31..0c1b6e7 100644 --- a/samples_1/go-lambda/template.yaml +++ b/samples_1/go-lambda/template.yaml @@ -1,12 +1,11 @@ -AWSTemplateFormatVersion : '2010-09-09' +AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 -Description: Hello World Go Lambda function +Description: Hello World Go Lambda function Resources: - Function: Type: AWS::Serverless::Function Properties: - Handler: main - CodeUri: ./main.zip - Runtime: go1.x + Handler: bootstrap + CodeUri: ./ + Runtime: provided.al2023