Skip to content

Commit 29d8f36

Browse files
authored
DOCS: Update VSCode debugging instructions for itests and cmd (#3998)
# Issue Activating the debugger in VSCode is tricky. # Resolution Document launch.json examples that work.
1 parent 8470260 commit 29d8f36

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

documentation/advanced-features/debugging-with-dlv.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
## Debugger
22

3-
Test a particular function:
3+
### Debug a particular function:
44

55
```shell
66
dlv test github.com/StackExchange/dnscontrol/v4/pkg/diff2 -- -test.run Test_analyzeByRecordSet
77
^^^^^^^^^
88
Assumes you are in the pkg/diff2 directory.
99
```
1010

11-
Debug the integration tests:
11+
### Debug an integration tests:
1212

1313
```shell
1414
dlv test github.com/StackExchange/dnscontrol/v4/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -profile BIND -start 7 -end 7
@@ -18,12 +18,15 @@ If you are using VSCode, the equivalent configuration is:
1818

1919
```
2020
"configurations": [
21+
2122
{
2223
"name": "Debug Integration Test",
2324
"type": "go",
2425
"request": "launch",
2526
"mode": "test",
2627
"program": "${workspaceFolder}/integrationTest",
28+
"cwd": "${workspaceFolder}/integrationTest",
29+
"envFile": "${workspaceFolder}/integrationTest/.env",
2730
"args": [
2831
"-test.v",
2932
"-test.run",
@@ -39,5 +42,38 @@ If you are using VSCode, the equivalent configuration is:
3942
"buildFlags": "",
4043
"env": {},
4144
"showLog": true
42-
},
45+
}
46+
47+
]
48+
}
49+
50+
```
51+
52+
### Debug the `dnscontrol` command
53+
54+
```shell
55+
dlv debug --wd /path/to/config/dir -- preview --domains examples.com
56+
```
57+
58+
VSCode equivalent configuration is:
59+
4360
```
61+
"configurations": [
62+
63+
{
64+
"name": "preview example.com",
65+
"type": "go",
66+
"request": "launch",
67+
"mode": "debug",
68+
"program": "${workspaceFolder}/",
69+
"cwd": "/path/to/config/dir",
70+
"args": [
71+
"preview",
72+
"--domains",
73+
"example.com"
74+
]
75+
}
76+
77+
]
78+
```
79+

0 commit comments

Comments
 (0)