Intellij won't sync dependencies in Go project

Answered

This project runs from the command line, but Intellij can't find any of its dependencies.  They are in my GOPATH.  I've run `go mod tidy` and have deleted the .idea/ and *.iml files, but Intellij still won't sync the dependencies.

I've noticed in other projects if there is a problem Intellij will (eventually) prompt you to sync dependencies.  Is there a way to force Intellij to sync dependencies?

 

4 comments
Comment actions Permalink

Please make sure Go modules integration is enabled via Preferences | Go | Go Modules. After that, Sync Dependencies action should be available in go.mod file.

1
Comment actions Permalink

That was the problem.

I believe there was a ticket to fix this.  When there is a go.mod file in a project module integration is enabled by default.

0
Comment actions Permalink

You're right, Go modules integration should be enabled by default. However, there are several issues with that. Did you rollback between GoLand versions? 

0
Comment actions Permalink

I ran into this problem even with modules enabled.  For me the fix involved running the same go list command idea tried to see dependencies that needed a replace directive in the mod file.  Hope this helps if anyone runs into my version of the problem.

0

Please sign in to leave a comment.