by pcx · 8y ago · 0 comments
Despite taking longer to build, it's a treat to work on Golang. The explicit error handling and static typing have made our code much more reliable, with a lot less unit/integration tests required. Concurrency is dead easy to understand and build over. We are OK with using dep, definitely miss a debugger or an REPL. Having generics would make it much easier to write code. But overall it was worth it. Our response times are much lower now with a lot less server nodes required.
I personally use Visual Studio with the go extension and delve and the debugger works quite well.[1]
I believe that the Goland IDE also has an integrated debugger.[2]
[1] https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-cod...
Bizarre that a programming language designed by non first time language designers, backed by a multi-billion dollar company and used extensively throughout that company(by "new" engineers), doesn't have a world class debug story.
— Brian W. Kernighan, in the paper Unix for Beginners (1979)Having a debugger available does not drop your IQ by 20 points.
Not necessarily, but it can have that effect. Sometimes I spend a long time in the debugger, following the chain from effects to causes to the causes’ causes and so on, getting a little dopamine hit every time I uncover a new level – it’s exciting, like watching a detective show – and ultimately discovering the root cause… only to have it be something dumb or obvious, something I might have found in less time by just patiently rereading the code.
You can use a world class debugger, known as gdb, with Go, and yes, they do provide extensions for gdb to make it understand high-level Go constructs (such as goroutines, maps, slices, channels, ...): https://golang.org/doc/gdb
So if you want me to spell it out, here you go: it's bizarre to expect a debugger from modern compiled languages which have been FOSS from the beginning.
https://github.com/derekparker/delve
Apparently Delve supports Win and OSX/macOS too, though I've not tried it on those in years. On BSD though... there's no debugging story. :(
This is especially true in Go where the type checker gives you a lot of confidence that your code works before you run it.
gdb works well with Go: https://golang.org/doc/gdb
I found a video of someone debugging Go code in VS Code, and I saw them set breakpoints, step around in a function, and hover over a variable to see its value, in addition to the sidebar containing all of the values of all of the local variables and the stack traces.
And talk about the build size, time and the fact that you could generate a build and run it bare metal anywhere.