Debugger — Max string size & inspect nesting limit:

The golang debugging experience in VSCode is poor since viewing deeply nested variables is cutoff when you reach the 3rd level, and viewing strings is lmited to 64 characters which is almost never enough, the same goes for arrays, however, that bothers me less.

The vscode team has added support for delve v2 APIs, but these are still turned off by default in the current version (v1.25.0). To turn it on, and control these pesky variables, change the vscode user settings to stop using delve v1 API, and control the MaxStrLen and MaxVeriableRecurse variables like this:

file -> preferences ->settings

"go.delveConfig": {

"useApiV1": false,

"dlvLoadConfig": {

"followPointers": true,

"maxVariableRecurse": 3,

"maxStringLen": 400,

"maxArrayValues": 400,

"maxStructFields": -1

}

}

*just remember that the “maxVariableRecurse” will slow down your debugging, so play with it to see what is acceptable to you.

Slow debug launch:

Shut down windows defender antivirus real time protection:

start menu -> search for “virus” , click on “virus & threat protection” -> click on “virus & threat protection settings” -> turn off “real time protection”

On my windows 10 machine, It took very long to launch when pressing F5, so much so, that I could wait something around 40 seconds each time I would start a debugging session, turning the real time protection off made it sane again.

Slow renaming:

vscode uses golang’s own rename tool to do the job, but this tool searches trough your entire go path, which can be a ton of usually irrelevant code. This gorename fork by prateek, disables global search and makes renaming

go get github.com/prateek/gorename

This should compile gorename from source, now you should test that it is installed properly in your path

(on linux/mac:) which gorename

(on windows:) where gorename

also check that the gorename creation date which should be brand new.

JSON is a pain to fomalize in golang

Go is a very easy language to write in the most part, but formalizing JSON into types is quite tedious when compared to typescript, the “paste to json” vscode addon uses an open source called quicktype to create pretty good types for a given JSON sample, it even finds similar types creating no duplicates, if you are on the strict side you may just need to cosmetically rename a couple of inner types at the end, but now that the rename works fine, you can..`