4

I setup a breakpoint in my Go code with runtime.Breakpoint(), save the file (my editor, Atom with go-plus installed, runs go install . on save). Then I run Delve in terminal with dlv debug, and type continue after it starts.

When the breakpoint kicks in, I want to test a couple of things (basically to print reader's data via a bytes.Buffer). But, I get the following error

buf := new(bytes.Buffer): "1:5: expected 'EOF', found ':='"

and in general cannot do much more than print values.

Is it really not possible to do this sort of thing? I am used to Python's pdb where setting variables or calling functions is not a problem and I would expect Delve is capable of the same.

So, what am I doing wrong?

2
  • 1
    dlv is a debugger, its not an interpreter. If you have a variable in your code, which contains the data. You can type print(variableName) and you will get that.
    – whitespace
    Commented Nov 7, 2018 at 14:59
  • 1
    delve in go 1.11 supports functions as an experimental feature. pdb is easier to implement as python isn't a fully compiled language
    – Vorsprung
    Commented Nov 7, 2018 at 16:23

1 Answer 1

2

Not possible yet. Right now (2018-NOV) work is in progress on Delve, but unfinished.

Go runtime was changed recently to allow this kind of call. Delve have a Github issue tracking the progress of such feature, but is still experimental and incomplete.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.