12

I have installed my project's Go module dependencies with go build.

But GoLand is telling me it cannot resolve any of these dependencies.

How can I get GoLand to find the Go module dependencies?

sdgluck
  • 24,894
  • 8
  • 75
  • 90

2 Answers2

41

Make sure that you have Go Modules support enabled.

In your preferences go to Go > Go Modules (vgo) and check "Enable Go Modules":

enter image description here

sdgluck
  • 24,894
  • 8
  • 75
  • 90
  • 2
    even if I downloaded all dependencies, Goland stck at 3 `go list -m xxxx` processes. when I kill the process it restart again. Why Goland need more information whe the project is build-ready. – Jiang YD Mar 18 '20 at 12:36
5

navigate to path project with your file "go.mod" and execute the command line

go clean --modcache && go mod download

this will download every thing again.

if was necessary, remote all require block from your go.mod with tag "// indirect" and execute command

go mod tidy

that will downlaod all sub-dependences again.

OBS: if you project path is in $PATH system, you need remove, because now the go.mod is the sufficient to replace it.

E. Serrano
  • 4,634
  • 1
  • 18
  • 15