I'm using the GCE library in Go, along with go modules.
I'm finding that, while it happily compiles and runs unit tests, it's not resolving those types (e.g. compute.Instance) in the Goland IDE. I'm using 2020.2.
I first added this dependency by hand-coding (adding "google.golang.org/api/compute/v1"
to my imports, and letting the module handler load whatever it needs). It added google.golang.org/api v0.50.0
to my go.mod
file.
I've tried the old "Invalidate and Restart" approach, and it didn't do anything. I have another project where a different version of that module happens to be loaded, and it works fine on that one.
I've even tried a more nuclear version (Invalidate (no restart), close project, close IDE, delete the .idea
directory, and delete the contents of ~/.cache/JetBrains
). Still no dice.
FWIW my go module's version is go 1.15
You can navigate to the package sources by pressing Command/CTRL+Click
on the import statement (or via External Libraries menu in Project View) and find compute-gen.go
file and size limit warning. The IDE behaves as expected.
As a workaround, you can invoke Help | Edit Custom Properties...
and add the following line idea.max.intellisense.filesize=8500000
(depends on the original file size), restart GoLand. Please, keep in mind that the IDE can be slow when dealing with large files even if they are not open in the editor.
You can read more about the idea.properties
file here.