I am using vscode to build my golang gin project.
I go to debugging mod and can not do evaluate expressions.
I want to go some line and evaluate that see what happened in that monent.
Like eclipse ctrl+shift+i or idea ctrl+alt+f8
Quick evaluate expression.
I also see this
Eclipse inspection (Ctrl + Shift + I) equivalent in IntelliJ IDEA (Community Edition)
Watch window or evaluate expressions while debugging in VS Code?
func main() {
router := gin.Default()
router.GET("/user/:name", func(c *gin.Context) {
name := c.Param("name")
c.String(http.StatusOK, name, 1, 2, 3, 4)
})
when the debugger line in name := c.Param("name")
I try to use the bottom of vscode window and when I type this code into the command it will return
but if I type name it will return the right string for me.
Failed to eval expression: { "Expr": "c.Param("name")", "Scope": { "goroutineID": 34, "frame": 1 }, "Cfg": { "followPointers": true, "maxVariableRecurse": 1, "maxStringLen": 64, "maxArrayValues": 64, "maxStructFields": -1 } } Eval error: function calls not allowed without using 'call'
For the ones coming here at 2020+, it is now possible to call a function. The syntax is:
call functionToBeCalled(arg1, arg2)
In the question ask for running an assignation, you can also set a variable
call variable = newValue
Source: https://github.com/golang/vscode-go/issues/100
This isn't possible right now as more complex evaluations have only been added to the Delve debugger recently. You might want to follow these two Github issues:
Add ability to safely call functions #119
Function calls via delve 'call' are not supported #2655
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With