-
Notifications
You must be signed in to change notification settings - Fork 924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Delve debugger #384
Conversation
This adds support for debugging tool Delve. The command dlv starts a debugging REPL that allows the user to debug his application using Delve tool. Resolves beego#365.
@amrfaissal How I can check it? |
|
To learn more this is the documentation: https://github.com/derekparker/delve/tree/master/Documentation I will label this PR as work-in-progress as I am planning to do some improvements. |
@amrfaissal @sergeylanzman when this PR is done, I would like to release a new version: |
I think this PR is ready for review/merge. Let me know what you think. |
AFAIK the dlv has different installation for different os. I see dlv dependence in vendor. Does the user still need to install dlv to use this command? |
This is the purpose of my improvements: No need to install dlv command line. Delve can be used either using the binary or the API. In the last commits, I am using the API by starting the server and client terminal. The server used in |
cmd/commands/dlv/dlv.go
Outdated
|
||
// | ||
// Create and start the debugger server | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove these empty comments
cmd/commands/dlv/dlv.go
Outdated
|
||
// | ||
// Start the Delve client REPL | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove these empty comments
utils/utils.go
Outdated
|
||
// GoBuild runs the "go build" command on the specified package | ||
func GoBuild(debugname, pkg string) error { | ||
buildFlags := "-ldflags='-linkmode internal'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add the comments here why need to use -ldflags='-linkmode internal'
is this for dlv only? As this is the util package, so maybe other package will use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right. Other packages might use different ldflags
, but here I am just making sure Go's internal linker is used. I will move this function to dlv.go
.
cmd/commands/dlv/dlv.go
Outdated
func runDelve(addr, debugname string) int { | ||
beeLogger.Log.Info("Starting Delve Debugger...") | ||
|
||
err := utils.GoBuild(debugname, packageName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from your screenshot you don't need the packageName for it. So bee dlv
would start to work. But it looks you pass this to the go build -o
. If it's not set then the output would be empty. I think you need to add a deafult value for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No debugname
is passed to go build -o
then we specify what package to build. If no package is supplied go build
builds the current directory. So no need to add a default value.
Thanks for the detail introduction. So we need to update our readme and docs |
I'll update the README as well before the release of |
…g button (beego#384) Add loading and countdown status to the verification code sending button Revert "Add bcrypt encrypted password type" This reverts commit ae995b5805de2caa02edd92cfb48bbcfb4dfb166. fix:indentation
This adds support for debugging tool Delve. The command

dlv
starts a debugging REPL that allows the user to debug his application using Delve tool.