0

Delve代码分析笔记(1)——main.go

Posted by nanxiao on 五月 18, 2016 in Delve代码分析笔记 |

delve的项目主页:https://github.com/derekparker/delve
main.go的代码比较简单:

package main

import (
    "github.com/derekparker/delve/cmd/dlv/cmds"
    "github.com/derekparker/delve/version"
)

// Build is the git sha of this binaries build.
var Build string

func main() {
    version.DelveVersion.Build = Build
    cmds.New().Execute()
}

main函数就干了两件事:
(1)把Build的值赋给version.DelveVersion变量中的Build成员;
(2)cmds.New()返回一个cobra.Commandtree,然后调用Execute()函数执行相应的子命令,例如dlv version

 

标签:, ,

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Copyright © 2013-2017 我的站点 All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.