Debug Traefik/Yaegi Plugins in Devcontainers

78 Views Asked by At

I am currently developing a plugin for Traefik 2 that gets intepreted by yaegi. I am unable to debug tokenValidate.go because I receive this error message when I start the debugger.

VSCODE error when launhing the debugger

Based on the plugin documentation I have implemented the handler (code snippet)

func New(_ context.Context, next http.Handler, config *Config, _ string) (http.Handler, error) {

    tokenValidatePlugin := &TokenValidatePlugin{
        keys: make(map[string]interface{})
    }

   return tokenValidatePlugin
}

Current launch.json config

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch file",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${file}"
        }
    ]
}

Repository structure

├── Dockerfile
├── Dockerfile.dev
├── app
│   ├── dynamic
│   │   └── dynamic.yml
│   ├── plugins-local
│   │   └── src
│   │       └── tokenValidate
│   │           ├── go.mod
│   │           ├── go.sum
│   │           ├── tokenValidate.go
│   │           └── vendor
│   │               └── modules.txt
│   └── traefik.yml
├── docker-compose.yml
├── dynamic-reference.yml
├── go.work
0

There are 0 best solutions below