简体   繁体   English

在使用 GoLand 进行调试时使用多个 go 版本

[英]Using multiple go versions while debugging with GoLand

Using Go's documentation on managing Go installs, I have got two versions of Go on my system:使用Go 的有关管理 Go 安装的文档,我的系统上有两个版本的 Go:

$ go version
go version go1.16.13 linux/amd64

$ go1.17 version
go version go1.17 linux/amd64

1.16 installed using Fedora's dnf and 1.17 using go install golang.org/dl/go1.17@latest; go1.17 download 1.16 使用 Fedora 的dnf安装,1.17 使用go install golang.org/dl/go1.17@latest; go1.17 download go install golang.org/dl/go1.17@latest; go1.17 download (I get it that latest 1.17 is 1.17.6, but that's OK for my purpose.) go install golang.org/dl/go1.17@latest; go1.17 download (我知道最新的 1.17 是 1.17.6,但这对我来说没问题。)

In GoLand, I would like to use go1.17 to debug without modifying the system settings as a whole to use go1.17 every time I run a go command.在 GoLand 中,每次运行 go 命令时,我都想使用 go1.17 进行调试,而无需整体修改系统设置以使用 go1.17。 I tried setting GOBIN=/home/<username>/go/bin/go1.17 in the Environment section of "Run/Debug Configurations", but that doesn't work (I'm not sure if it should.)我尝试在“运行/调试配置”的环境部分设置GOBIN=/home/<username>/go/bin/go1.17 ,但这不起作用(我不确定是否应该这样做。)

Is it possible to use a different Go version for debugging while using GoLand?使用 GoLand 时是否可以使用不同的 Go 版本进行调试? How?如何?

You can add your 1.16.13 Golang to the GoRoot setting from this path: settings/Go/GOROOT您可以从以下路径将1.16.13 Golang 添加到 GoRoot 设置: settings/Go/GOROOT

see this picture看到这张照片在此处输入图像描述

after that, you can select The target version that you want to test.之后,您可以 select 您要测试的目标版本。 just need to select between 1.17 or 1.16 in this setting.只需在此设置中将 select 设置在 1.17 或 1.16 之间。

unfortunately, I didn't find any easier solution.不幸的是,我没有找到任何更简单的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM