user8557463
user8557463

Reputation:

Run go with VSCODE is not working

i've installed the latest go (I saw the go outout with go -v in the command line )

I've installed go plugins to vs code and restart and create some simple file like following

main.go

package main

import (
    "fmt"
)

func main() {

    fmt.Println("hello world");
}

when I run it (with run option plugin , click on file and run) I got error in the console

[Running] go run "/Users/i076777/GoProjects/GoProjTest/main.go"
/bin/sh: go: command not found

Any idea what Im missing here ?

I've also try the following which doesnt work Ive MAC and I see in env GOROOT="/usr/local/go" and I use 'export PATH=$PATH:/usr/local/go/' and its not working.

Upvotes: 2

Views: 6666

Answers (1)

Andrew
Andrew

Reputation: 27324

You are missing go in your path it looks like. Check with echo $PATH and you should have :/c/Go/bin: in it somewhere (or the folder you installed go to).

As a side test, open a command prompt / shell and type go env - if it is in your path you should get your go environment variables showing - if they do appear, please update the question.

Upvotes: 2

Related Questions