Search code examples
intellij-ideagogoogle-go-idea-plugin

"The selected directory is not a valid home for Go Sdk"


I'm using IntelliJ Idea, and the google-go-lang-idea-plugin from:

https://github.com/mtoader/google-go-lang-idea-plugin/issues/173

When I try to add my APT provided Go installation to the Go SDK list, I get the following error

The selected directory is not a valid home for Go Sdk

I have tried adding the following directories as the Go SDK root

  • /usr/share/go/
  • /usr/share/src/
  • /usr/lib/go/
  • /usr/lib/go/src/
  • /usr/lib/go/pkg/
  • /usr/lib/go/pkg/linux_amd64

Does anyone know how to get this working? I've commented on the various issues in the bugtracker, however the maintainer claimed that this was fixed 10 months ago.

Failing that, does anyone know what this plugin is actually looking for that would make a directory look like the SDK directory?


Solution

  • I came this issue when config goroot path in goland idea.

    enter image description here I solve it as follows,

    Go the GO SDK path and find zversion.go, then append the file with

    const TheVersion = `go1.17.2`

    . You need to change the version according to you case.

    In my case the sversion.go path is located at D:\Programs\Go\src\runtime\internal\sys\zversion.go.

    Save the file, and restart the goland ide, then config the GOROOT (File -> setting -> Go -> GOROOT -> + -> local...), select you Go root path and save it.

    enter image description here