I'm using "go test -v" to run bunch of unit tests. I'd like to debug them using delve. When I try to run debugger, I get an "Can not debug non-main package" error. So, how can I debug unit tests using delve debugger ?
相关问题
- Pass custom debug information to Microsoft bot fra
- Golang mongodb aggregation
- How to flatten out a nested json structure in go
- how to install private repo using glide golang
- How do I identify what code is generating “ '&
相关文章
- Can I run a single test in a suite?
- How to check if a request was cancelled
- Is it possible to implement an interface with unex
- How do I get to see DbgPrint output from my kernel
- How to access value of first index of array in Go
- Embedded Interface
- Advanced profiling is unavailable for the selected
- Can't Inspect Variables When Debugging .NET As
Use
dlv test
:You can also pass
-test.run
to select tests to run (just likego test -run
).Internally, this is the same as Flimzy's answer (it compiles the test binary with
go test -c
), but more streamlined and won't leave .test files for you to clean up.I'm not familiar with delve, but if it can work on a compiled binary, just compile your tests using the
-c
flag:Then run delve on the output.