golang debug specific test from compiled binary

Developer from somewhere

Problem: want to debug a failing test, from a compiled binary containing a lot of other tests.

Solution:

  • compile tests with go test -c
  • run dlv: dlv exec ./my.test – -test.run SomePattern
  • debug!