Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Debugging unit tests does not honor "go.gopath" setting #1768

Closed
olostan opened this issue Jul 4, 2018 · 4 comments
Closed

Debugging unit tests does not honor "go.gopath" setting #1768

olostan opened this issue Jul 4, 2018 · 4 comments

Comments

@olostan
Copy link

olostan commented Jul 4, 2018

I have followed all instructions and I can run/debug and run unit tests of my application.

However, when I try to debug unit tests, it looks like "go.gopath" setting is ignored (it uses GOPATH from environment).

Steps to Reproduce:

  1. Change "go.gopath" setting
  2. Verify that program can be run/debugged and unit tests are run
  3. Try to debug unit test
  4. See error "cannot find package..."
@lggomez
Copy link
Contributor

lggomez commented Jul 6, 2018

Static debug configuration for unit tests is a known issue. #1749 solved it in regards to delve support, I´ll take a look at this

Preferably, "go.gopath" will override the environment gopath, which is the one vscode is using for default on the test debug codelns

@olostan
Copy link
Author

olostan commented Jul 6, 2018

@lggomez for me the most strange that go.gopath was respected in normal debug mode and when running test. The only case where gopath was taken from env - debugging unittest...

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jul 16, 2018

@olostan

  • Are you on the latest version of the Go extension (0.6.84)?
  • Are you trying to debug the unit tests using the codelens or a debug configuration?
  • If you are using a debug configuration, then can you share that config?
  • When you run Go: Current GOPATH do you see the expected gopath or the one set in as an environment variable outside of vscode?

@lggomez Are you able to reproduce this issue?

https://github.com/Microsoft/vscode-go/blob/0.6.84/src/goDebugConfiguration.ts#L42-L47 ensures that as long as there is no gopath specified in the debug configuration, the gopath used while debugging will be the same as what you see when you run the command Go: Current GOPATH

@vscodebot
Copy link

vscodebot bot commented Jul 23, 2018

This issue has been closed automatically because it needs more information and has not had recent activity. Thank you for your contributions.

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants