mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
23 lines
359 B
Go
23 lines
359 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type Input struct {
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
func main() {
|
|
input := &Input{}
|
|
if err := json.NewDecoder(os.Stdin).Decode(input); err != nil {
|
|
// log.Println("Bad payload or no payload. Ignoring.", err)
|
|
}
|
|
if input.Name == "" {
|
|
input.Name = "World"
|
|
}
|
|
fmt.Printf("Hello %v!\n", input.Name)
|
|
}
|