From 3ac85dc3ca89ff621150aad1b50fb736ea0b5f9f Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Thu, 7 Apr 2022 16:26:41 +0200 Subject: [PATCH] tools/flow: get rid of deprecated cue.Runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel van Lohuizen Change-Id: If10d85c55e6ea9374054aa4a10a71ef6a32e3eb4 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/536071 Reviewed-by: Daniel Martí Reviewed-by: Roger Peppe Unity-Result: CUEcueckoo TryBot-Result: CUEcueckoo --- tools/flow/example_basic_test.go | 9 +++++---- tools/flow/flow_test.go | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) 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)) -- 2.51.2