Iβm new to go, but one of my go to things with python, ruby is to drop into a repl and be able to step by step walk through and inspect code flow and especially object types (again a put with dynamic languages, 1/2 the bugs is you have no clue what someone passed in)
Iβm fine with doing prints to console for debugging, but miss the power of being able to come into complicated code base as and just walk through the code and get a mental mapping of how things work and where to go next.
With java there was InteliJ for step by step debugging, but thatβs not as powerful because Iβm not able to modify the object mid flight and try to call a method or a function again to see how it changes things.
Just wondering, how do you as more seasoned go Devs approach debugging in Go?
Videos
No, Go does not provide a REPL(readβevalβprint loop).
However, as already mentioned, Go Playground is very handy. The Go Authors are also thinking about adding a feature-rich editor to it.
If you want something local, consider installing hsandbox. Running it simply with hsandbox go will split your terminal screen (with screen) where you can write code at the top and see its execution output at the bottom on every save.
There was a gotry among standard Go commands, which used to evaluate expressions (with an optional package name), and could be run like gotry 1+2 and gotry fmt 'Println("hello")' from shell. It is no longer available because not many people actually used it.
I have also seen third party projects for building a REPL for Go, but now I can only find links to two of them: igo and go-repl. How well do they work I don't know.
My two cents: Speed of compilation makes writing a REPL possible for Go, as it has also helped building the tools mentioned here, but the same speed makes REPL less necessary. Every time I want to test something in Go that I can't run in Playground I open a simple .go file and start coding and simply run the code. This will be even easier when the go command in Go 1 makes one-command build process possible and way easier.
UPDATE: Latest weekly release of Go added go command which can be used to very easily build a file: write your prog.go file and run go build prog.go && ./prog
UPDATE 2: With Go 1 you can directly run go programs with go run filename.go
UPDATE 3: gore is a new project which seems interesting.
Try motemen/gore
Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.
https://github.com/motemen/gore
