diff --git a/cmd/commands/dlv/dlv.go b/cmd/commands/dlv/dlv.go index ba9ea28..ec0dafa 100644 --- a/cmd/commands/dlv/dlv.go +++ b/cmd/commands/dlv/dlv.go @@ -73,7 +73,7 @@ func runDlv(cmd *commands.Command, args []string) int { func runDelve(addr, debugname string) int { beeLogger.Log.Info("Starting Delve Debugger...") - err := utils.GoBuild(debugname, packageName) + err := gobuild(debugname, packageName) if err != nil { beeLogger.Log.Fatalf("%v", err) } @@ -89,9 +89,7 @@ func runDelve(addr, debugname string) int { beeLogger.Log.Fatalf("%v", err) } - // // Create and start the debugger server - // listener, err := net.Listen("tcp", addr) if err != nil { beeLogger.Log.Fatalf("Could not start listener: %s", err) @@ -110,9 +108,7 @@ func runDelve(addr, debugname string) int { beeLogger.Log.Fatalf("Could not start debugger server: %v", err) } - // // Start the Delve client REPL - // client := rpc2.NewClient(addr) term := terminal.New(client, nil) @@ -129,3 +125,11 @@ func runDelve(addr, debugname string) int { } return status } + +// gobuild runs the "go build" command on the specified package +func gobuild(debugname, pkg string) error { + args := []string{"-gcflags", "-N -l", "-o", debugname} + args = append(args, utils.SplitQuotedFields("-ldflags='-linkmode internal'")...) + args = append(args, pkg) + return utils.GoCommand("build", args...) +} diff --git a/utils/utils.go b/utils/utils.go index c197697..a7da051 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -343,17 +343,6 @@ func GoCommand(command string, args ...string) error { return goBuild.Run() } -// GoBuild runs the "go build" command on the specified package -func GoBuild(debugname, pkg string) error { - buildFlags := "-ldflags='-linkmode internal'" - args := []string{"-gcflags", "-N -l", "-o", debugname} - if buildFlags != "" { - args = append(args, SplitQuotedFields(buildFlags)...) - } - args = append(args, pkg) - return GoCommand("build", args...) -} - // SplitQuotedFields is like strings.Fields but ignores spaces // inside areas surrounded by single quotes. // To specify a single quote use backslash to escape it: '\''