现象

解决GoLand添加GOROOT提示The selected directory is not a valid home for Go Sdk的问题_Go


解决GoLand添加GOROOT提示The selected directory is not a valid home for Go Sdk的问题_打开文件_02

解决

在Go安装路径下找到zversion.go文件,我的在D:\Program Files\Go1.21.1\src\runtime\internal\sys下面
打开文件,添加如下内容:

const TheVersion = `go1.21.1`

解决GoLand添加GOROOT提示The selected directory is not a valid home for Go Sdk的问题_打开文件_03


保存后再重新添加GOROOT即可

解决GoLand添加GOROOT提示The selected directory is not a valid home for Go Sdk的问题_Go_04