Skip to content

Commit

Permalink
cmd/run: fix testing package usage for changes to API in go1.23 (#392)
Browse files Browse the repository at this point in the history
Co-authored-by: Tony Worm <[email protected]>
  • Loading branch information
verdverm and Tony Worm authored Jul 15, 2024
1 parent bebc58f commit a3ade4e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions flow/testdata/tasks/api/req_001.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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"
},
Expand Down
6 changes: 5 additions & 1 deletion script/runtime/exe_next.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions script/runtime/exe_old.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit a3ade4e

Please sign in to comment.