如何用goland调试geth? [英] How to debug geth with goland?
问题描述
我希望能够使用Goland通过Goth的Go代码进行调试。
I would like to be able to debug through Geth's Go code - using Goland.
在我看来,Geth的入口点是main.go,但是,当我尝试运行此命令时,出现以下错误:
It looks to me as if the entry point for Geth is main.go, however, when I try to run this I get the following errors:
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中添加了调试点,但是没有用。
I add debug point to function main, but it didn't work.
func main() {
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
推荐答案
Dude,请尝试使用此命令 go build -x path-to-go-ethereum / cmd / geth / * go
,您将看到标志-x发生了什么。应该编译该软件包。
在goland中,右键单击geth文件夹,只需选择run-> go bulid,您将获得期望的结果。
Dude, try this command go build -x path-to-go-ethereum/cmd/geth/*go
, you will see what happens with flag -x. Should compile the package instead.
In goland, right click the geth folder, just choose run->go bulid, you will get what you expect.
这篇关于如何用goland调试geth?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!