Update : changed ${workspaceRoot} to ${workspaceRoot}/project_folder to make it work.
I'm just starting to learn Go and want to run it from Visual Studio code.
I have this simple program:
package main import "fmt" func main() { fmt.Println("Hello World!") }
I installed the Go extension from the market: https://marketplace.visualstudio.com/items?itemName=lukehoban.Go
I also got the Delve debugger from here using go get : https://github.com/derekparker/delve
To try to run the code, I do this in Visual Studio code:
- I click on my file with the
main.go code main.go - Go to the
Debug tab - Click
Launch (after creating the launch.json file)
launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "go", "request": "launch", "mode": "debug", "remotePath": "", "port": 2345, "host": "127.0.0.1", "program": "${workspaceRoot}", "env": {}, "args": [] } ] }
Finally, I get this error:
can't load package: package github.com/mo: no buildable Go source files in C:\Users\Fazil\Documents\Workspace\Go\src\github.com\mo exit status 1
Should I include something else? Any help would be appreciated, thanks!
source share