首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用goland调试geth?

如何用goland调试geth?
EN

Stack Overflow用户
提问于 2018-10-12 13:54:15
回答 1查看 835关注 0票数 1

我希望能够通过Geth的Go代码进行调试--使用Goland。

在我看来,Geth的入口点似乎是main.go,但是,当我尝试运行它时,我会得到以下错误:

代码语言:javascript
复制
GOROOT=/usr/local/Cellar/go/1.11/libexec #gosetup
GOPATH=/Users/codet/go #gosetup
/usr/local/Cellar/go/1.11/libexec/bin/go build -o /private/var/folders/6t/tdn_s_2x2rx1scn774cwvlph0000gn/T/___geth_go -gcflags "all=-N -l" /Users/codet/go/src/github.com/ethereum/go-ethereum/cmd/geth/main.go #gosetup
# command-line-arguments
cmd/geth/main.go:136:3: undefined: configFileFlag
cmd/geth/main.go:177:3: undefined: initCommand
cmd/geth/main.go:178:3: undefined: importCommand
cmd/geth/main.go:179:3: undefined: exportCommand
cmd/geth/main.go:180:3: undefined: importPreimagesCommand
cmd/geth/main.go:181:3: undefined: exportPreimagesCommand
cmd/geth/main.go:182:3: undefined: copydbCommand
cmd/geth/main.go:183:3: undefined: removedbCommand
cmd/geth/main.go:184:3: undefined: dumpCommand
cmd/geth/main.go:186:3: undefined: monitorCommand
cmd/geth/main.go:186:3: too many errors

Compilation finished with exit code 2

我在函数main中添加了调试点,但是它没有工作。

代码语言:javascript
复制
func main() {
    if err := app.Run(os.Args); err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-13 05:23:41

伙计,试试这个命令go build -x path-to-go-ethereum/cmd/geth/*go,您将看到标志-x发生了什么。应该编译包而不是。在goland中,右键单击geth文件夹,只需选择run->go bulid,您将得到您所期望的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52781062

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档