Ejemplo n.º 1
0
// Run adds the shim when runtime is "golang".
func (p *Plugin) Run(hook function.Hook, fn *function.Function) error {
	if hook != function.OpenHook || fn.Runtime != "golang" {
		return nil
	}

	fn.Shim = true
	fn.Runtime = "nodejs"
	fn.Hooks.Build = "GOOS=linux GOARCH=amd64 go build -o main main.go"
	fn.Hooks.Clean = "rm -f main"

	return nil
}
Ejemplo n.º 2
0
// Open adds the shim and golang defaults.
func (p *Plugin) Open(fn *function.Function) error {
	if fn.Runtime != Runtime {
		return nil
	}

	if fn.Hooks.Build == "" {
		fn.Hooks.Build = "GOOS=linux GOARCH=amd64 go build -o main main.go"
	}

	fn.Shim = true
	fn.Runtime = nodejs.Runtime
	fn.Hooks.Clean = "rm -f main"

	return nil
}