cannot resolve directory of all the import


So the 「Cannot resolve directory」error just pop up today (used to work normally before..)

not sure how to fix it, I've tried "go clean --modcache" and "go mod download" but still couldn't fix

below is my go env:


GOENV="/Users/chris/Library/Application Support/go/env"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nr/rc6cpjnn0753bj5sgz776tgw0000gn/T/go-build247994700=/tmp/go-build -gno-record-gcc-switches -fno-common"

And I have the GOROOT and GOPATH set correctly in the goland preferences, I also Enabled Go Modules (vgo) integration and set 

Vgo Executable: Project SDK

Proxy: direct


Let me know if any further information is needed and thanks for the help in advance.


1. CLOSE your project

2. remove your `.idea` folder

3. open your project  


sidpat Hello, most often the error is solved in two ways:

The project contains a go.mod file:

  • Make sure Go Modules integration is enabled in settings (Preferences / Settings | Go | Go Modules), and GOPATH indexing is disabled (Preferences / Settings | Go | GOPATH | Index entire GOPATH).
  • All dependencies are synchronized. To do it, go to any .go file, hover over the import and press Alt(Option)+Enter, then select "Sync Dependencies of ...".

The project doesn't contain a go.mod file

  • Make sure the project is inside the GOPATH (echo $GOPATH).
  • Accordingly, Go Modules integration is disabled, and indexing is enabled.

Found a temporary solution (Jetbrains still needs to fix this)- Delete the .idea folder in your project directory and then from within goland, open the project from that directory.


Can you please try the following: File > Invalidates Caches / Restart?

If this has not changed anything, please send your project or its example (also attach the go.mod file) so that I can reproduce the situation.


Thanks for the screenshots. Do you have the opportunity to upgrade to the latest version of GoLand and see if the problem persists?


Also, for GoLand 2019.2, you need to make sure that Go Modules support is enabled manually. To do that, go to Preferences (Settings) > Go > Go Modules (vgo). You'll also need to manually enable the vendoring mode, which can be found in the same settings path.


I tried everything here and the only thing that helped me was removing the .idea directory.


so I just re-clone the repository and everything back normal again...

for your last question, I'm pretty sure though there's no option to like sync dependencies or sort import (or at least it did not auto suggest these options)

sorry for taking your time .


Thank you for taking the time to write to us, describing the situation in detail.

If the situation repeat or there are still questions, then write to us, we will be happy to help.


I am seeing a similar issue (have been for a while) and so I am going to start by adding to this ticket.

I have tried with GOPROXY set to "direct", "artifactory-proxy-for-public-and-company-repos", "artifactory-proxy-for-public-and-company-repos,direct", "off', ""
I am using go 1.14 but I also have go 1.13

Within Goland I sometimes see the terminal showing different GOPROXY values from the one I set in the preferences. At any time I can always to 'go run main.go" and it works. The resolution of symbols  and pkgs is a sad story! In terms of screenshots I don't see many differences from what Chris is seeing but I can try to attach some from my side.



This issue often comes and disappears randomly


I had this issue, restarting my IDE solved it. 


Fix is trivial. Just add your Go path to module path lol. Absolutely infuriating amount of hours lost until I found this 


Hi y'all, 
I had the same problem with GoLand 2021.3.2. I tried every solution mentioned earlier but it did not work for me. As Sidpat said I deleted the .idea folder and re-open the project from the project folder and it is fixed. This is so disturbing, can you please fix this bug?  


Martin Madsen, thank you. Will investigate.


I had the same problem. I deleted .idea folder and this solved the problem. The issue persisted after I updated to the latest version #GO-222.4345.24


Hello Chris!

Can you please attach the contents of the go.mod file? It will also be great if you attach a few screenshots from the settings: GOPATH, Go Modules, and Build Tags & Vendoring. I also advise you to see if the path to the folder exists precisely: /Users/chris/go/pkg/mod/


the go-mod-core-contracts@v0.1.58 did exist in my machine, below is it and the go.mod content


btw not sure if it's relevant, I've deleted the ~/go/pkg/sumdb directory like 2 weeks ago (was trying to replicate an error to my friend), and I think the directory is recreated by go again.


Can you tell me which version of GoLand you are using (GoLand > About GoLand)? I will also ask you to switch the view from "Project Files" to "Project" and expand the "External Libraries" section (and subfolders), then take a screenshot.

Besides, what options are available if you press Option + Enter?


Hello, what version of GoLand are you using? Did I understand you correctly that the same situation is observed with incorrect imports? If so, can you attach another screenshot with the External Libraries folder open (just below main.go in your case)? What options appear when you hover over an import and press Option (Alt) + Enter?



Yeah I have been having a lot of issues resolving public repos and/or private repos.


Hello! It doesn't look like I have any updates to go to. Please see screenshot.


Also I see this as soon as I re-enabled the vendoring mode manually.

It looks like it downloads it fine but it still is unable to resolve the pkg and the symbols. Trying to Synchronize the project also says "Successful" but nothing changes on the symbol resolution.


Hi, to update GoLand in your case, you need to open the Toolbox application, find the IDE there, and click "Update".


I updated through Toolbox but it so far hasn't helped. I tried tinkering with more env variables like GOSUMDB and GONOSUMDB.



There is something very whacky about Goland and the system env settings. There seems to be some lag in picking up the values or sometimes it never picks up the env vars from the system. At one point I even had an issue changing the GOPROXY value through Preferences.

Finally, invalidating caches and restarting worked. But at this time I have a default GOPROXY. Within a few days I may try to point it to our public facing proxy and see if it breaks. For now I am unblocked. Thanks Daniil.


Hello, Stephane Bruckert, please fill out a new ticket on our YouTrack. It'll be great if you include IDE logs (Help | Collect Logs and Diagnostic Data), sample project, and steps that may lead to a problem.


Is there any resolution for this? I'm having the exact same issue on

- macOS 10.14.6
- both GoLand 2019.3.4 and 2020.2.3
- go version go1.15.3 darwin/amd64
- GOPATH/GOROOT/Modules/etc. configured as discussed in this thread

- GoLand can't find modules that are clearly installed in $GOPATH/src for no obvious reason

Further noteworthy:
- project builds fine with go build
- When hovering over the imports GoLand states "Cannot resolve directory ''"
- There's no install/sync missing packages option in the context menu when right-clicking on the unresolved imports


I have also tjhe same issue that forces often to download the code from the repo to solve it. Invalidating does not help at all.

The problem also happens sometimes when i switch branches.

I hope it can be solved as it renders GoLand totally disfunctional 



Windows 10 latest

GoLand 2020.2.3 (but happened since 2019)

Go 15.1

- GOPATH/GOROOT as discussed above



I am facing a same issue in goland 2020.1.2 version. 

Unable to resolve the dependencies, tried with all above solution steps, but it didn't helped.


Nikhil Wakalkar It makes sense to update to the latest GoLand version (2020.3) if possible.

If that doesn't help, please, upload IDE logs to JetBrains Uploads and provide its name.


Thanks Daniil, it helped me to solve an issue after updating to latest version.

but not sure how it breaks all sudden though it was working in previous versions.


Please sign in to leave a comment.