diff --git a/tools/flow/example_basic_test.go b/tools/flow/example_basic_test.go index b0eeb6c23..10a87208d 100644 --- a/tools/flow/example_basic_test.go +++ b/tools/flow/example_basic_test.go @@ -6,12 +6,13 @@ import ( "log" "cuelang.org/go/cue" + "cuelang.org/go/cue/cuecontext" "cuelang.org/go/tools/flow" ) func Example() { - var r cue.Runtime - inst, err := r.Compile("example.cue", ` + ctx := cuecontext.New() + v := ctx.CompileString(` a: { input: "world" output: string @@ -21,10 +22,10 @@ func Example() { output: string } `) - if err != nil { + if err := v.Err(); err != nil { log.Fatal(err) } - controller := flow.New(nil, inst, ioTaskFunc) + controller := flow.New(nil, v, ioTaskFunc) if err := controller.Run(context.Background()); err != nil { log.Fatal(err) } diff --git a/tools/flow/flow_test.go b/tools/flow/flow_test.go index fbd8907c1..aab6bf9ee 100644 --- a/tools/flow/flow_test.go +++ b/tools/flow/flow_test.go @@ -248,15 +248,15 @@ func TestX(t *testing.T) { t.Skip() } - rt := cue.Runtime{} - inst, err := rt.Compile("", in) - if err != nil { + rt := cuecontext.New() + v := rt.CompileString(in) + if err := v.Err(); err != nil { t.Fatal(err) } c := flow.New(&flow.Config{ Root: cue.ParsePath("root"), - }, inst, taskFunc) + }, v, taskFunc) t.Error(mermaidGraph(c))