Debugging breakpoints with dlv in go plugins for protoc

111 Views Asked by At

I'm developing a protoc plugin (call it protoc-gen-myplugin) that generates some code. To run the plugin all I do is build the golang binary and is make sure it is in my path and I run:

protoc --proto_path=protos --go_out=protos --go_opt=paths=source_relative --myplugin_out=./migrations --myplugin_opt=paths=source_relative service.proto options.proto

protoc takes care of knowing how to execute it. The binary is not meant to be run directly.

I'd like to use a debugger like delve to set breakpoints but I since the plugin isn't executed without protoc I don't know how to attach to the process.

I tried using dlv headless mode and runtime.Breakpoint to no avail

0

There are 0 best solutions below