dnscontrol/documentation/advanced-features/debugging-with-dlv.md
2025-11-30 18:07:00 -05:00

1.1 KiB

Debugger

Test a particular function:

dlv test github.com/StackExchange/dnscontrol/v4/pkg/diff2 -- -test.run Test_analyzeByRecordSet
                                                ^^^^^^^^^
                                                Assumes you are in the pkg/diff2 directory.

Debug the integration tests:

dlv test github.com/StackExchange/dnscontrol/v4/integrationTest -- -test.v -test.run ^TestDNSProviders -verbose -profile BIND -start 7 -end 7

If you are using VSCode, the equivalent configuration is:

    "configurations": [
        {
            "name": "Debug Integration Test",
            "type": "go",
            "request": "launch",
            "mode": "test",
            "program": "${workspaceFolder}/integrationTest",
            "args": [
                "-test.v",
                "-test.run",
                "^TestDNSProviders",
                "-verbose",
                "-profile",
                "BIND",
                "-start",
                "7",
                "-end",
                "7"
            ],
            "buildFlags": "",
            "env": {},
            "showLog": true
        },