如何在Goland中调试Revel应用程序?

huangapple go评论85阅读模式
英文:

How to debug revel app in goland?

问题

我想使用Jetbrain的Gogland内置调试器来调试我的Revel应用程序,但是Gogland的运行配置只允许设置包或文件运行场景,而不是调试由revel run myapp启动的进程。

英文:

I would like to debug my revel application with Jetbrain's gogland built in debugger but gogland run configuration allowing to setup either package or file run scenario not debug process started by revel run myapp.

答案1

得分: 1

现在Gogland是Goland

我找到了官方的创建调试配置的手册。如果你不介意的话,我会在这里发布...

INTELLIJ DEBUGGING (GOLAND)

  1. 创建你的项目,例如我将使用规范的“revel new github.com/myaccount/my-app”
  2. 运行“revel run github.com/myaccount/my-app”以生成tmp/main.go - 这个文件是IntelliJ所需的
  3. 关闭正在运行的服务器
  4. 创建运行配置,并在“Program arguments”中添加“-importPath github.com\myaccount\my-app -srcPath \src -runMode dev"
  5. 将“File”指向<你的gopath>\src\github.com\myaccount\my-app\app\tmp\main.go
  6. 在“before launch”中添加“Run external tool”。在那里:Program: <你的gopath>\bin\revel(.exe) Parameters: build github.com/myaccount/my-app

适用于Linux和Windows

英文:

Now Gogland is Goland

I find official manual for create debug-config. I'll post here if you do not mind...

INTELLIJ DEBUGGING (GOLAND)

  1. Create your project, for this example i will be using canonical “revel new github.com/myaccount/my-app”
  2. “revel run github.com/myaccount/my-app” to generate tmp/main.go - this file is needed by intellij
  3. Shutdown the running server
  4. Create run configuration and in “Program arguments” add “-importPath github.com\myaccount\my-app -srcPath \src -runMode dev"
  5. Point “File” to <your gopath>\src\github.com\myaccount\my-app\app\tmp\main.go
  6. In “before launch” add “Run external tool”. There: Program: <your gopath>\bin\revel(.exe) Paramerets: build github.com/myaccount/my-app

It works for Linux&Windows

答案2

得分: 0

据我所知,Gogland内置的调试器是delve

我认为你应该尝试使用attach选项来运行调试:

<pre>
附加到已经运行的进程并开始调试它。

这个命令将使Delve接管一个已经运行的进程,并开始一个新的调试会话。在退出调试会话时,你可以选择让进程继续运行或者终止它。

用法:
dlv attach pid [flags]
</pre>

我现在没有安装Gogland,但是过去我遇到过类似的问题。

英文:

AFAIK, Gogland built-in debugger is delve.

I think you must try run debug with option attach:

<pre>
Attach to an already running process and begin debugging it.

This command will cause Delve to take control of an already running process, and
begin a new debug session. When exiting the debug session you will have the
option to let the process continue or kill it.

Usage:
dlv attach pid [flags]
</pre>

I don't have installed gogland now, but I had similar problem in past.

huangapple
  • 本文由 发表于 2017年4月5日 04:26:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/43217056.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定