cannot resolve directory of all the import

Completed

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:

```

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/chris/Library/Caches/go-build"
GOENV="/Users/chris/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/chris/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/chris/Workspace/device-sdk-go/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
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.

2
66 comments

Andriy Andrusyk, we've changed the process of indexing in 2023.2 version so you can try it out (https://www.jetbrains.com/go/nextversion/) to see if it works as expected.

0

The only thing that worked for me was to follow what @Appto said

1. CLOSE your project

2. remove your `.idea` folder

3. open your project 

0

I had the same problem,
 in Settings / Go /Go Modules : Enable Go integration was turned off by default.
I switched it on and it works

0

Remove `.idea` folder!

Just came across that error again and it's really annoying. Frustrated me for a while again.

The solution is, as Appto stated, to 1. CLOSE project, 2. REMOVE `.idea` folder, and 3. Re-Open Project.

It's also very crucial to close the project before `rm -rf .idea` will do its magic.

Please fix @Jetbrains, Daniil.

 

1

Hi,

Have you noticed the steps to reproduce this issue?

0

Unfortunately, I haven't found a way to safely reproduce this. All I can say is that it usually happens after some time in a particular workspace.

I'm using Windows 11 (WSL2 with Ubuntu LTS 22.04) and latest Goland 2024.1, matter of fact: Go version doesn't seem to influence the behaviour. I've had it with Go 1.20, 1.21 and just recently with 1.22; that's how I ended up here again.

Usually, it occurs after working on the same project for some time. Just basic development: Opening in the morning, closing sometime in the evening, rinse and repeat for a few weeks. Suddenly, Goland can't resolve dependencies (project external and internal) anymore.

I hope, it helps you investigate the issue further.

0

Please sign in to leave a comment.