没有为命令go设置版本



我试图在 Ubuntu 机器上使用go version检查我的go可执行文件的版本,但是我收到以下错误:

No version set for command go
Consider adding one of the following versions in your config file at 
golang 1.16.8
golang 1.17.1

我该如何解决此问题?我以前没有配置文件的经验,我在谷歌上搜索过,但我没有发现可以解决这个问题的东西。

这似乎是来自asdf-vm/asdf的错误消息,该工具使用单个 CLI 工具管理多个运行时版本,可通过 plugins.
您可以在asdf-vm/asdf问题 838 中看到该错误消息。

配置文件应为$HOME/.tool-versions

要解决此问题,如以下示例所示:

asdf plugin add go
asdf install go latest

最新更新