重置工作环境

huangapple go评论85阅读模式
英文:

reset workspace env

问题

我意外地点击了Visual Studio Code中的"Go: reset workspace env",导致本地的Go环境无法工作。

我的Go版本是1.18。

> 运行'/usr/local/go/bin/go env'失败(当前工作目录:/Users/kejie/go/ms):错误:命令运行失败:/usr/local/go/bin/go env -json GOPATH GOROOT GOPROXY GOBIN GOMODCACHE
提供给GOWORK的路径必须是绝对路径
>
> 提供给GOWORK的路径必须是绝对路径

➜  go env 

> 提供给GOWORK的路径必须是绝对路径

英文:

I accidentally clicked Go: reset workspace env in Visual Studio Code, and the local Go environment won't work

My Go version is 1.18

>Failed to run '/usr/local/go/bin/go env' (cwd: /Users/kejie/go/ms): Error: Command failed: /usr/local/go/bin/go env -json GOPATH GOROOT GOPROXY GOBIN GOMODCACHE
the path provided to GOWORK must be an absolute path
>
>the path provided to GOWORK must be an absolute path

➜  go env 

>the path provided to GOWORK must be an absolute path

答案1

得分: 1

echo $GOWORK是什么意思?如果不为空,请在命令行中重置它,例如unset GOWORK,然后使用新的环境变量重新启动vscode。

如果用户配置文件或工作区的settings.json中有go.toolsEnvVars字段,请尝试删除该字段并重新启动vscode。

英文:
  • What does echo $GOWORK say? Reset it if not empty from the commandline e.g. unset GOWORK, and relaunch vscode with the new env var.
  • If user profile or workspace settings.json has go.toolsEnvVars field, try to delete the field and restart vscode.

huangapple
  • 本文由 发表于 2022年9月20日 20:59:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/73787137.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定