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

Cannot Start Debugging when package is directly under gopath #1765

Closed
Ritzpak opened this issue Jul 2, 2018 · 4 comments
Closed

Cannot Start Debugging when package is directly under gopath #1765

Ritzpak opened this issue Jul 2, 2018 · 4 comments

Comments

@Ritzpak
Copy link

Ritzpak commented Jul 2, 2018

What version of Delve are you using (dlv version)?
5cd86b1
What version of Go are you using? (go version)?
go1.10.3.windows-amd64
What operating system and processor architecture are you using?
Windows Server 2016 Datacenter x64
Visual Studio Code v1.24.1 x64
What did you do?
Followed the install instructions.
What did you expect to see?
Hitting a breakpoint.
What did you see instead?
Error message: Can not debug non-main package.

I can Start Without Debugging and get my Println message so I know it compiles, but when I try Start Debugging, I get an error. I'm just getting started in Go and have only installed what is recommended so far. Not sure if there are conflicts or what. This should be extremely simple, but for some reason it won't run. I can debug with commands from the terminal, but not through the IDE.

image
image

@wiredprairie
Copy link

One idea: try launching the package rather than a single file.

{
	"name": "Launch Package",
	"type": "go",
	"request": "launch",
	"mode": "debug",
	"program": "${workspaceRoot}"
}

Same error?

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jul 16, 2018

I can debug with commands from the terminal

Can you share a screenshot of that? How did you debug from the terminal? Using dlv debug? Did you pass a file path to it?
What is the version of dlv you are using?

@ramya-rao-a
Copy link
Contributor

Never mind, I got it to repro.

In this case dlv debug works but not dlv debug testing and this only happens for the folder directly under the GOPATH. Try making another folder under your testing folder, add a go file there. That one will debug just fine.

This is an upstream issue. I have logged https://github.com/derekparker/delve/issues/1268

For now, try creating a sub folder and work there.

@ramya-rao-a ramya-rao-a changed the title Cannot Start Debugging Cannot Start Debugging when package is directly under gopath Jul 16, 2018
@ramya-rao-a
Copy link
Contributor

@Ritzpak As explained in https://github.com/derekparker/delve/issues/1268#issuecomment-405441709, testing is an internal package and thus the issue. Rename it to something else and debugging should work as expected.

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 31, 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