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

Debugger fails when stepping into standard library with "Unable to open 'server.go'" #1178

@rpfister51

Description

@rpfister51

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).

unable to find 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.

$ docker build -t webapp-go .   
$ docker run -d --name webapp-go --privileged -p 8080:8080 -p 2345:2345 webapp-go

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
PS C:\Users\rpfister> dlv version
Delve Debugger
Version: 1.0.0-rc.1
Build: $Id: b6077a6a35c48a31716aad2ad3fdf77bbdf70abd $
Golang
PS C:\Users\rpfister> go version
go version go1.8.3 windows/amd64
Docker
PS C:\Users\rpfister> docker version
Client:
 Version:      17.06.1-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:48:20 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.06.1-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:54:55 2017
 OS/Arch:      linux/amd64
 Experimental: true
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions