术语"go"不被识别为cmdlet,函数,脚本文件或可操作程序的名称 [英] The term 'go' is not recognized as the name of a cmdlet, function, script file, or operable program

查看:684
本文介绍了术语"go"不被识别为cmdlet,函数,脚本文件或可操作程序的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行后...

go run main.go

我收到此错误

go : The term 'go' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.

推荐答案

已解决:转到Visual Studio代码(假定已安装)ctrl + shift + p打开命令窗口类型

SOLVED: Go to visual studio code (assuming this is installed) ctrl + shift + p to open command window type

开始:当前的GOPATH

Go: current GOPATH

这应该为您提供一个路径,以创建一个名为GOPATH的系统环境变量,并将该路径添加到该变量中.

this should give you a path create a system environment variable named GOPATH and add that path into that variable.

确保将系统环境变量设置为:

Make sure the system environment variables are set to:

在我的情况下,GOPATH设置为C:\ Users [用户名] \ go

GOPATH is set (in my case) to C:\Users[username]\go

GOROOT设置为C:\ go \

GOROOT is set to C:\go\

IDE是Visual Studio代码.

IDE is Visual Studio Code.

这篇关于术语"go"不被识别为cmdlet,函数,脚本文件或可操作程序的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆