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?

Dave C
  • 7,222
  • 4
  • 46
  • 63
Dušan Maďar
  • 8,437
  • 4
  • 39
  • 62
  • 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 Nov 07 '18 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 Nov 07 '18 at 16:23

1 Answers1

1

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.

alanjds
  • 3,694
  • 2
  • 32
  • 42