Files
fn-serverless/examples/tutorial/hello/go/func.go
Reed Allman 1cdb47d6e9 server, examples, extensions lint compliant (#1109)
these are all automated changes suggested by golint
2018-07-04 15:23:15 +01: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.")
}