Created
February 24, 2019 22:47
-
-
Save Zemnmez/f61f091f164e49369b6b635491dfbc71 to your computer and use it in GitHub Desktop.
makefile for golang aws lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# expect handler/handlername handler/handler2 etc. | |
dist.zip: $(patsubst handler/%,dist/%,$(wildcard handler/*)) | |
zip -FSj $@ $^ | |
#getDeps = $(shell go list -f '{{.Deps}}' $(1) | xargs go list -f '{{$$this:=.}}{{range .GoFiles}}{{$$this.Dir}}/{{.}} {{end}}') | |
# maybe one day i will generate the deps dynamically lol | |
# must be forced because cant determine whether update is | |
# needed purely based on go files | |
dist/%: handler/% .FORCE | |
GO111MODULE=on GOOS=linux go build -v -o $@ $(addprefix ./,$(filter-out .FORCE,$<)) | |
.PHONY: run lambda | |
run lambda: dist.zip | |
sam local start-api --region us-west-1 --debug --env-vars .env.development.json | |
.PHONY: .FORCE | |
.FORCE: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment