diff --git a/cli/state.go b/cli/state.go index 6af988531..8c5d712d0 100644 --- a/cli/state.go +++ b/cli/state.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "html/template" + "io" "os" "reflect" "sort" @@ -874,7 +875,7 @@ var stateComputeStateCmd = &cli.Command{ return c.Code, nil } - return ComputeStateHTMLTempl(ts, stout, getCode) + return ComputeStateHTMLTempl(os.Stdout, ts, stout, getCode) } fmt.Println("computed state cid: ", stout.Root) @@ -1081,7 +1082,7 @@ type compStateHTMLIn struct { Comp *api.ComputeStateOutput } -func ComputeStateHTMLTempl(ts *types.TipSet, o *api.ComputeStateOutput, getCode func(addr address.Address) (cid.Cid, error)) error { +func ComputeStateHTMLTempl(w io.Writer, ts *types.TipSet, o *api.ComputeStateOutput, getCode func(addr address.Address) (cid.Cid, error)) error { t, err := template.New("compute_state").Funcs(map[string]interface{}{ "GetCode": getCode, "GetMethod": getMethod, @@ -1114,7 +1115,7 @@ func ComputeStateHTMLTempl(ts *types.TipSet, o *api.ComputeStateOutput, getCode return err } - return t.ExecuteTemplate(os.Stdout, "compute_state", &compStateHTMLIn{ + return t.ExecuteTemplate(w, "compute_state", &compStateHTMLIn{ TipSet: ts, Comp: o, })