Skip to content

Debugging in VS code

Introduction

The following document will show how to setup debugging for multi gateway controller.

There is an included VSCode launch.json.

Starting the controller

Instead of starting the Gateway Controller via something like:

make build-{policy | gateway}-controller install run-{policy | gateway}-controller

You can now simply hit F5 in VSCode. The controller will launch with the following config:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "./cmd/controller/main.go",
      "args": [
        "--metrics-bind-address=:8080",
        "--health-probe-bind-address=:8081"
      ]
    }
  ]
}

Running Debugger

VSCode Debugger 1

Debugging Tests

VSCode Debugger 2