Step 1: Open Visual Studio Code.
Step 2: Create Test.go application like below.
Test.go
package main import ( "fmt" ) func main() { name := "Krishna" city := "Bangalore" country := "India" fmt.Println("name : ", name) fmt.Println("city : ", city) fmt.Println("country : ", country) }
Step 3: Add breakpoints
As you see
above image, I set break points at lines 8, 9 and 10.
Step 4: Create launch profile.
Click on 4th
icon in the left panel, to open DEBUG window.
Step 5: Open Launch.json file by click on
settings icon from the left top panel.
Once you
click on the settings button, you can see launch.json file.
You no
need to update launch.json right now. If you want any customizations in future,
you can update this file.
Step 6: Click on Play button to start
debugging.
It opens a
debug window, where you can step-in, step-out and step-over.
No comments:
Post a Comment