Skip to content

Instantly share code, notes, and snippets.

cmd = exec.Command("go", "build", "-o", executableOutput, "-tags", "lambdabinary", ".")
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "GOOS=linux", "GOARCH=amd64")
ctx.logger.WithFields(logrus.Fields{
"Name": executableOutput,
}).Info("Compiling binary")
err = runOSCommand(cmd, ctx.logger)
func NewLambda(roleNameOrIAMRoleDefinition interface{},
fn LambdaFunction,
lambdaOptions *LambdaFunctionOptions) *LambdaAWSInfo {
if nil == lambdaOptions {
lambdaOptions = &LambdaFunctionOptions{"", 128, 3, nil}
}
lambdaPtr := runtime.FuncForPC(reflect.ValueOf(fn).Pointer())
lambda := &LambdaAWSInfo{
lambdaFnName: lambdaPtr.Name(),
lambdaFn: fn,
var createForwarder = function(path) {
var forwardToGolangProcess = function(event, context, metricName)
{
if (!golangProcess) {
ensureGoLangBinary(function() {
golangProcess = child_process.spawn(SPARTA_BINARY_PATH, ['execute', '--signal', process.pid], {});
golangProcess.stdout.on('data', function(buf) {
buf.toString('utf-8').split('\n').forEach(function (eachLine) {
sparta_utils.log(eachLine);
INFO[0000] Welcome to Sparta Option=provision TS=2016-04-11T17:16:54Z Version=0.5.5
INFO[0000] --------------------------------------------------------------------------------
INFO[0000] Verifying IAM Lambda execution roles
INFO[0000] IAM roles verified Count=1
INFO[0000] Running `go generate`
INFO[0000] Compiling binary Name=SpartaHelloWorld.lambda.amd64
INFO[0008] Executable binary size KB=13317 MB=13
INFO[0008] Creating ZIP archive for upload TempName=/Users/mweagle/Documents/gopath/src/MediumPost/SpartaHelloWorld440815707
INFO[0009] Registering Sparta function FunctionName=main.helloWorld
INFO[0009] Lambda function deployment package size KB=4779 MB=4
@mweagle
mweagle / application.go
Last active April 11, 2016 16:40
Hello world for Medium
// File: application.go
package main
import (
"encoding/json"
"fmt"
"net/http"
"github.com/Sirupsen/logrus"
sparta "github.com/mweagle/Sparta"