Valid methods in being highlighted in red 'Unresolved Reference'
Solution 1
The methods are defined in a big generated file that is not indexed by Gogland. To change the limit you should change idea.max.intellisense.filesize
.
To do this, open custom properties file via Help | Edit Custom Properties
menu and add something like this: idea.max.intellisense.filesize=4500
for 4.5 MB limit. The size is in Kilobytes.
Please use carefully, indexing large files may influence index update speed dramatically.
Solution 2
Ran into this recently with a project in 'bitbucket.org' GOPATH not finding ones in 'github.com'. Checked the "Index entire GOPATH" box and it fixed it.
This option is present at: Files > Settings (Preferences) > Go > GOPATH
Solution 3
Possibly not valid for the original context, but the workaround I discovered is to rename the file where the method or other identifier is defined, allow Goland to reindex, and then rename it back to the original name.
Solution 4
I had the same problem and this worked for me:
From the main menu, select File | Invalidate Caches.
In the Invalidate Caches dialogue, you can select additional actions that the IDE will perform while removing the cache files:
Clear file system cache and Local History
Click Invalidate and Restart.
Solution 5
For me, none of the above solutions worked. Finally I could solve it by enabling "Enable Go Modules Integration" checkbox located under Preferences > Go > Go Modules.
Sergey Andrianov
Updated on July 12, 2022Comments
-
Sergey Andrianov almost 2 years
How to solve this problem? The program works. But the methods in Gogland are highlighted in red. Qt version 5.8 is added.
Gogland (1.0 Preview) 1.0 EAP Build #GO-171.4694.61, built on June 27, 2017 Gogland EAP User Expiration date: September 25, 2017 JRE: 1.8.0_112-release-736-b21 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.8.0-58-generic batis@dev:~$ printenv | grep GO GOROOT=/usr/lib/go-1.8/ GOPATH=/home/batis/gocode/ package main import ( "os" "github.com/therecipe/qt/widgets" ) func main() { widgets.NewQApplication(len(os.Args), os.Args) //create a window window := widgets.NewQMainWindow(nil, 0) ...... widgets.QApplication_Exec() }
-
Mark about 4 yearsThis sorted me out after updating to 2020.1.
-
Abiral about 4 yearsThe option is present at : Files > Settings (Preferences) > Go > GOPATH
-
Stéphane Bruckert almost 4 yearswhat if this happens for 100 files?
-
Eric Alford over 3 yearsThis was the only thing that worked for me after trying the other avenues. Restarting didn't even work.
-
Fadyboy about 3 yearsThis eventually worked for me though I had to restart Goland
-
Rafael Eyng almost 3 yearsI tried this, I renamed the file (first it asked me to confirm because the file was from outside the project), and it worked. Then I tried to rename it back to the original and the IDE wouldn't let me (wouldn't even show the confirmation prompt). But then the "undo" worked, even though it didn't show that it worked until I restarted. Very confusing, but thanks for the suggestion!
-
Shah Zain over 2 yearsThis worked for me too!