Files
fn-serverless/examples/tutorial/hello/go/func.go
2017-10-18 14:32:34 +02:00

23 lines
365 B
Go

package main
import (
"encoding/json"
"fmt"
"log"
"os"
)
type Person struct {
Name string
}
func main() {
p := &Person{Name: "World"}
json.NewDecoder(os.Stdin).Decode(p)
mapD := map[string]string{"message": fmt.Sprintf("Hello %s", p.Name)}
mapB, _ := json.Marshal(mapD)
fmt.Println(string(mapB))
log.Println("---> stderr goes to the server logs.")
}