-
Notifications
You must be signed in to change notification settings - Fork 645
Debugger fails when stepping into standard library with "Unable to open 'server.go'" #1178
Comments
I couldn't repro on my Mac Since the path has Windows like path separator, my guess was that the issue is with https://github.com/Microsoft/vscode-go/blob/0.6.63/src/debugAdapter/goDebug.ts#L502 Which makes sense because that line of code tries to replace the remote path of the program being debugged with local path. Which works fine as long as the code is under GOPATH Since the std lib code is under GOROOT and not GOPATH, that line doesn't do anything other than changing It also makes sense why I didn't have issues in my Mac because the GOROOT is the same in remote and local. What I don't get is why in your case Regardless, can you try installing the extension from https://github.com/Microsoft/vscode-go/blob/remote-debug/Go-latest.vsix and see if it makes any difference? That has the fix for the issue I could repro i.e the error message that says cannot find file |
Hi @ramya-rao-a, it looks like that fixed it! I stepped repeatedly with no errors. I'll mark this as closed. Thanks for your help. I do have a question. Others where I work are also interested in remote debugging and see these same problems. I assume these changes will at some point in the future be in a mainline version that can be downloaded from the VS Code website. Do you know when that will be or what version that will be? Thanks again. |
I would be releasing an update early next week and it should have the current fixes. |
* Map remote goroot to local goroot #1178 * Updated vsix for testing * Use path separators when looking for src in path
This fix is now out in the latest update to the Go extension 0.6.64 |
While debugging the sample application (
github.com/lukehoban/webapp-go/tree/debugging
) (I’ve attached a partial screenshot.) The message is “Unable to open ‘server.go’: File not found (c:\Users\rpfister\usr\local\go\src\net\http\server.go).This seems to be a mishmash of fragments from the local and container paths.
The local file is here:
C:\Go\src\net\http\server.go
The container file is here:
/usr/local/go/src/net/http/server.go
But it looked here:
c:\Users\rpfister\usr\local\go\src\net\http\server.go
, which is home on the local machine (C:\Users\rpfister
) added to the remote path (\local\go\src\net\http\server.go
) to create a path that doesn't exist anywhere.Additional info:
The local host’s GOROOT is
C:\Go
.The local host's GOPATH is
C:\Users\rpfister\go
.The container’s GOROOT is
/go
.The container's GOPATH is undefined.
To reproduce
Clone the debugging branch of https://github.com/lukehoban/webapp-go/tree/debugging
Change line 1 of Dockerfile from "FROM golang:1.6" to "FROM golang:1.7" (The docker build fails using golang:1.6.)
Change
"host": "192.168.99.100"
to"host: "localhost"
in line 29 of .vscode/launch.json (assuming you are running on the same machine).Follow instructions in the comments in the launch.json; i.e., run the following two commands from the command prompt.
Set breakpoint to line 37 in main.go
Launch the "Remote debug in Docker" debug configuration.
Step over repeatedly until the error is encountered.
Versions in use
Delve
Golang
Docker
Visual Studio Code
Visual Studio Code 1.15.1
Commit 41abd21afdf7424c89319dd7cb0445cc6f376959
Date 2017-08-16T18:07:25.676Z
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0
Architecture x64
Go extension (lukehoban.go) 0.6.63, 26th July, 2017
The text was updated successfully, but these errors were encountered: