Match 'go test' behaviour and switch to package directory, unless one is specified with the '--wd' option. Fixes #2125
* service/dap: Add support for debug and test modes * Address code review comments * Remove //dap comment * OptFlags() => optfalgs() * If mode => switch mode