Goland 出现 select directory is not a valid

439 阅读1分钟

Goland 版本

2020.1.1

Go版本

安装方式采用的brew安装

brew install go@1.17

问题:

在goland设置GOROOT时会报错The selected directory is not a valid home for Go SDK

image.png

解决办法

1、修改安装目录下的zversion.go文件 /usr/local/Cellar/go@1.17/1.17.13/libexec/src/runtime/internal/sys/zversion.go

2、增加一个常量定义:

// Code generated by go tool dist; DO NOT EDIT.

package sys

const StackGuardMultiplierDefault = 1
const TheVersion = `go1.17.13`

3、注意第2步有个 DO NOT EDIT,跳转到go1.17的目录下执行 【尝试很多文章不行,然后自己实操过】

./go tool -h

image.png 4、重启Goland,再去设置GOROOT就可以了

image.png