This repository has been archived by the owner on May 22, 2024. It is now read-only.
Improvement : document how to debug a native provider with delve #2218
Labels
area/docs
Improvements or additions to documentation
kind/enhancement
Improvements or new features
resolution/fixed
This issue was fixed
size/S
Estimated effort to complete (1-2 days).
Milestone
Problem description
Documentation of Pulumi doesn't cover how to attach a debugger to a running native provider written in Go. Being able to hook a debugger is mandatory during bug reproduction and problem diagnostic, or even to learn how to write native providers and inspect what a resource provider is expected to do.
Suggestions for a fix
Here's how to were able to achieve this.
It is possible to debug a Pulumi resource provider in Go using the
PULUMI_DEBUG_PROVIDERS
environment variable which tells Pulumi to use a provider that is already started. The format of the value to be supplied is:"providername:port,otherProvider:port"
. Note that the service port is returned when a provider is started.Debugging with VS Code
From VS Code, it is possible to add a runtime configuration in the
launch.json
file to use Delve, the Go debugger.Alternatively, it is possible to start Delve from the command line or from another IDE.
Disabling optimizations
Ideally one should get better results by compiling the project in debug and passing the following options
-gcflags=all="-N -l"
in order to disable optimizations so that the debugger is able to return the content of the stack and that function calls are not elided (inline).References
Details of the Pulumi merge request
Visual Studio Code Golang Support
Visual Studio Code Golang debugging
The text was updated successfully, but these errors were encountered: