提交 e106b1a2 编写于 作者: D Derek Parker

Inline helper code

上级 813340ab
......@@ -10,12 +10,10 @@ import (
"github.com/derekparker/delve/proctl"
)
type testfunc func(p *proctl.DebuggedProcess)
func WithTestProcess(name string, t *testing.T, fn testfunc) {
func WithTestProcess(name string, t *testing.T, fn func(p *proctl.DebuggedProcess)) {
runtime.LockOSThread()
base, err := compileTestProg(name)
if err != nil {
base := filepath.Base(name)
if err := exec.Command("go", "build", "-gcflags=-N -l", "-o", base, name+".go").Run(); err != nil {
t.Fatalf("Could not compile %s due to %s", name, err)
}
defer os.Remove("./" + base)
......@@ -29,8 +27,3 @@ func WithTestProcess(name string, t *testing.T, fn testfunc) {
fn(p)
}
func compileTestProg(source string) (string, error) {
base := filepath.Base(source)
return base, exec.Command("go", "build", "-gcflags=-N -l", "-o", base, source+".go").Run()
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册