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

Unable to start debugging on .go files due to path error #878

Closed
festum opened this issue Mar 21, 2017 · 17 comments
Closed

Unable to start debugging on .go files due to path error #878

festum opened this issue Mar 21, 2017 · 17 comments
Assignees
Labels

Comments

@festum
Copy link

festum commented Mar 21, 2017

Only happened on Golang files both portable version and install version. Debugging on another language(like Python) works well.
msg:

The program "${file}" does not exist: Error: ENOENT: no such file or directory, lstat 'C:\fe0\bin\VSCode\App\VSCode\${file}'

vs code version: 1.10.2
go version: 1.8

Any ideas?

@ramya-rao-a
Copy link
Contributor

Can you share your debug configurations from launch.json ?

@ramya-rao-a
Copy link
Contributor

Can you share the complete error and your launch.json?

Looks like the error is coming from https://github.com/Microsoft/vscode-go/blob/c530ed4c7cae1038df630307ff9a5eb173714e53/src/debugAdapter/goDebug.ts#L206

@DT-ZhangJia
Copy link

(VSCode) Try opening the folder where the .go file exists in. Don't open the .go file independently. Or VSCode could not create/read the .vscode folder nor the debug file.

@joaomoreno
Copy link
Member

joaomoreno commented Apr 21, 2017

@bviktor has the same problem:

  • VSCode Version: 1.11.2
  • OS Version: 1703 15063.138

Steps to Reproduce:

  1. Get a VM image for win10 15.15063 from modern.ie

  2. start it up, install updates, restart

  3. install vs code with defaults

  4. install go runtime with defaults

  5. start vs code

  6. install go extension, restart vs code

  7. create a new .go file:

package main
import "fmt"
func main() {
  fmt.Println("foobar")
}
  1. ctrl+f5

Expected output: foobar printed

Actual output:

The program "${file}" does not exist: Error: ENOENT: no such file or directory, lstat 'C:\Program Files (x86)\Microsoft VS Code\${file}'

On the top the following appears:

Error: Failed to continue: "The program attribute must point to valid directory, .go file or executable."

Which you can either "close" or "open launch.json" but if you try the latter, nothing happens at all.

@ramya-rao-a
Copy link
Contributor

@bviktor Can you share your debug configuration from the launch.json file?

@gaocuo
Copy link

gaocuo commented Apr 27, 2017

Can not found any launch.json in the work dir and whole disk.

@ghost
Copy link

ghost commented May 2, 2017

Hit the same error.
Does anyone can tell me where is the file launch.json?

@jiaoyk
Copy link

jiaoyk commented May 2, 2017

same issue. No launch.json could be found on disk.

@ramya-rao-a
Copy link
Contributor

The launch.json file would be in the .vscode folder in your workspace.
It gets created when you click on the gear icon in the debug view
If it doesn't exist, then VS Code tries to use some default configuration and tries to debug the current file that is open in the active editor.

This default configuration uses the ${file} variable which should resolve to the current file that is open in the active editor.

It appears that ${file} doesn't resolve properly in your cases.

I cannot repro it though.

Can one of you share a sample simple repo where this happens?
And share details like

  • which folder in this repo have you opened in VS Code?
  • which file was open when you triggered debug?
  • how did you trigger debug?

@bviktor
Copy link

bviktor commented May 2, 2017

@ramya-rao-a the opening post provides a step-by-step guide to reproduce the issue.

@bviktor
Copy link

bviktor commented May 2, 2017

Actually, it's the opening post of microsoft/vscode#25138

@bviktor
Copy link

bviktor commented May 2, 2017

  • VSCode Version: 1.11.2
  • OS Version: 1703 15063.138

Steps to Reproduce:

  1. Get a VM image for win10 15.15063 from modern.ie

  2. start it up, install updates, restart

  3. install vs code with defaults

  4. install go runtime with defaults

  5. start vs code

  6. install go extension, restart vs code

  7. create a new .go file:

package main
import "fmt"
func main() {
	fmt.Println("foobar")
}
  1. ctrl+f5

Expected output: foobar printed

Actual output:

The program "${file}" does not exist: Error: ENOENT: no such file or directory, lstat 'C:\Program Files (x86)\Microsoft VS Code\${file}'

On the top the following appears:

Error: Failed to continue: "The program attribute must point to valid directory, .go file or executable."

Which you can either "close" or "open launch.json" but if you try the latter, nothing happens at all.

@ramya-rao-a
Copy link
Contributor

Thanks @bviktor

I can repro now.
The case is when there is no workspace open in VS Code but only a Go file is.

@ramya-rao-a ramya-rao-a self-assigned this May 2, 2017
@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented May 2, 2017

This will be fixed by 42646af

And the fix will be out in the next update

Thanks everyone!

@bviktor
Copy link

bviktor commented May 2, 2017

Thanks a bunch!

@ramya-rao-a
Copy link
Contributor

The fix for this is out in the latest update (0.6.60)

@bviktor
Copy link

bviktor commented May 4, 2017

Confirmed to be working now, thanks again.

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

No branches or pull requests

7 participants