From e106b1a2f177e187337864f931cd6457ea0909bf Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Tue, 9 Dec 2014 10:40:01 -0600 Subject: [PATCH] Inline helper code --- helper/helper.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/helper/helper.go b/helper/helper.go index 72847a71..bfda4250 100644 --- a/helper/helper.go +++ b/helper/helper.go @@ -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() -}