Cannot resolve dependencies 2023.1 onwards

已回答

Hi, 

since upgrading to 2023.3 all modules in my project are shown with unresolved dependencies. Go modules integration is enabled, tried sync dependencies, clearing caches, re-indexing, deleting .idea folder. Nothing helps. And it works fine in 2023.2 version. Tried even the beta version and it has the exact issue.

 Thanks for the help!

0

Hi,

Could you please reproduce the issue (invoke Sync Dependencies) and collect the IDE logs via Help | Collect Logs and Diagnostic Data, upload it to https://uploads.jetbrains.com/ and provide an uploaded ID?

Also, does it happen with other projects, for example https://github.com/uber-go/zap?

0

I did right click on go mod file and then "sync go module" because sync dependencies was not showing in go.mod file when i press alt-enter. My upload ID is 2024_03_26_byRXns4q9k256f7CJqw9E9.

No this doesn't happen on a different project I have just this one. But another person I'm working with also has the exact same problem with the same project.

0

Here's another one. I tried to delete .idea folder and reopen the project with 2024.1 RC version. Same result, unable to resolve any dependencies. The upload ID is 2024_03_26_mFVUffEnyteKoPbD2wfdpb 

0

What's the content of go.work file? Did you specify the current module (use .) in it? Will it work if you temporarily delete go.work?

0

I tried deleting it and it doesn't get recreated. It had the modules, yes. How do I rebuild it now?

Why would it be different between 2023.2 and 2323.3? Because it worked fine in 2023.2.

 

0

You can re-build it by right-clicking on the project name, select New | Go Workspace File.

Why would it be different between 2023.2 and 2323.3? Because it worked fine in 2023.2.

It's really hard to tell because I don't have any details about your project content, specified modules and so on. It would be great if you can reproduce it on an open-source project or isolate this problem from your main codebase and share it.

1

I don't have a new “Go Workspace File” option when right clicking the project name. I also couldn't really reproduce this because on another project it opens normally. I recreated the go.work file manually and it had no effect. Still unable to resolv any dependency.

0

Could you please collect the IDE logs via Help | Collect Logs and Diagnostic Data, upload it to https://uploads.jetbrains.com/ and provide an uploaded ID? Also, please share the content of go.work file.

0

This is the upload id: 2024_03_27_qzXHLyNQBAqsqKrMdxgTEM 

The go.work file looks like this:

go 1.22.0

use (
    agents
    common
    engine-common
    performance
    services/acprovider
    services/agenthandler
    services/cloudcollector
    services/cloudengine
    services/clusteranalysis
    services/compliance
    services/gitprovider
    services/inventory
    services/policy
    services/scheduler
    services/temporalworker
    services/workload
    tools
)

replace (
    github.com/draios/secure-iac/common v0.0.0 => ./common
    github.com/draios/secure-iac/engine-common v0.0.0 => ./engine-common
    github.com/nats-io/nats.go v1.16.0 => github.com/draios/nats.go-ws-path v1.14.1-0.20230208122625-8eb515853464
)

0

Have you tried to add a root module to go.work, like:

go 1.22.0

use (
    .
    agents
    common
    engine-common
    performance
    services/acprovider
    services/agenthandler
    services/cloudcollector
    services/cloudengine
    services/clusteranalysis
    services/compliance
    services/gitprovider
    services/inventory
    services/policy
    services/scheduler
    services/temporalworker
    services/workload
    tools
)

replace (
    github.com/draios/secure-iac/common v0.0.0 => ./common
    github.com/draios/secure-iac/engine-common v0.0.0 => ./engine-common
    github.com/nats-io/nats.go v1.16.0 => github.com/draios/nats.go-ws-path v1.14.1-0.20230208122625-8eb515853464
)
0

This is the result:

cannot load module . listed in go.work file: open go.mod: no such file or directory

0

I cannot reproduce this issue in my local environment. I performed several checks to make it similar to your project structure.

May I ask you to isolate your project structure to a hello-world project with a similar structure of modules, go.work file, vendor directory (if it exists)? It'll help us to troubleshoot the issue together.

 

0

请先登录再写评论。