File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
aws_lambda_builders/workflows/go_dep Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Go Dep - Lambda Builder
2
+
3
+ ## Scope
4
+ Building Go projects using the dep tool (https://github.com/golang/dep ) is rather simple, if you was to do
5
+ this by hand, you would perform these commands:
6
+
7
+ - `dep ensure`
8
+ - `GOOS=linux GOARCH=amd64 go build -o handler main.go`
9
+ - `zip -r source.zip`
10
+
11
+ The scope of the Go dep builder is to create a macro for these commands to ensure that spelling and paths are correct.
12
+ We don't have to care about versioning of the tooling of either Go or dep since Lambda doesn't have to care, and so it becomes
13
+ user preference.
14
+
15
+ ## Implementation
16
+ The go-dep builder runs the above commands with some minor tweaks, the commands ran on behalf of the user are:
17
+
18
+ 1. dep ensure
19
+ 2. GOOS=linux GOARCH=amd64 go build -o $ARTIFACT_DIR/$HANDLER_NAME $SOURCE_DIR
20
+
21
+ The main difference being we want to capture the compiled binary to package later, so the binary has the
22
+ output path as the artifact dir set by the caller.
23
+
24
+ ## Challenges
25
+ There are no challenges for go building, most problems have been abstracted away by the Go tooling
26
+
27
+ ## Notes
28
+ Go does native cross-compilation regardless of what's compiling it. Regardless of how the user builds their code it would run on
29
+ AWS Lambda.
30
+
31
+ ### Layers
32
+ This pattern might not work for Layers, plugins for go require an extra compilation flag (` -buildmode=plugin ` ), this would be something
33
+ to add later on, should SAM CLI support building layers
You can’t perform that action at this time.
0 commit comments