From a3ade4e98eb83d91c41902325c419650230b8196 Mon Sep 17 00:00:00 2001 From: Tony Worm <1390600+verdverm@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:44:14 -0400 Subject: [PATCH] cmd/run: fix testing package usage for changes to API in go1.23 (#392) Co-authored-by: Tony Worm --- flow/testdata/tasks/api/req_001.txt | 9 +++++++-- script/runtime/exe_next.go | 6 +++++- script/runtime/exe_old.go | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/flow/testdata/tasks/api/req_001.txt b/flow/testdata/tasks/api/req_001.txt index adf075612..bdf555fff 100644 --- a/flow/testdata/tasks/api/req_001.txt +++ b/flow/testdata/tasks/api/req_001.txt @@ -35,7 +35,12 @@ tasks: { mask: { @task(st.Mask) val: call.resp.body - mask: { headers: "x-amzn-trace-id": string } + mask: { + headers: { + "x-amzn-trace-id": string + "x-request-start": string + } + } } out: { text: json.Indent(json.Marshal(mask.out), "", " ") +"\n" } @task(os.Stdout) } @@ -46,9 +51,9 @@ tasks: { "cow": "moo" }, "headers": { + "host": "postman-echo.com", "x-forwarded-proto": "https", "x-forwarded-port": "443", - "host": "postman-echo.com", "accept-encoding": "gzip", "user-agent": "Go-http-client/2.0" }, diff --git a/script/runtime/exe_next.go b/script/runtime/exe_next.go index 0e23fc4aa..8dbfd68c8 100644 --- a/script/runtime/exe_next.go +++ b/script/runtime/exe_next.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.18 +//go:build go1.23 package runtime @@ -65,3 +65,7 @@ func runCoverSubcommand(cprof string, mainf func() int) (exitCode int) { }() return mainf() } + +func (nopTestDeps) InitRuntimeCoverage() (mode string, tearDown func(string, string) (string, error), snapcov func() float64) { + return +} \ No newline at end of file diff --git a/script/runtime/exe_old.go b/script/runtime/exe_old.go index 11b123977..a3dd66161 100644 --- a/script/runtime/exe_old.go +++ b/script/runtime/exe_old.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !go1.18 +//go:build !go1.23 package runtime @@ -49,7 +49,7 @@ func runCoverSubcommand(cprof string, mainf func() int) (exitCode int) { // Run MainStart (recursively, but it we should be ok) with no tests // so that it writes the coverage profile. // go1.18 -- m := testing.MainStart(nopTestDeps{}, nil, nil, nil, nil) - m := testing.MainStart(nopTestDeps{}, nil, nil, nil) + m := testing.MainStart(nopTestDeps{}, nil, nil, nil, nil) if code := m.Run(); code != 0 && exitCode == 0 { exitCode = code }