Intellij won't sync dependencies in Go project


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?



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.


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.


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


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.


I also ran into similar issue, solution was close IJ then `rm -rf .idea/` and then re-open project.


Please sign in to leave a comment.