Debugging tests with delve
问题 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 ? 回答1: Use dlv test: $ dlv test -- -test.v Type 'help' for list of commands. (dlv) continue === RUN TestReadFileError --- PASS: TestReadFileError (0.00s) === RUN TestReadFile --- PASS: TestReadFile (0.00s) [..] PASS Process 8014 has exited with status 0 (dlv) quit Process 8014