Understanding VS Code Go lang configurations

Search "launch"in VSCode settings.json and click on Edit in settings.json

"configurations": [
            {
                "name": "Run",
                "type": "go",
                "request": "launch",
                "mode": "auto",
                "program": "${workspaceFolder}/${relativeFile}",
                "dlvFlags": ["--check-go-version=false"],
                "console": "externalTerminal", 
            }
        ],

Using this we will get button to debug or test our code on the click on single button.

"name": "Run" this will be name of button to debug/run code in single click.

"type": "go" we are writing this configuration for go lang

"request": "launch" it will launch the new process to launch the code.

"mode": "auto" there are many modes such debug or test. debug means it will start main.go in debug mode. test means it will useful for go test files. auto means it will decide between debug and test based on the file which is currently opened.

"program": "${workspaceFolder}/${relativeFile}" it will automatically select currently opened file so that we dont have to statically give name to program variable.

"console": "externalTerminal" it will open debug process in external terminal which will be helpful for passing input values while debugging our code.

Read more at

https://github.com/golang/vscode-go/blob/master/docs/debugging.md

code.visualstudio.com/docs/editor/variables..