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

Not able to debug/launch Go programs #1194

Closed
ramya-rao-a opened this issue Sep 6, 2017 · 22 comments
Closed

Not able to debug/launch Go programs #1194

ramya-rao-a opened this issue Sep 6, 2017 · 22 comments

Comments

@ramya-rao-a
Copy link
Contributor

From @karamana on September 6, 2017 0:51

go: GOPATH entry is relative; must be absolute path: "undefined".
For more details see: 'go help gopath'
exit status 2
Process exiting with code: 1

GOPATH is set in the environment correctly. This has worked for the past 2 months so something has changed today (Spet/5/2017) with an extension possibly.

  • VSCode Version: Code 1.15.1 (41abd21afdf7424c89319ee7cb0445cc6f376959, 2017-08-16T18:07:25.676Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions:
Extension Author (truncated) Version
html-snippets abu 0.1.0
markdown-toc Ala 1.5.6
Bookmarks ale 0.16.0
go-builder-help ans 2.1.2
code-gnu-global aus 0.2.2
vscode-eslint dba 1.2.11
githistory don 0.2.3
python don 0.7.0
gitlens eam 4.4.3
tslint eg2 0.17.0
code-runner for 0.7.1
vscode-auto-open-markdown-preview hnw 0.0.4
beautify Hoo 1.1.1
Angular2 joh 2.7.0
Go luk 0.6.64
start-git-bash McC 1.2.1
cpptools ms- 0.12.3
csharp ms- 1.12.1
PowerShell ms- 1.4.1
debugger-for-chrome msj 3.2.1
vscode-docker Pet 0.0.16
vscode-icons rob 7.12.0
gitblame wad 2.1.0
JavaScriptSnippets xab 1.4.1

(2 theme extensions excluded)


Steps to Reproduce:

Reproduces without extensions: Yes/No

Copied from original issue: microsoft/vscode#33867

@ramya-rao-a
Copy link
Contributor Author

We did update the way GOPATH was used in the debugger.

In your debug configuration in launch.json file, can you check if the program attribute is under your GOPATH/src ?

@selfmodify
Copy link

It is one level below src, $GOPATH/src/mymain. Where mymain contains the main go program. This is used to work before the extension update. Is there a way to install the previous version of this extension so this issue can be isolated to this extension update.

I also tried setting the GOPATH in the env map in launch.json but it results in the same thing.

@ramya-rao-a
Copy link
Contributor Author

ramya-rao-a commented Sep 6, 2017

This is the previous release: https://github.com/Microsoft/vscode-go/releases/tag/0.6.63
Scroll down until you see the link "Go-0.6.63.vsix"
Download that file and run code --install-extension Go-0.6.63.vsix from the location where you downloaded that file.

I can reproduce your error by having my package directly under the $GOPATH without the src folder. But you say that your package is under $GOPATH/src which puzzles me.

Nevertheless, I have the fix for case I was able to repro. Do you mind seeing if it fixes your issue as well?

You will need to download https://github.com/Microsoft/vscode-go/blob/master/Go-latest.vsix and then run code --install-extension Go-latest.vsix from the location where you downloaded that file.

@lamebear
Copy link

lamebear commented Sep 6, 2017

@karamana I had issues with the new release so I uninstalled the extension and installed version 0.6.63 from a vsix file after disabling extension auto updating and everything is working again.

@ramya-rao-a
Copy link
Contributor Author

@karamana Is debugging the only feature broken for you or like @nais777 all the features are broken?

@selfmodify
Copy link

selfmodify commented Sep 6, 2017 via email

@ramya-rao-a
Copy link
Contributor Author

@karamana Are the other features of the extension like auto-complete, go to definition etc working as expected?

I have a fix in for GOPATH issue with the debugger. Can you try it out?

You will need to download https://github.com/Microsoft/vscode-go/blob/master/Go-latest.vsix and then run code --install-extension Go-latest.vsix from the location where you downloaded that file.

@ihoukai
Copy link

ihoukai commented Sep 6, 2017

Thank you. This question has been bothering me for a long time. I have solved the problem after installing go-latest.vsix

@selfmodify
Copy link

selfmodify commented Sep 6, 2017 via email

@selfmodify
Copy link

selfmodify commented Sep 6, 2017 via email

@ramya-rao-a
Copy link
Contributor Author

That's good to hear @karamana
If you don't mind can you check a few things for me?

  • Set trace to "verbose" in your debug configuration
  • Start debugging, you will see verbose logging in the debug console
  • There will be a line Using GOPATH:

Is the value there a prefix for the value in the program attribute in the debug configuration?
Is the value there + /src a prefix for the value in the program attribute in the debug configuration?

@caustav
Copy link

caustav commented Sep 6, 2017

Thanks Ramya, your fix has saved a whole lot of time.

@selfmodify
Copy link

selfmodify commented Sep 6, 2017 via email

@ramya-rao-a
Copy link
Contributor Author

Thanks @karamana, I'll release it by end of day today.

@ramya-rao-a
Copy link
Contributor Author

The fix for this issue has been released with the latest update to the Go extension (0.6.65)

@rajkrishnamurthy
Copy link

rajkrishnamurthy commented Sep 18, 2017

Hi Ramya
VSCode 1.16.1. Arch: ia32
I updated to 0.6.65. Post update, I'm getting "go: GOPATH entry is relative; must be absolute path: "undefined"." error. launch.json has the following entry: "program": "${fileDirname}". Please advise.

Verbose Debug Output

Verbose logs are written to:
C:\Users\RAJ~1.KRI\AppData\Local\Temp\vscode-go-debug.txt
8:25:09 PM, 9/17/2017
InitializeRequest
InitializeResponse
Using GOPATH: undefined
Using dlv at: C:\Users\raj.krishnamurthy\go\bin\dlv.exe
go: GOPATH entry is relative; must be absolute path: "undefined".
For more details see: 'go help gopath'
exit status 2
Process exiting with code: 1
Delve is closed
DisconnectRequest

@ramya-rao-a
Copy link
Contributor Author

ramya-rao-a commented Sep 18, 2017

@rajkrishnamurthy Can you share the debug configuration from the launch.json file?
Have you set GOPATH as an environment variable?
What is the Go version?

@rajkrishnamurthy
Copy link

Hi Ramya
Sorry for the delay.
Once I set the GOLANG path, the problem went away., However, I never set the path variable prior to 0.6..65 upgrade.
Thanks very much.

Go version: 1.8.3
---launch.json---
{
"version": "0.2.0",
"configurations": [

    {
        "name": "Launch",
        "type": "go",
        "request": "launch",
        "mode": "debug",
        "remotePath": "",
        "port": 2345,
        "host": "127.0.0.1",
        "program": "${fileDirname}",
        "trace": "verbose",
        "env": {},
        "args": [],
        "showLog": true
    }
]

}

@selfmodify
Copy link

selfmodify commented Sep 25, 2017 via email

@ramya-rao-a
Copy link
Contributor Author

@karamana Which VS Tools are you referring to?

@selfmodify
Copy link

selfmodify commented Sep 25, 2017 via email

@ramya-rao-a
Copy link
Contributor Author

Am sorry, I dont do a lot of Go coding myself, so I wont be much of help here.
I would suggest you post your query in the Gophers Slack channel. I am sure there are others who have been in similar scenario.

@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
None yet
Projects
None yet
Development

No branches or pull requests

6 participants