1
0
镜像自地址 https://github.com/beego/bee.git 已同步 2025-07-17 18:22:17 +00:00

Refactor code for dlv command

这个提交包含在:
Faissal Elamraoui
2017-03-22 11:42:08 +01:00
父节点 ad641afb34
当前提交 72f144baad
共有 2 个文件被更改,包括 9 次插入16 次删除

查看文件

@@ -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...)
}

查看文件

@@ -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: '\''