dongqi4085
dongqi4085
采纳率0%
2017-10-26 15:31 阅读 200
已采纳

与VSCODE一起运行不起作用

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.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dotwc62080 dotwc62080 2017-10-26 15:34

    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.

    点赞 评论 复制链接分享

相关推荐