Test the observation example in Go
This commit is contained in:
@@ -158,13 +158,16 @@ func run() (summary, error) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
value, err := run()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err := json.NewEncoder(os.Stdout).Encode(value); err != nil {
|
||||
if err := execute(os.Stdout); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func execute(out io.Writer) error {
|
||||
value, err := run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return json.NewEncoder(out).Encode(value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user