serverless-go-build-new v0.1.1
Serverless Go Build NEW
A Serverless v1.x plugin to making building Go easy!
Use your serverless.yml file as your build script, allowing specifying public functions or .go files as your entry points. Also can start other serverless plugins before running tests, and of course properly packages the built binary for upload (by default even individually packages each binary for increased performance!).
Disclaimer
- I'm not the original creator of this plugin. This plugin is forked from sean9keenan@serverless-go-build.
- I'm forking and enhancing this plugin following my needs so i won't update the plugin if i don't need to, but feel free to open a PR if you think this plugin need enhancement.
- I'm not an expert JS developer, so feel free to open PR if there are some codes that can be optimized.
Enhancement / Changes Made
- Updates npm dependencies.
- Individual go build for single function/handler.
- Add UPX functionality using upx JS package.
- Package separation. I can't stand looking at large code in a file :')
- The default params is extracted to
defaultParams.js
. - The support / utils func is extracted to
lib/classFunc.js
.
- The default params is extracted to
Installation
npm install --save-dev serverless-go-build-new
Individual Go Build
Build go executable for specified handler only.
sls build -f <function1>
UPX Usage
List of UPX options.
functions:
function1:
upxEnabled: true
upxOption:
brute: true
custom:
go-build:
upxEnabled: true
upxOption:
brute: true
Upx is disabled by default globally and can be enabled globally at custom
.
If you want to only enable upx for several function, the upx need to be globally enabled and have the function disable the upx.
The function level settings will overwrite global level settings but the upx must be enabled globally first.
If there are 2 options given, only the first option is considered.