package main | |
import "log" | |
// Main is the function implementing the action | |
func Main(obj map[string]interface{}) map[string]interface{} { | |
// do your work | |
name, ok := obj["name"].(string) | |
if !ok { | |
name = "world" | |
} | |
msg := make(map[string]interface{}) | |
msg["message"] = "Hello, " + name + "!" | |
// log in stdout or in stderr | |
log.Printf("name=%s\n", name) | |
// encode the result back in json | |
return msg | |
} |