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
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?
I came this issue when config goroot path in goland idea.
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.
It turns out that google-go-lang-idea-plugin
requires a slightly different folder structure than the default apt install produces. To fix it:
# mkdir /usr/lib/go/bin
# ln -s /usr/bin/go /usr/lib/go/bin/go
# ln -s /usr/bin/godoc /usr/lib/go/bin/godoc
# ln -s /usr/bin/gofmt /usr/lib/go/bin/gofmt
So I just had this exact problem on IntelliJ 2016.1.3
with Go 1.5.
I had installed the IntelliJ Go Plugin a while ago and installed GO 1.5
a while back, and it all worked fine. Now i checked and suddenly, I'm sure I didn't remove it, GO 1.5 was gone from my system. But who knows, I haven't worked with go for a bit, so I might have removed it.
Anyway, after a bit of debugging, the following steps helped me:
1.6.3
). Follow the instructions on https://golang.org/doc/installFile -> Project Structure -> Project -> under Project SDK add a New SDK and navigate to your go installation
.Apply
and then Ok
Step 1: Open cmd
Step 2: Run below command => go env
Step 3: Find GOROOT and according this GOROOT path select directory for Go Sdk.
You seem to have selected the GOPATH
, but the tool wants the GOROOT
! Look at this test that you fail:
I can only see linux_amd64
barely under your popup which indicates a GOPATH
to me.
In general, the trend nowadays is to install packages/tools (especially when they're so young like GO) as non-root users and in your home directory and adjust $PATH
and $GOPATH
in your environment instead of installing it globally. This will make it much easier to upgrade and change versions. I'd recommend to place go in ~/usr/local/go
and your GOPATH into ~/gopath
. Then point IntelliJ to ~/usr/local/go
插件:在go1.18.4上遇到同样的问题,只需要在${GOROOT}/src/runtime/internal/sys/zversion.go
中添加这行代码
const TheVersion = `go1.18`
I met the same problem when using go1.18 and add
const TheVersion = `go1.18`
in /src/runtime/internal/sys/zversion.go under GOROOT PATH
but it didn't work. Similar action for go1.17, it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.