Files
fn-serverless/images/hello/hello.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

22 lines
294 B
Go

package main
import (
"encoding/json"
"fmt"
"os"
)
type person struct {
Name string
}
func main() {
n := os.Getenv("NAME") // can grab name from env or input
if n == "" {
n = "World"
}
p := &person{Name: n}
json.NewDecoder(os.Stdin).Decode(p)
fmt.Printf("Hello %v!\n", p.Name)
}