'How to run go file on vscode?

I can't run the go program on vscode on my Win11 computer (no run button, pressing Ctrl+F5 or F5 doesn't work,like this: vscode ) and I can't debug it. It's not written on FAQ.

It works on my other Win10 PC. All dependencies are installed

This is my settings.json:

    "go.autocompleteUnimportedPackages": true,
    "go.gocodePackageLookupMode": "go",
    "go.gotoSymbol.includeImports": true,
    "go.useCodeSnippetsOnFunctionSuggest": true,
    "go.inferGopath": false,
    "go.gopath": "F:\\vscodefiles\\src\\hello",
    "go.goroot": "D:\\go\\",
    "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,

why is this?



Solution 1:[1]

Try in the terminal:

go run myfirstprogram.go

enter image description here

Remember to install Go on your computer before, you can download it from its official page: https://go.dev/ and restart Visual Studio Code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nube Colectiva