No buildable go source files after update Goland to EAP 19

Viewed 1905

After I updated GoLand from EAP 18 to EAP 19 my imports are red and these errors occur in each file:

Import errors

My $GOROOT and $GOPATH are the same as before. $GOROOT points to /usr/local/go. Files are buildable through shell but GoLand keep showing errors.

I am running GoLand on Mac OS with Go version go1.9.1 darwin/amd64:

GoLand (1.0 Preview) 1.0 EAP Build #GO-173.3727.24, built on November 16, 2017 GoLand EAP User Expiration date: December 16, 2017 JRE: 1.8.0_152-release-1024-b6 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.6

5 Answers

It looks like indexes are corrupted. File | Invalidate Caches should help.

If invalidating caches does not fix the problem for you, it can also be that the package has build constraints that prevent it from being built on your system. I was attempting to import golang.org/x/sys/windows/svc while using Goland on a Mac and it took me a while to realize why Goland was saying it didn't have sources files when clearly it did. All the files in the golang.org/x/sys/windows/svc package are constrained to only build on Windows.

One day I started to get this error on GoLand 2018.1

GOROOT & GOPATH where fine.

To fix that:

  • Opened File -> Settings -> Go -> GOPATH
  • Marked Index entire GOPATH

enter image description here

Try these step:

  1. close the goland IDE.
  2. delete the .idea folder.
  3. start the goland IDE.
Related